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

Unified Diff: infra/libs/git2/repo.py

Issue 424423004: Push pending tag and synthesized commit in a single git push operation. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years, 5 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 | « infra/libs/git2/ref.py ('k') | infra/libs/git2/test/ref_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/libs/git2/repo.py
diff --git a/infra/libs/git2/repo.py b/infra/libs/git2/repo.py
index 1a2ffa04d202165a9ac79c693e2c9bdb6e7a8dc0..030332a42744440cb68d245ef942f39b93257d6c 100644
--- a/infra/libs/git2/repo.py
+++ b/infra/libs/git2/repo.py
@@ -136,7 +136,9 @@ class Repo(object):
process = subprocess.Popen(cmd, **kwargs)
output, errout = process.communicate(indata)
retcode = process.poll()
- self._log.debug('Finished in %.1f sec', time.time() - started)
+ dt = time.time() - started
+ if dt > 1: # pragma: no cover
+ self._log.debug('Finished in %.1f sec', dt)
if retcode not in ok_ret:
raise CalledProcessError(retcode, cmd, output, errout)
@@ -147,3 +149,17 @@ class Repo(object):
def intern(self, data, typ='blob'):
return self.run(
'hash-object', '-w', '-t', typ, '--stdin', indata=str(data)).strip()
+
+ def fast_forward_push(self, refs_and_commits):
+ """Push commits to refs on the remote, and also update refs' local copies.
iannucci 2014/07/30 19:28:18 make it clear that the ref in the dictionary is th
Vadim Sh. 2014/07/30 20:15:35 Done.
+
+ Args:
+ refs_and_commits: dict {Ref object -> Commit to push to the ref}.
+ """
+ refspec = [
+ '%s:%s' % (c.hsh, r.ref)
+ for r, c in refs_and_commits.iteritems()
+ ]
+ self.run('push', 'origin', *refspec)
iannucci 2014/07/30 19:28:18 is there a minimum git version which is required f
Vadim Sh. 2014/07/30 20:15:35 I don't think so. Help page for 1.7.5 already ment
+ for r, c in refs_and_commits.iteritems():
+ r.update_to(c)
« no previous file with comments | « infra/libs/git2/ref.py ('k') | infra/libs/git2/test/ref_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698