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

Side by Side Diff: git_cl.py

Issue 526523002: Use full hash in Committed link when closing issue via git-cl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 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 | 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 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 if cmd == 'dcommit' and 'Committed r' in output: 2047 if cmd == 'dcommit' and 'Committed r' in output:
2048 revision = re.match( 2048 revision = re.match(
2049 '.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) 2049 '.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1)
2050 elif cmd == 'land': 2050 elif cmd == 'land':
2051 match = (re.match(r'.*?([a-f0-9]{7,})\.\.([a-f0-9]{7,})$', l) 2051 match = (re.match(r'.*?([a-f0-9]{7,})\.\.([a-f0-9]{7,})$', l)
2052 for l in output.splitlines(False)) 2052 for l in output.splitlines(False))
2053 match = filter(None, match) 2053 match = filter(None, match)
2054 if len(match) != 1: 2054 if len(match) != 1:
2055 DieWithError( 2055 DieWithError(
2056 "Couldn't parse ouput to extract the committed hash:\n%s" % output) 2056 "Couldn't parse ouput to extract the committed hash:\n%s" % output)
2057 revision = match[0].group(2) 2057 revision = match[0].group(2)
agable 2014/08/29 22:20:36 Why keep this old parsing logic around at all and
2058 revision = RunGit(['rev-parse', revision]).strip()
2058 else: 2059 else:
2059 return 1 2060 return 1
2060 2061
2061 revision = revision[:7]
2062
2063 to_pending = ' to pending queue' if pushed_to_pending else '' 2062 to_pending = ' to pending queue' if pushed_to_pending else ''
2064 viewvc_url = settings.GetViewVCUrl() 2063 viewvc_url = settings.GetViewVCUrl()
2065 if not to_pending: 2064 if not to_pending:
2066 if viewvc_url and revision: 2065 if viewvc_url and revision:
2067 change_desc.append_footer( 2066 change_desc.append_footer(
2068 'Committed: %s%s' % (viewvc_url, revision)) 2067 'Committed: %s%s' % (viewvc_url, revision))
2069 elif revision: 2068 elif revision:
2070 change_desc.append_footer('Committed: %s' % (revision,)) 2069 change_desc.append_footer('Committed: %s' % (revision,))
2071 print ('Closing issue ' 2070 print ('Closing issue '
2072 '(you may be prompted for your codereview password)...') 2071 '(you may be prompted for your codereview password)...')
2073 cl.UpdateDescription(change_desc.description) 2072 cl.UpdateDescription(change_desc.description)
2074 cl.CloseIssue() 2073 cl.CloseIssue()
2075 props = cl.GetIssueProperties() 2074 props = cl.GetIssueProperties()
2076 patch_num = len(props['patchsets']) 2075 patch_num = len(props['patchsets'])
2077 comment = "Committed patchset #%d (id:%d)%s manually as %s" % ( 2076 comment = "Committed patchset #%d (id:%d)%s manually as %s" % (
2078 patch_num, props['patchsets'][-1], to_pending, revision) 2077 patch_num, props['patchsets'][-1], to_pending, revision[:7])
2079 if options.bypass_hooks: 2078 if options.bypass_hooks:
2080 comment += ' (tree was closed).' if GetTreeStatus() == 'closed' else '.' 2079 comment += ' (tree was closed).' if GetTreeStatus() == 'closed' else '.'
2081 else: 2080 else:
2082 comment += ' (presubmit successful).' 2081 comment += ' (presubmit successful).'
2083 cl.RpcServer().add_comment(cl.GetIssue(), comment) 2082 cl.RpcServer().add_comment(cl.GetIssue(), comment)
2084 cl.SetIssue(None) 2083 cl.SetIssue(None)
2085 2084
2086 if pushed_to_pending: 2085 if pushed_to_pending:
2087 _, branch = cl.FetchUpstreamTuple(cl.GetBranch()) 2086 _, branch = cl.FetchUpstreamTuple(cl.GetBranch())
2088 print 'The commit is in the pending queue (%s).' % pending_ref 2087 print 'The commit is in the pending queue (%s).' % pending_ref
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
2810 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2809 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2811 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2810 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2812 2811
2813 2812
2814 if __name__ == '__main__': 2813 if __name__ == '__main__':
2815 # These affect sys.stdout so do it outside of main() to simplify mocks in 2814 # These affect sys.stdout so do it outside of main() to simplify mocks in
2816 # unit testing. 2815 # unit testing.
2817 fix_encoding.fix_encoding() 2816 fix_encoding.fix_encoding()
2818 colorama.init() 2817 colorama.init()
2819 sys.exit(main(sys.argv[1:])) 2818 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