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

Side by Side Diff: git_cl.py

Issue 12811006: Save the GIT hash of HEAD when uploading to rietveld. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« 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.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 import json 10 import json
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 sys.exit(1) 93 sys.exit(1)
94 94
95 95
96 def git_set_branch_value(key, value): 96 def git_set_branch_value(key, value):
97 branch = Changelist().GetBranch() 97 branch = Changelist().GetBranch()
98 if branch: 98 if branch:
99 git_key = 'branch.%s.%s' % (branch, key) 99 git_key = 'branch.%s.%s' % (branch, key)
100 RunGit(['config', '--int', git_key, "%d" % value]) 100 RunGit(['config', '--int', git_key, "%d" % value])
101 101
102 102
103 def git_set_branch_value_str(key, value):
M-A Ruel 2013/03/14 13:28:27 I prefer one function. cmd = ['config'] if isinst
Roger Tawa OOO till Jul 10th 2013/03/14 19:49:42 Done.
104 branch = Changelist().GetBranch()
105 if branch:
106 git_key = 'branch.%s.%s' % (branch, key)
107 RunGit(['config', git_key, str(value)])
108
109
103 def git_get_branch_default(key, default): 110 def git_get_branch_default(key, default):
104 branch = Changelist().GetBranch() 111 branch = Changelist().GetBranch()
105 if branch: 112 if branch:
106 git_key = 'branch.%s.%s' % (branch, key) 113 git_key = 'branch.%s.%s' % (branch, key)
107 (_, stdout) = RunGitWithCode(['config', '--int', '--get', git_key]) 114 (_, stdout) = RunGitWithCode(['config', '--int', '--get', git_key])
108 try: 115 try:
109 return int(stdout.strip()) 116 return int(stdout.strip())
110 except ValueError: 117 except ValueError:
111 pass 118 pass
112 return default 119 return default
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 verbose=options.verbose, 1288 verbose=options.verbose,
1282 change=change) 1289 change=change)
1283 if not hook_results.should_continue(): 1290 if not hook_results.should_continue():
1284 return 1 1291 return 1
1285 if not options.reviewers and hook_results.reviewers: 1292 if not options.reviewers and hook_results.reviewers:
1286 options.reviewers = hook_results.reviewers 1293 options.reviewers = hook_results.reviewers
1287 1294
1288 print_stats(options.similarity, options.find_copies, args) 1295 print_stats(options.similarity, options.find_copies, args)
1289 if settings.GetIsGerrit(): 1296 if settings.GetIsGerrit():
1290 return GerritUpload(options, args, cl) 1297 return GerritUpload(options, args, cl)
1291 return RietveldUpload(options, args, cl) 1298 ret = RietveldUpload(options, args, cl)
1299 if ret == 0:
M-A Ruel 2013/03/14 13:28:27 if not ret
Roger Tawa OOO till Jul 10th 2013/03/14 19:49:42 Done.
1300 git_set_branch_value_str('last-upload-hash', RunGit(['rev-parse', 'HEAD']))
1301
1302 return ret
1292 1303
1293 1304
1294 def IsSubmoduleMergeCommit(ref): 1305 def IsSubmoduleMergeCommit(ref):
1295 # When submodules are added to the repo, we expect there to be a single 1306 # When submodules are added to the repo, we expect there to be a single
1296 # non-git-svn merge commit at remote HEAD with a signature comment. 1307 # non-git-svn merge commit at remote HEAD with a signature comment.
1297 pattern = '^SVN changes up to revision [0-9]*$' 1308 pattern = '^SVN changes up to revision [0-9]*$'
1298 cmd = ['rev-list', '--merges', '--grep=%s' % pattern, '%s^!' % ref] 1309 cmd = ['rev-list', '--merges', '--grep=%s' % pattern, '%s^!' % ref]
1299 return RunGit(cmd) != '' 1310 return RunGit(cmd) != ''
1300 1311
1301 1312
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1894 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1884 1895
1885 # Not a known command. Default to help. 1896 # Not a known command. Default to help.
1886 GenUsage(parser, 'help') 1897 GenUsage(parser, 'help')
1887 return CMDhelp(parser, argv) 1898 return CMDhelp(parser, argv)
1888 1899
1889 1900
1890 if __name__ == '__main__': 1901 if __name__ == '__main__':
1891 fix_encoding.fix_encoding() 1902 fix_encoding.fix_encoding()
1892 sys.exit(main(sys.argv[1:])) 1903 sys.exit(main(sys.argv[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