Chromium Code Reviews| Index: gclient_scm.py |
| =================================================================== |
| --- gclient_scm.py (revision 82997) |
| +++ gclient_scm.py (working copy) |
| @@ -126,6 +126,13 @@ |
| class GitWrapper(SCMWrapper): |
| """Wrapper for Git""" |
| + def GetRevisionDate(self, revision): |
| + """Returns the given revision's date in ISO-8601 format (which contains the |
| + time zone).""" |
| + # 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 +193,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] + '"', |
|
M-A Ruel
2011/04/26 18:38:49
optional style nit: I prefer:
'--before="%s"' %
Florian Loitsch
2011/04/27 10:58:23
Since git is not working (and actually crashes, be
|
| + self._GetCurrentBranch()]) |
| rev_str = ' at %s' % revision |
| files = [] |
| @@ -668,6 +681,13 @@ |
| class SVNWrapper(SCMWrapper): |
| """ Wrapper for SVN """ |
| + def GetRevisionDate(self, revision): |
| + """Returns the given revision's date in ISO-8601 format (which contains the |
| + time zone).""" |
| + date = scm.SVN.Capture(['propget', '--revprop', 'svn:date', '-r', revision, |
| + os.path.join(self.checkout_path, '.')]) |
| + return date.strip() |
| + |
| def cleanup(self, options, args, file_list): |
| """Cleanup working copy.""" |
| self._Run(['cleanup'] + args, options) |