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

Side by Side Diff: git_cl.py

Issue 2322783002: git cl land to refs/pending: remove unused arg. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld and Gerrit.""" 8 """A git-command for integrating reviews on Rietveld and Gerrit."""
9 9
10 from __future__ import print_function 10 from __future__ import print_function
(...skipping 4179 matching lines...) Expand 10 before | Expand all | Expand 10 after
4190 # If not using refs/pending/heads/* at all, or target ref is already set 4190 # If not using refs/pending/heads/* at all, or target ref is already set
4191 # to pending, then push to the target ref directly. 4191 # to pending, then push to the target ref directly.
4192 retcode, output = RunGitWithCode( 4192 retcode, output = RunGitWithCode(
4193 ['push', '--porcelain', pushurl, 'HEAD:%s' % branch]) 4193 ['push', '--porcelain', pushurl, 'HEAD:%s' % branch])
4194 pushed_to_pending = pending_prefix and branch.startswith(pending_prefix) 4194 pushed_to_pending = pending_prefix and branch.startswith(pending_prefix)
4195 else: 4195 else:
4196 # Cherry-pick the change on top of pending ref and then push it. 4196 # Cherry-pick the change on top of pending ref and then push it.
4197 assert branch.startswith('refs/'), branch 4197 assert branch.startswith('refs/'), branch
4198 assert pending_prefix[-1] == '/', pending_prefix 4198 assert pending_prefix[-1] == '/', pending_prefix
4199 pending_ref = pending_prefix + branch[len('refs/'):] 4199 pending_ref = pending_prefix + branch[len('refs/'):]
4200 retcode, output = PushToGitPending(pushurl, pending_ref, branch) 4200 retcode, output = PushToGitPending(pushurl, pending_ref)
4201 pushed_to_pending = (retcode == 0) 4201 pushed_to_pending = (retcode == 0)
4202 if retcode == 0: 4202 if retcode == 0:
4203 revision = RunGit(['rev-parse', 'HEAD']).strip() 4203 revision = RunGit(['rev-parse', 'HEAD']).strip()
4204 else: 4204 else:
4205 # dcommit the merge branch. 4205 # dcommit the merge branch.
4206 cmd_args = [ 4206 cmd_args = [
4207 'svn', 'dcommit', 4207 'svn', 'dcommit',
4208 '-C%s' % options.similarity, 4208 '-C%s' % options.similarity,
4209 '--no-rebase', '--rmdir', 4209 '--no-rebase', '--rmdir',
4210 ] 4210 ]
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4297 to_rev = RunGit(['rev-parse', 'FETCH_HEAD']).strip() 4297 to_rev = RunGit(['rev-parse', 'FETCH_HEAD']).strip()
4298 commits = RunGit(['rev-list', '%s..%s' % (current_rev, to_rev)]) 4298 commits = RunGit(['rev-list', '%s..%s' % (current_rev, to_rev)])
4299 for commit in commits.splitlines(): 4299 for commit in commits.splitlines():
4300 if RunGit(['rev-parse', '%s:' % commit]).strip() == target_tree: 4300 if RunGit(['rev-parse', '%s:' % commit]).strip() == target_tree:
4301 print('Found commit on %s' % real_ref) 4301 print('Found commit on %s' % real_ref)
4302 return commit 4302 return commit
4303 4303
4304 current_rev = to_rev 4304 current_rev = to_rev
4305 4305
4306 4306
4307 def PushToGitPending(remote, pending_ref, upstream_ref): 4307 def PushToGitPending(remote, pending_ref):
4308 """Fetches pending_ref, cherry-picks current HEAD on top of it, pushes. 4308 """Fetches pending_ref, cherry-picks current HEAD on top of it, pushes.
4309 4309
4310 Returns: 4310 Returns:
4311 (retcode of last operation, output log of last operation). 4311 (retcode of last operation, output log of last operation).
4312 """ 4312 """
4313 assert pending_ref.startswith('refs/'), pending_ref 4313 assert pending_ref.startswith('refs/'), pending_ref
4314 local_pending_ref = 'refs/git-cl/' + pending_ref[len('refs/'):] 4314 local_pending_ref = 'refs/git-cl/' + pending_ref[len('refs/'):]
4315 cherry = RunGit(['rev-parse', 'HEAD']).strip() 4315 cherry = RunGit(['rev-parse', 'HEAD']).strip()
4316 code = 0 4316 code = 0
4317 out = '' 4317 out = ''
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
5274 if __name__ == '__main__': 5274 if __name__ == '__main__':
5275 # These affect sys.stdout so do it outside of main() to simplify mocks in 5275 # These affect sys.stdout so do it outside of main() to simplify mocks in
5276 # unit testing. 5276 # unit testing.
5277 fix_encoding.fix_encoding() 5277 fix_encoding.fix_encoding()
5278 setup_color.init() 5278 setup_color.init()
5279 try: 5279 try:
5280 sys.exit(main(sys.argv[1:])) 5280 sys.exit(main(sys.argv[1:]))
5281 except KeyboardInterrupt: 5281 except KeyboardInterrupt:
5282 sys.stderr.write('interrupted\n') 5282 sys.stderr.write('interrupted\n')
5283 sys.exit(1) 5283 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698