| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,10 +78,8 @@ def test_init_repo_object(self, rw_dir): | |||
| 78 | 78 | self.assertEqual(repo.refs[active_branch.name], repo.heads[active_branch.name]) # .refs provides all refs... | |
| 79 | 79 | ||
| 80 | 80 | if "TRAVIS" not in os.environ: | |
| 81 | - remote_head = repo.remotes.origin.refs.HEAD.reference | ||
| 82 | - self.assertEqual( | ||
| 83 | - repo.refs[remote_head.name], repo.remotes.origin.refs[remote_head.remote_head] | ||
| 84 | - ) # ...remotes... | ||
| 81 | + remote_branch = next(ref for ref in repo.remotes.origin.refs if ref.remote_head != "HEAD") | ||
| 82 | + self.assertEqual(repo.refs[remote_branch.name], remote_branch) # ...remotes... | ||
| 85 | 83 | self.assertEqual(repo.refs["0.3.5"], repo.tags["0.3.5"]) # ... and tags. | |
| 86 | 84 | # ![8-test_init_repo_object] | |
| 87 | 85 | ||
@@ -147,9 +145,9 @@ def update(self, op_code, cur_count, max_count=None, message=""): | |||
| 147 | 145 | assert origin.exists() | |
| 148 | 146 | for fetch_info in origin.fetch(progress=MyProgressPrinter()): | |
| 149 | 147 | print("Updated %s to %s" % (fetch_info.ref, fetch_info.commit)) | |
| 150 | - # Create a local branch at the remote's default branch. | ||
| 151 | - remote_default_branch = origin.refs.HEAD.reference | ||
| 152 | - bare_branch = bare_repo.create_head(remote_default_branch.remote_head, remote_default_branch) | ||
| 148 | + # Create a local branch at one of the remote's branches. | ||
| 149 | + remote_branch = next(ref for ref in origin.refs if ref.remote_head != "HEAD") | ||
| 150 | + bare_branch = bare_repo.create_head(remote_branch.remote_head, remote_branch) | ||
| 153 | 151 | bare_repo.head.set_reference(bare_branch) | |
| 154 | 152 | assert not bare_repo.delete_remote(origin).exists() | |
| 155 | 153 | # push and pull behave very similarly. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments