Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: gclient_scm.py

Issue 6873110: Add --transitive flag. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: local switch to other directory Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | gclient_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 6dc4da7f609ff0e65f8bd6d74f1c697645e6cd94..99461d13f97615f1b63b254af58f1afdac03f29a 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -126,6 +126,13 @@ class SCMWrapper(object):
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)."""
+ # TODO(floitsch): get the time-stamp of the given revision and not just the
+ # time-stamp of the currently checked out revision.
+ return self._Capture(['log', '-n', '1', '--format=%ai'])
+
@staticmethod
def cleanup(options, args, file_list):
"""'Cleanup' the repo.
@@ -186,6 +193,14 @@ class GitWrapper(SCMWrapper):
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.
+ # git rev-list -n 1 --before='time-stamp' branchname
+ if options.transitive:
+ print('Warning: --transitive only works for SVN repositories.')
+ revision = default_rev
+
rev_str = ' at %s' % revision
files = []
@@ -668,6 +683,13 @@ class GitWrapper(SCMWrapper):
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)
« no previous file with comments | « gclient.py ('k') | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698