]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/git.py
Retrieve the dates for all branches with one bulk git call in the VFS.
[bup.git] / lib / bup / git.py
index 9d0b66f204bdc0d018b78018f9094918e2b143f7..2552c45fdcac4321b0b9f9718192b3353e4b2eb7 100644 (file)
@@ -744,7 +744,7 @@ def rev_list(ref, count=None):
     opts = []
     if count:
         opts += ['-n', str(atoi(count))]
-    argv = ['git', 'rev-list', '--pretty=format:%ct'] + opts + [ref, '--']
+    argv = ['git', 'rev-list', '--pretty=format:%at'] + opts + [ref, '--']
     p = subprocess.Popen(argv, preexec_fn = _gitenv, stdout = subprocess.PIPE)
     commit = None
     for row in p.stdout:
@@ -759,11 +759,13 @@ def rev_list(ref, count=None):
         raise GitError, 'git rev-list returned error %d' % rv
 
 
-def rev_get_date(ref):
-    """Get the date of the latest commit on the specified ref."""
-    for (date, commit) in rev_list(ref, count=1):
-        return date
-    raise GitError, 'no such commit %r' % ref
+def get_commit_dates(refs):
+    """Get the dates for the specified commit refs."""
+    result = []
+    cmd = ['git', 'show', '-s', '--pretty=format:%ct']
+    for chunk in batchpipe(cmd, refs, preexec_fn=_gitenv):
+        result += chunk.splitlines()
+    return result
 
 
 def rev_parse(committish):