Chromium Code Reviews| 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) |