summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2019-09-23 19:14:13 -0400
committerMike Frysinger <vapier@google.com>2019-09-24 04:17:03 +0000
commite37aa5f331aa39776d5db1a1f816b66496f60e0c (patch)
treeb88a24ae29266940890978bd31a629b15a279d18 /subcmds
parent4a07798c826efd3c85b72acaf51932edc628220d (diff)
downloadgit-repo-e37aa5f331aa39776d5db1a1f816b66496f60e0c.tar.gz
rebase: add basic coloring output
This uses coloring style like we use in grep/forall already. Change-Id: I317e2e47567a30c513083c48e7c7c40b091bb29a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/238555 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/rebase.py23
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 @@
17from __future__ import print_function 17from __future__ import print_function
18import sys 18import sys
19 19
20from color import Coloring
20from command import Command 21from command import Command
21from git_command import GitCommand 22from git_command import GitCommand
22 23
24
25class 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
23class Rebase(Command): 32class 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