[scm] Remove unused methods

Bug: 1475776
Change-Id: I75f8358f5ed475c180b60cfed825e66e4733f8f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5422043
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
changes/43/5422043/2
Aravind Vasudevan 1 year ago committed by LUCI CQ
parent 7fa774456f
commit 7a7c5e3adc

@ -229,15 +229,6 @@ class GIT(object):
key = 'branch.%s.%s' % (branch, key)
GIT.SetConfig(cwd, key, value)
@staticmethod
def IsWorkTreeDirty(cwd):
return GIT.Capture(['status', '-s'], cwd=cwd) != ''
@staticmethod
def GetEmail(cwd):
"""Retrieves the user email address if known."""
return GIT.GetConfig(cwd, 'user.email', '')
@staticmethod
def ShortBranchName(branch):
"""Converts a name like 'refs/heads/foo' to just 'foo'."""
@ -428,17 +419,6 @@ class GIT(object):
diff[i] = '--- %s' % diff[i + 1][4:]
return ''.join(diff)
@staticmethod
def GetDifferentFiles(cwd, branch=None, branch_head='HEAD'):
"""Returns the list of modified files between two branches."""
if not branch:
branch = GIT.GetUpstreamBranch(cwd)
command = [
'-c', 'core.quotePath=false', 'diff', '--name-only',
branch + "..." + branch_head
]
return GIT.Capture(command, cwd=cwd).splitlines(False)
@staticmethod
def GetAllFiles(cwd):
"""Returns the list of all files under revision control."""
@ -462,12 +442,6 @@ class GIT(object):
commit_hashes[record[3]] = record[1]
return commit_hashes
@staticmethod
def GetPatchName(cwd):
"""Constructs a name for this patch."""
short_sha = GIT.Capture(['rev-parse', '--short=4', 'HEAD'], cwd=cwd)
return "%s#%s" % (GIT.GetBranch(cwd), short_sha)
@staticmethod
def GetCheckoutRoot(cwd):
"""Returns the top level directory of a git checkout as an absolute path.
@ -475,10 +449,6 @@ class GIT(object):
root = GIT.Capture(['rev-parse', '--show-cdup'], cwd=cwd)
return os.path.abspath(os.path.join(cwd, root))
@staticmethod
def GetGitDir(cwd):
return os.path.abspath(GIT.Capture(['rev-parse', '--git-dir'], cwd=cwd))
@staticmethod
def IsInsideWorkTree(cwd):
try:

@ -28,14 +28,6 @@ class GitWrapperTestCase(unittest.TestCase):
super(GitWrapperTestCase, self).setUp()
self.root_dir = '/foo/bar'
@mock.patch('scm.GIT.Capture')
def testGetEmail(self, mockCapture):
mockCapture.return_value = 'user.email\nmini@me.com\x00'
self.assertEqual(scm.GIT.GetEmail(self.root_dir), 'mini@me.com')
mockCapture.assert_called_with(['config', '--list', '-z'],
cwd=self.root_dir,
strip_out=False)
def testRefToRemoteRef(self):
remote = 'origin'
refs = {

Loading…
Cancel
Save