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

Side by Side 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, 4 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 import errno 6 import errno
7 import fnmatch 7 import fnmatch
8 import logging 8 import logging
9 import os 9 import os
10 import subprocess 10 import subprocess
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 assert 'stdin' not in kwargs 129 assert 'stdin' not in kwargs
130 kwargs['stdin'] = subprocess.PIPE 130 kwargs['stdin'] = subprocess.PIPE
131 ok_ret = kwargs.pop('ok_ret', {0}) 131 ok_ret = kwargs.pop('ok_ret', {0})
132 cmd = ('git',) + args 132 cmd = ('git',) + args
133 133
134 self._log.debug('Running %r', cmd) 134 self._log.debug('Running %r', cmd)
135 started = time.time() 135 started = time.time()
136 process = subprocess.Popen(cmd, **kwargs) 136 process = subprocess.Popen(cmd, **kwargs)
137 output, errout = process.communicate(indata) 137 output, errout = process.communicate(indata)
138 retcode = process.poll() 138 retcode = process.poll()
139 self._log.debug('Finished in %.1f sec', time.time() - started) 139 dt = time.time() - started
140 if dt > 1: # pragma: no cover
141 self._log.debug('Finished in %.1f sec', dt)
140 if retcode not in ok_ret: 142 if retcode not in ok_ret:
141 raise CalledProcessError(retcode, cmd, output, errout) 143 raise CalledProcessError(retcode, cmd, output, errout)
142 144
143 if errout: 145 if errout:
144 sys.stderr.write(errout) 146 sys.stderr.write(errout)
145 return output 147 return output
146 148
147 def intern(self, data, typ='blob'): 149 def intern(self, data, typ='blob'):
148 return self.run( 150 return self.run(
149 'hash-object', '-w', '-t', typ, '--stdin', indata=str(data)).strip() 151 'hash-object', '-w', '-t', typ, '--stdin', indata=str(data)).strip()
152
153 def fast_forward_push(self, refs_and_commits):
154 """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.
155
156 Args:
157 refs_and_commits: dict {Ref object -> Commit to push to the ref}.
158 """
159 refspec = [
160 '%s:%s' % (c.hsh, r.ref)
161 for r, c in refs_and_commits.iteritems()
162 ]
163 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
164 for r, c in refs_and_commits.iteritems():
165 r.update_to(c)
OLDNEW
« 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