mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Rename get_branch() to get_current_branch().
This commit is contained in:
parent
7696e7e530
commit
cc9f03dea9
2 changed files with 6 additions and 6 deletions
|
@ -79,7 +79,7 @@ class Git(VersionControl):
|
|||
version = '.'.join(version.split('.')[:3])
|
||||
return parse_version(version)
|
||||
|
||||
def get_branch(self, location):
|
||||
def get_current_branch(self, location):
|
||||
"""
|
||||
Return the current branch, or None if HEAD isn't at a branch
|
||||
(e.g. detached HEAD).
|
||||
|
@ -210,7 +210,7 @@ class Git(VersionControl):
|
|||
if not self.is_commit_id_equal(dest, rev_options.rev):
|
||||
cmd_args = ['checkout', '-q'] + rev_options.to_args()
|
||||
self.run_command(cmd_args, cwd=dest)
|
||||
elif self.get_branch(dest) != branch_name:
|
||||
elif self.get_current_branch(dest) != branch_name:
|
||||
# Then a specific branch was requested, and that branch
|
||||
# is not yet checked out.
|
||||
track_branch = 'origin/{}'.format(branch_name)
|
||||
|
|
|
@ -83,14 +83,14 @@ def test_get_remote_url(script, tmpdir):
|
|||
assert remote_url == source_url
|
||||
|
||||
|
||||
def test_get_branch(script):
|
||||
def test_get_current_branch(script):
|
||||
repo_dir = str(script.scratch_path)
|
||||
|
||||
script.run('git', 'init', cwd=repo_dir)
|
||||
sha = do_commit(script, repo_dir)
|
||||
|
||||
git = Git()
|
||||
assert git.get_branch(repo_dir) == 'master'
|
||||
assert git.get_current_branch(repo_dir) == 'master'
|
||||
|
||||
# Switch to a branch with the same SHA as "master" but whose name
|
||||
# is alphabetically after.
|
||||
|
@ -98,11 +98,11 @@ def test_get_branch(script):
|
|||
'git', 'checkout', '-b', 'release', cwd=repo_dir,
|
||||
expect_stderr=True,
|
||||
)
|
||||
assert git.get_branch(repo_dir) == 'release'
|
||||
assert git.get_current_branch(repo_dir) == 'release'
|
||||
|
||||
# Also test the detached HEAD case.
|
||||
script.run('git', 'checkout', sha, cwd=repo_dir, expect_stderr=True)
|
||||
assert git.get_branch(repo_dir) is None
|
||||
assert git.get_current_branch(repo_dir) is None
|
||||
|
||||
|
||||
def test_get_revision_sha(script):
|
||||
|
|
Loading…
Reference in a new issue