Lines Matching full:repo

55         """Tests that new files in commit are added to the repo."""
56 repo = GitRepo(self.tmp_path / "repo")
57 repo.init()
58 repo.commit("Add README.md.", update_files={"README.md": "Hello, world!"})
59 self.assertEqual(repo.commit_message_at_revision("HEAD"), "Add README.md.\n")
61 repo.file_contents_at_revision("HEAD", "README.md"), "Hello, world!"
66 repo = GitRepo(self.tmp_path / "repo")
67 repo.init()
68 repo.commit("Add README.md.", update_files={"README.md": "Hello, world!"})
69 repo.commit("Update README.md.", update_files={"README.md": "Goodbye, world!"})
70 self.assertEqual(repo.commit_message_at_revision("HEAD^"), "Add README.md.\n")
72 repo.file_contents_at_revision("HEAD^", "README.md"), "Hello, world!"
74 self.assertEqual(repo.commit_message_at_revision("HEAD"), "Update README.md.\n")
76 repo.file_contents_at_revision("HEAD", "README.md"), "Goodbye, world!"
80 """Tests that files deleted by commit are removed from the repo."""
81 repo = GitRepo(self.tmp_path / "repo")
82 repo.init()
83 repo.commit("Add README.md.", update_files={"README.md": "Hello, world!"})
84 repo.commit("Remove README.md.", delete_files={"README.md"})
85 self.assertEqual(repo.commit_message_at_revision("HEAD^"), "Add README.md.\n")
87 repo.file_contents_at_revision("HEAD^", "README.md"), "Hello, world!"
89 self.assertEqual(repo.commit_message_at_revision("HEAD"), "Remove README.md.\n")
95 str(repo.path),
111 repo = GitRepo(self.tmp_path / "repo")
112 repo.init("main")
113 self.assertEqual(repo.current_branch(), "main")
116 """Tests that current branch fails when there is no git repo."""
118 GitRepo(self.tmp_path / "repo").current_branch()
122 repo = GitRepo(self.tmp_path / "repo")
123 repo.init("main")
124 repo.switch_to_new_branch("feature")
125 self.assertEqual(repo.current_branch(), "feature")
129 repo = GitRepo(self.tmp_path / "repo")
130 repo.init("main")
131 repo.commit("Initial commit.", allow_empty=True)
133 repo.switch_to_new_branch("main")
137 repo = GitRepo(self.tmp_path / "repo")
138 repo.init("main")
139 repo.commit("Initial commit.", allow_empty=True)
140 initial_commit = repo.head()
141 repo.commit("Second commit.", allow_empty=True)
142 repo.switch_to_new_branch("feature", start_point=initial_commit)
143 self.assertEqual(repo.current_branch(), "feature")
144 self.assertEqual(repo.head(), initial_commit)
148 repo = GitRepo(self.tmp_path / "repo")
149 repo.init("main")
150 repo.commit("Initial commit.", allow_empty=True)
151 self.assertEqual(repo.sha_of_ref("heads/main"), repo.head())
155 repo = GitRepo(self.tmp_path / "repo")
156 repo.init()
157 repo.commit("Initial commit.", allow_empty=True)
158 repo.commit("Second commit.", allow_empty=True)
159 repo.tag("v1.0.0")
160 self.assertEqual(repo.sha_of_ref("tags/v1.0.0"), repo.head())
164 repo = GitRepo(self.tmp_path / "repo")
165 repo.init()
166 repo.commit("Initial commit.", allow_empty=True)
167 first_commit = repo.head()
168 repo.commit("Second commit.", allow_empty=True)
169 repo.tag("v1.0.0", first_commit)
170 self.assertEqual(repo.sha_of_ref("tags/v1.0.0"), first_commit)