Chromium Code Reviews| Index: gclient_scm.py |
| diff --git a/gclient_scm.py b/gclient_scm.py |
| index bb719ebf7086de0a0f0721d7bb9948939a1eedef..741ec01e37af53aefc01ae369a2a00fdda8a3c04 100644 |
| --- a/gclient_scm.py |
| +++ b/gclient_scm.py |
| @@ -190,6 +190,7 @@ class GitFilter(object): |
| class GitWrapper(SCMWrapper): |
| """Wrapper for Git""" |
| + name = 'git' |
| cache_dir = None |
| # If a given cache is used in a solution more than once, prevent multiple |
| @@ -363,13 +364,13 @@ class GitWrapper(SCMWrapper): |
| # Make the output a little prettier. It's nice to have some whitespace |
| # between projects when cloning. |
| print('') |
| - return |
| + return self._Capture(['rev-parse', 'HEAD']) |
|
Isaac (away)
2013/09/15 16:18:10
Note that _Capture will throw an exception on non-
iannucci
2013/09/19 21:20:43
Dones'd
|
| if not managed: |
| self._UpdateBranchHeads(options, fetch=False) |
| self.UpdateSubmoduleConfig() |
| print ('________ unmanaged solution; skipping %s' % self.relpath) |
| - return |
| + return self._Capture(['rev-parse', 'HEAD']) |
| if not os.path.exists(os.path.join(self.checkout_path, '.git')): |
| raise gclient_utils.Error('\n____ %s%s\n' |
| @@ -406,7 +407,7 @@ class GitWrapper(SCMWrapper): |
| self._PossiblySwitchCache(url, options) |
| if return_early: |
| - return |
| + return self._Capture(['rev-parse', 'HEAD']) |
| cur_branch = self._GetCurrentBranch() |
| @@ -595,6 +596,8 @@ class GitWrapper(SCMWrapper): |
| print('\n_____ removing unversioned directory %s' % path) |
| gclient_utils.rmtree(full_path) |
| + return self._Capture(['rev-parse', 'HEAD']) |
| + |
| def revert(self, options, _args, file_list): |
| """Reverts local modifications. |
| @@ -1088,6 +1091,7 @@ class GitWrapper(SCMWrapper): |
| class SVNWrapper(SCMWrapper): |
| """ Wrapper for SVN """ |
| + name = 'svn' |
| @staticmethod |
| def BinaryExists(): |
| @@ -1202,11 +1206,11 @@ class SVNWrapper(SCMWrapper): |
| command = ['checkout', url, self.checkout_path] |
| command = self._AddAdditionalUpdateFlags(command, options, revision) |
| self._RunAndGetFileList(command, options, file_list, self._root_dir) |
| - return |
| + return self.Svnversion() |
| if not managed: |
| print ('________ unmanaged solution; skipping %s' % self.relpath) |
| - return |
| + return self.Svnversion() |
| if 'URL' not in from_info: |
| raise gclient_utils.Error( |
| @@ -1294,7 +1298,7 @@ class SVNWrapper(SCMWrapper): |
| command = ['checkout', url, self.checkout_path] |
| command = self._AddAdditionalUpdateFlags(command, options, revision) |
| self._RunAndGetFileList(command, options, file_list, self._root_dir) |
| - return |
| + return self.Svnversion() |
| # If the provided url has a revision number that matches the revision |
| # number of the existing directory, then we don't need to bother updating. |
| @@ -1316,6 +1320,7 @@ class SVNWrapper(SCMWrapper): |
| and not os.path.islink(full_path)): |
| print('\n_____ removing unversioned directory %s' % status[1]) |
| gclient_utils.rmtree(full_path) |
| + return self.Svnversion() |
| def updatesingle(self, options, args, file_list): |
| filename = args.pop() |
| @@ -1442,6 +1447,11 @@ class SVNWrapper(SCMWrapper): |
| gclient_utils.CheckCallAndFilterAndHeader(['svn'] + args, |
| always=options.verbose, **kwargs) |
| + def Svnversion(self): |
| + """Runs the lowest checked out revision in the current project.""" |
| + info = scm.SVN.CaptureLocalInfo([], os.path.join(self.checkout_path, '.')) |
| + return info['Revision'] |
|
Isaac (away)
2013/09/15 16:18:10
Would 'last changed rev' be better?
iannucci
2013/09/19 21:20:43
Maybe, but currently it uses Revision as far as I
|
| + |
| def _RunAndGetFileList(self, args, options, file_list, cwd=None): |
| """Runs a commands that goes to stdout and grabs the file listed.""" |
| cwd = cwd or self.checkout_path |