summaryrefslogtreecommitdiffstats
path: root/subcmds/rebase.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/rebase.py')
-rw-r--r--subcmds/rebase.py39
1 files changed, 17 insertions, 22 deletions
diff --git a/subcmds/rebase.py b/subcmds/rebase.py
index dcb8b2a3..7c53eb7a 100644
--- a/subcmds/rebase.py
+++ b/subcmds/rebase.py
@@ -1,5 +1,3 @@
1# -*- coding:utf-8 -*-
2#
3# Copyright (C) 2010 The Android Open Source Project 1# Copyright (C) 2010 The Android Open Source Project
4# 2#
5# Licensed under the Apache License, Version 2.0 (the "License"); 3# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +12,6 @@
14# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
15# limitations under the License. 13# limitations under the License.
16 14
17from __future__ import print_function
18import sys 15import sys
19 16
20from color import Coloring 17from color import Coloring
@@ -30,7 +27,7 @@ class RebaseColoring(Coloring):
30 27
31 28
32class Rebase(Command): 29class Rebase(Command):
33 common = True 30 COMMON = True
34 helpSummary = "Rebase local branches on upstream branch" 31 helpSummary = "Rebase local branches on upstream branch"
35 helpUsage = """ 32 helpUsage = """
36%prog {[<project>...] | -i <project>...} 33%prog {[<project>...] | -i <project>...}
@@ -42,36 +39,34 @@ branch but need to incorporate new upstream changes "underneath" them.
42""" 39"""
43 40
44 def _Options(self, p): 41 def _Options(self, p):
45 p.add_option('-i', '--interactive', 42 g = p.get_option_group('--quiet')
46 dest="interactive", action="store_true", 43 g.add_option('-i', '--interactive',
47 help="interactive rebase (single project only)") 44 dest="interactive", action="store_true",
45 help="interactive rebase (single project only)")
48 46
49 p.add_option('--fail-fast', 47 p.add_option('--fail-fast',
50 dest='fail_fast', action='store_true', 48 dest='fail_fast', action='store_true',
51 help='Stop rebasing after first error is hit') 49 help='stop rebasing after first error is hit')
52 p.add_option('-f', '--force-rebase', 50 p.add_option('-f', '--force-rebase',
53 dest='force_rebase', action='store_true', 51 dest='force_rebase', action='store_true',
54 help='Pass --force-rebase to git rebase') 52 help='pass --force-rebase to git rebase')
55 p.add_option('--no-ff', 53 p.add_option('--no-ff',
56 dest='no_ff', action='store_true', 54 dest='ff', default=True, action='store_false',
57 help='Pass --no-ff to git rebase') 55 help='pass --no-ff to git rebase')
58 p.add_option('-q', '--quiet',
59 dest='quiet', action='store_true',
60 help='Pass --quiet to git rebase')
61 p.add_option('--autosquash', 56 p.add_option('--autosquash',
62 dest='autosquash', action='store_true', 57 dest='autosquash', action='store_true',
63 help='Pass --autosquash to git rebase') 58 help='pass --autosquash to git rebase')
64 p.add_option('--whitespace', 59 p.add_option('--whitespace',
65 dest='whitespace', action='store', metavar='WS', 60 dest='whitespace', action='store', metavar='WS',
66 help='Pass --whitespace to git rebase') 61 help='pass --whitespace to git rebase')
67 p.add_option('--auto-stash', 62 p.add_option('--auto-stash',
68 dest='auto_stash', action='store_true', 63 dest='auto_stash', action='store_true',
69 help='Stash local modifications before starting') 64 help='stash local modifications before starting')
70 p.add_option('-m', '--onto-manifest', 65 p.add_option('-m', '--onto-manifest',
71 dest='onto_manifest', action='store_true', 66 dest='onto_manifest', action='store_true',
72 help='Rebase onto the manifest version instead of upstream ' 67 help='rebase onto the manifest version instead of upstream '
73 'HEAD. This helps to make sure the local tree stays ' 68 'HEAD (this helps to make sure the local tree stays '
74 'consistent if you previously synced to a manifest.') 69 'consistent if you previously synced to a manifest)')
75 70
76 def Execute(self, opt, args): 71 def Execute(self, opt, args):
77 all_projects = self.GetProjects(args) 72 all_projects = self.GetProjects(args)
@@ -82,7 +77,7 @@ branch but need to incorporate new upstream changes "underneath" them.
82 file=sys.stderr) 77 file=sys.stderr)
83 if len(args) == 1: 78 if len(args) == 1:
84 print('note: project %s is mapped to more than one path' % (args[0],), 79 print('note: project %s is mapped to more than one path' % (args[0],),
85 file=sys.stderr) 80 file=sys.stderr)
86 return 1 81 return 1
87 82
88 # Setup the common git rebase args that we use for all projects. 83 # Setup the common git rebase args that we use for all projects.
@@ -93,7 +88,7 @@ branch but need to incorporate new upstream changes "underneath" them.
93 common_args.append('--quiet') 88 common_args.append('--quiet')
94 if opt.force_rebase: 89 if opt.force_rebase:
95 common_args.append('--force-rebase') 90 common_args.append('--force-rebase')
96 if opt.no_ff: 91 if not opt.ff:
97 common_args.append('--no-ff') 92 common_args.append('--no-ff')
98 if opt.autosquash: 93 if opt.autosquash:
99 common_args.append('--autosquash') 94 common_args.append('--autosquash')