diff options
Diffstat (limited to 'subcmds')
-rw-r--r-- | subcmds/rebase.py | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/subcmds/rebase.py b/subcmds/rebase.py index 44cdd2eb..7c8e9389 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py | |||
@@ -37,6 +37,22 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
37 | dest="interactive", action="store_true", | 37 | dest="interactive", action="store_true", |
38 | help="interactive rebase (single project only)") | 38 | help="interactive rebase (single project only)") |
39 | 39 | ||
40 | p.add_option('-f', '--force-rebase', | ||
41 | dest='force_rebase', action='store_true', | ||
42 | help='Pass --force-rebase to git rebase') | ||
43 | p.add_option('--no-ff', | ||
44 | dest='no_ff', action='store_true', | ||
45 | help='Pass --no-ff to git rebase') | ||
46 | p.add_option('-q', '--quiet', | ||
47 | dest='quiet', action='store_true', | ||
48 | help='Pass --quiet to git rebase') | ||
49 | p.add_option('--autosquash', | ||
50 | dest='autosquash', action='store_true', | ||
51 | help='Pass --autosquash to git rebase') | ||
52 | p.add_option('--whitespace', | ||
53 | dest='whitespace', action='store', metavar='WS', | ||
54 | help='Pass --whitespace to git rebase') | ||
55 | |||
40 | def Execute(self, opt, args): | 56 | def Execute(self, opt, args): |
41 | all = self.GetProjects(args) | 57 | all = self.GetProjects(args) |
42 | one_project = len(all) == 1 | 58 | one_project = len(all) == 1 |
@@ -49,7 +65,7 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
49 | cb = project.CurrentBranch | 65 | cb = project.CurrentBranch |
50 | if not cb: | 66 | if not cb: |
51 | if one_project: | 67 | if one_project: |
52 | print >>sys.stderr, "error: project %s has a detatched HEAD" % project.name | 68 | print >>sys.stderr, "error: project %s has a detatched HEAD" % project.relpath |
53 | return -1 | 69 | return -1 |
54 | # ignore branches with detatched HEADs | 70 | # ignore branches with detatched HEADs |
55 | continue | 71 | continue |
@@ -57,19 +73,35 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
57 | upbranch = project.GetBranch(cb) | 73 | upbranch = project.GetBranch(cb) |
58 | if not upbranch.LocalMerge: | 74 | if not upbranch.LocalMerge: |
59 | if one_project: | 75 | if one_project: |
60 | print >>sys.stderr, "error: project %s does not track any remote branches" % project.name | 76 | print >>sys.stderr, "error: project %s does not track any remote branches" % project.relpath |
61 | return -1 | 77 | return -1 |
62 | # ignore branches without remotes | 78 | # ignore branches without remotes |
63 | continue | 79 | continue |
64 | 80 | ||
65 | upstream = project.GetRevisionId() | ||
66 | |||
67 | args = ["rebase"] | 81 | args = ["rebase"] |
82 | |||
83 | if opt.whitespace: | ||
84 | args.append('--whitespace=%s' % opt.whitespace) | ||
85 | |||
86 | if opt.quiet: | ||
87 | args.append('--quiet') | ||
88 | |||
89 | if opt.force_rebase: | ||
90 | args.append('--force-rebase') | ||
91 | |||
92 | if opt.no_ff: | ||
93 | args.append('--no-ff') | ||
94 | |||
95 | if opt.autosquash: | ||
96 | args.append('--autosquash') | ||
97 | |||
68 | if opt.interactive: | 98 | if opt.interactive: |
69 | args.append("-i") | 99 | args.append("-i") |
70 | args.append(upstream) | ||
71 | 100 | ||
72 | print '# project %s: rebasing branch %s -> %s (%s)' % ( | 101 | args.append(upbranch.LocalMerge) |
73 | project.relpath, cb, upbranch.LocalMerge, upstream[0:7]) | 102 | |
103 | print >>sys.stderr, '# %s: rebasing %s -> %s' % \ | ||
104 | (project.relpath, cb, upbranch.LocalMerge) | ||
105 | |||
74 | if GitCommand(project, args).Wait() != 0: | 106 | if GitCommand(project, args).Wait() != 0: |
75 | return -1 | 107 | return -1 |