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

Side by Side Diff: git_new_branch.py

Issue 1875063002: Clarify how `new-branch` is different for --help (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Stick to one line description Created 4 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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """
7 Create new branch tracking origin/master by default.
8 """
9
6 import argparse 10 import argparse
7 import sys 11 import sys
8 12
9 import subprocess2 13 import subprocess2
10 14
11 from git_common import run, root, set_config, get_or_create_merge_base, tags 15 from git_common import run, root, set_config, get_or_create_merge_base, tags
12 from git_common import hash_one 16 from git_common import hash_one
13 17
14 18
15 def main(args): 19 def main(args):
16 parser = argparse.ArgumentParser( 20 parser = argparse.ArgumentParser(
17 formatter_class=argparse.ArgumentDefaultsHelpFormatter 21 formatter_class=argparse.ArgumentDefaultsHelpFormatter,
22 description=__doc__,
18 ) 23 )
19 parser.add_argument('branch_name') 24 parser.add_argument('branch_name')
20 g = parser.add_mutually_exclusive_group() 25 g = parser.add_mutually_exclusive_group()
21 g.add_argument('--upstream-current', '--upstream_current', 26 g.add_argument('--upstream-current', '--upstream_current',
22 action='store_true', 27 action='store_true',
23 help='set upstream branch to current branch.') 28 help='set upstream branch to current branch.')
24 g.add_argument('--upstream', metavar='REF', default=root(), 29 g.add_argument('--upstream', metavar='REF', default=root(),
25 help='upstream branch (or tag) to track.') 30 help='upstream branch (or tag) to track.')
26 g.add_argument('--lkgr', action='store_const', const='lkgr', dest='upstream', 31 g.add_argument('--lkgr', action='store_const', const='lkgr', dest='upstream',
27 help='set basis ref for new branch to lkgr.') 32 help='set basis ref for new branch to lkgr.')
(...skipping 22 matching lines...) Expand all
50 sys.stderr.write('Switched to branch %s.\n' % opts.branch_name) 55 sys.stderr.write('Switched to branch %s.\n' % opts.branch_name)
51 return 0 56 return 0
52 57
53 58
54 if __name__ == '__main__': # pragma: no cover 59 if __name__ == '__main__': # pragma: no cover
55 try: 60 try:
56 sys.exit(main(sys.argv[1:])) 61 sys.exit(main(sys.argv[1:]))
57 except KeyboardInterrupt: 62 except KeyboardInterrupt:
58 sys.stderr.write('interrupted\n') 63 sys.stderr.write('interrupted\n')
59 sys.exit(1) 64 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