Skip to content

Commit

Permalink
Remove git repo determine_ref_type unused code
Browse files Browse the repository at this point in the history
Remove the _determine_ref_type routine from GitRepository because it isn't
being used.

Testing:
  python2/3 - unit tests - pass
  python2/3 - manual checkout status - ok
  • Loading branch information
bjandre committed Nov 22, 2017
1 parent d90567c commit c5e57b3
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions manic/repository_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,50 +100,6 @@ def _clone_repo(self, base_dir_path, repo_dir_name):
self._git_clone(self._url, repo_dir_name)
os.chdir(cwd)

def _determine_ref_type(self, ref):
"""
Determine if 'ref' is a local branch, a remote branch, a tag, or a
commit.
Should probably use this command instead:
git show-ref --verify --quiet refs/heads/<branch-name>
"""
ref_type = self.GIT_REF_UNKNOWN
# First check for local branch
gitout = self._git_branch()
if gitout is not None:
branches = [x.lstrip('* ') for x in gitout.splitlines()]
for branch in branches:
if branch == ref:
ref_type = self.GIT_REF_LOCAL_BRANCH
break

# Next, check for remote branch
if ref_type == self.GIT_REF_UNKNOWN:
gitout = self._git_branch_remotes()
if gitout is not None:
for branch in gitout.splitlines():
match = GitRepository.RE_REMOTEBRANCH.match(branch)
if (match is not None) and (match.group(1) == ref):
ref_type = self.GIT_REF_REMOTE_BRANCH
break

# Next, check for a tag
if ref_type == self.GIT_REF_UNKNOWN:
gitout = self._git_tag()
if gitout is not None:
for tag in gitout.splitlines():
if tag == ref:
ref_type = self.GIT_REF_TAG
break

# Finally, see if it just looks like a commit hash
if ((ref_type == self.GIT_REF_UNKNOWN) and
GitRepository.RE_GITHASH.match(ref)):
ref_type = self.GIT_REF_SHA1

# Return what we've come up with
return ref_type

@staticmethod
def _current_ref_from_branch_command(git_output):
"""Parse output of the 'git branch' command to determine the current branch.
Expand Down

0 comments on commit c5e57b3

Please sign in to comment.