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

Side by Side Diff: git_cl.py

Issue 1053103002: Enable help generation for some git-cl subcommands (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 8 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.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 print '\n%s%s %s%s' % ( 1562 print '\n%s%s %s%s' % (
1563 color, message['date'].split('.', 1)[0], message['sender'], 1563 color, message['date'].split('.', 1)[0], message['sender'],
1564 Fore.RESET) 1564 Fore.RESET)
1565 if message['text'].strip(): 1565 if message['text'].strip():
1566 print '\n'.join(' ' + l for l in message['text'].splitlines()) 1566 print '\n'.join(' ' + l for l in message['text'].splitlines())
1567 return 0 1567 return 0
1568 1568
1569 1569
1570 def CMDdescription(parser, args): 1570 def CMDdescription(parser, args):
1571 """Brings up the editor for the current CL's description.""" 1571 """Brings up the editor for the current CL's description."""
1572 parser.parse_args(args)
1572 cl = Changelist() 1573 cl = Changelist()
1573 if not cl.GetIssue(): 1574 if not cl.GetIssue():
1574 DieWithError('This branch has no associated changelist.') 1575 DieWithError('This branch has no associated changelist.')
1575 description = ChangeDescription(cl.GetDescription()) 1576 description = ChangeDescription(cl.GetDescription())
1576 description.prompt() 1577 description.prompt()
1577 cl.UpdateDescription(description.description) 1578 cl.UpdateDescription(description.description)
1578 return 0 1579 return 0
1579 1580
1580 1581
1581 def CreateDescriptionFromLog(args): 1582 def CreateDescriptionFromLog(args):
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 parser.error('Unrecognized args: %s' % ' '.join(args)) 2891 parser.error('Unrecognized args: %s' % ' '.join(args))
2891 cl = Changelist() 2892 cl = Changelist()
2892 # Ensure there actually is an issue to close. 2893 # Ensure there actually is an issue to close.
2893 cl.GetDescription() 2894 cl.GetDescription()
2894 cl.CloseIssue() 2895 cl.CloseIssue()
2895 return 0 2896 return 0
2896 2897
2897 2898
2898 def CMDdiff(parser, args): 2899 def CMDdiff(parser, args):
2899 """shows differences between local tree and last upload.""" 2900 """shows differences between local tree and last upload."""
2901 parser.parse_args(args)
2900 cl = Changelist() 2902 cl = Changelist()
2901 issue = cl.GetIssue() 2903 issue = cl.GetIssue()
2902 branch = cl.GetBranch() 2904 branch = cl.GetBranch()
2903 if not issue: 2905 if not issue:
2904 DieWithError('No issue found for current branch (%s)' % branch) 2906 DieWithError('No issue found for current branch (%s)' % branch)
2905 TMP_BRANCH = 'git-cl-diff' 2907 TMP_BRANCH = 'git-cl-diff'
2906 base_branch = cl.GetCommonAncestorWithUpstream() 2908 base_branch = cl.GetCommonAncestorWithUpstream()
2907 2909
2908 # Create a new branch based on the merge-base 2910 # Create a new branch based on the merge-base
2909 RunGit(['checkout', '-q', '-b', TMP_BRANCH, base_branch]) 2911 RunGit(['checkout', '-q', '-b', TMP_BRANCH, base_branch])
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3134 if __name__ == '__main__': 3136 if __name__ == '__main__':
3135 # These affect sys.stdout so do it outside of main() to simplify mocks in 3137 # These affect sys.stdout so do it outside of main() to simplify mocks in
3136 # unit testing. 3138 # unit testing.
3137 fix_encoding.fix_encoding() 3139 fix_encoding.fix_encoding()
3138 colorama.init() 3140 colorama.init()
3139 try: 3141 try:
3140 sys.exit(main(sys.argv[1:])) 3142 sys.exit(main(sys.argv[1:]))
3141 except KeyboardInterrupt: 3143 except KeyboardInterrupt:
3142 sys.stderr.write('interrupted\n') 3144 sys.stderr.write('interrupted\n')
3143 sys.exit(1) 3145 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