Chromium Code Reviews| Index: gclient_scm.py |
| =================================================================== |
| --- gclient_scm.py (revision 82287) |
| +++ gclient_scm.py (working copy) |
| @@ -126,6 +126,12 @@ |
| class GitWrapper(SCMWrapper): |
| """Wrapper for Git""" |
| + def GetDateRevision(self, revision): |
| + """Returns the current revision's date in the form "{<date>}""""" |
|
M-A Ruel
2011/04/20 15:43:28
Document the time zone used, local or UTC?
Also,
Florian Loitsch
2011/04/20 18:32:01
changed to GetRevisionDate.
added helper function
|
| + # return "{" + self._Capture(['log', '-n', '1', '--format=%ai', |
| + # revision + "^.." + revision]) + "}" |
| + return "{" + self._Capture(['log', '-n', '1', '--format=%ai']) + "}" |
| + |
| @staticmethod |
| def cleanup(options, args, file_list): |
| """'Cleanup' the repo. |
| @@ -186,6 +192,12 @@ |
| if not revision: |
| revision = default_rev |
| + if gclient_utils.IsDateRevision(revision): |
| + # Date-revisions only work on git-repositories if the reflog hasn't |
| + # expired yet. Use rev-list to get the corresponding revision. |
| + revision = self._Capture(['rev-list', '-n 1', |
| + '--before="' + revision[1:-1] + '"', |
| + self._GetCurrentBranch()]) |
| rev_str = ' at %s' % revision |
| files = [] |
| @@ -668,6 +680,12 @@ |
| class SVNWrapper(SCMWrapper): |
| """ Wrapper for SVN """ |
| + def GetDateRevision(self, revision): |
| + """Returns the given revision's date in the form "{<date>}""""" |
| + date = scm.SVN.Capture(['propget', '--revprop', 'svn:date', '-r', revision, |
| + os.path.join(self.checkout_path, '.')]) |
| + return "{" + date.strip() + "}" |
|
M-A Ruel
2011/04/20 15:43:28
Same as 133.
Florian Loitsch
2011/04/20 18:32:01
same as 133.
|
| + |
| def cleanup(self, options, args, file_list): |
| """Cleanup working copy.""" |
| self._Run(['cleanup'] + args, options) |