diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/rebase.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/subcmds/rebase.py b/subcmds/rebase.py index 346eb9cd..dcb8b2a3 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py | |||
| @@ -17,9 +17,18 @@ | |||
| 17 | from __future__ import print_function | 17 | from __future__ import print_function |
| 18 | import sys | 18 | import sys |
| 19 | 19 | ||
| 20 | from color import Coloring | ||
| 20 | from command import Command | 21 | from command import Command |
| 21 | from git_command import GitCommand | 22 | from git_command import GitCommand |
| 22 | 23 | ||
| 24 | |||
| 25 | class RebaseColoring(Coloring): | ||
| 26 | def __init__(self, config): | ||
| 27 | Coloring.__init__(self, config, 'rebase') | ||
| 28 | self.project = self.printer('project', attr='bold') | ||
| 29 | self.fail = self.printer('fail', fg='red') | ||
| 30 | |||
| 31 | |||
| 23 | class Rebase(Command): | 32 | class Rebase(Command): |
| 24 | common = True | 33 | common = True |
| 25 | helpSummary = "Rebase local branches on upstream branch" | 34 | helpSummary = "Rebase local branches on upstream branch" |
| @@ -91,6 +100,10 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 91 | if opt.interactive: | 100 | if opt.interactive: |
| 92 | common_args.append('-i') | 101 | common_args.append('-i') |
| 93 | 102 | ||
| 103 | config = self.manifest.manifestProject.config | ||
| 104 | out = RebaseColoring(config) | ||
| 105 | out.redirect(sys.stdout) | ||
| 106 | |||
| 94 | ret = 0 | 107 | ret = 0 |
| 95 | for project in all_projects: | 108 | for project in all_projects: |
| 96 | if ret and opt.fail_fast: | 109 | if ret and opt.fail_fast: |
| @@ -121,8 +134,10 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 121 | 134 | ||
| 122 | args.append(upbranch.LocalMerge) | 135 | args.append(upbranch.LocalMerge) |
| 123 | 136 | ||
| 124 | print('# %s: rebasing %s -> %s' | 137 | out.project('project %s: rebasing %s -> %s', |
| 125 | % (project.relpath, cb, upbranch.LocalMerge), file=sys.stderr) | 138 | project.relpath, cb, upbranch.LocalMerge) |
| 139 | out.nl() | ||
| 140 | out.flush() | ||
| 126 | 141 | ||
| 127 | needs_stash = False | 142 | needs_stash = False |
| 128 | if opt.auto_stash: | 143 | if opt.auto_stash: |
| @@ -148,5 +163,7 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 148 | ret += 1 | 163 | ret += 1 |
| 149 | 164 | ||
| 150 | if ret: | 165 | if ret: |
| 151 | print('error: %i projects had errors' % (ret,), file=sys.stderr) | 166 | out.fail('%i projects had errors', ret) |
| 167 | out.nl() | ||
| 168 | |||
| 152 | return ret | 169 | return ret |
