# HG changeset patch # User Bryan O'Sullivan # Date 1368555797 25200 # Node ID 0250047a365e7419026dca811cd3a8f1aafd56ad # Parent f324a9b8d4bf04f6c2945110974b35d1627555ec summary: indicate if a rebase is underway diff -r f324a9b8d4bf -r 0250047a365e hgext/color.py --- a/hgext/color.py Tue May 14 11:23:17 2013 -0700 +++ b/hgext/color.py Tue May 14 11:23:17 2013 -0700 @@ -60,6 +60,9 @@ tags.normal = green tags.local = black bold + rebase.rebased = blue + rebase.remaining = red bold + The available effects in terminfo mode are 'blink', 'bold', 'dim', 'inverse', 'invisible', 'italic', 'standout', and 'underline'; in ECMA-48 mode, the options are 'bold', 'inverse', 'italic', and @@ -250,6 +253,8 @@ 'diffstat.inserted': 'green', 'ui.prompt': 'yellow', 'log.changeset': 'yellow', + 'rebase.rebased': 'blue', + 'rebase.remaining': 'red bold', 'resolve.resolved': 'green bold', 'resolve.unresolved': 'red bold', 'status.added': 'green bold', diff -r f324a9b8d4bf -r 0250047a365e hgext/rebase.py --- a/hgext/rebase.py Tue May 14 11:23:17 2013 -0700 +++ b/hgext/rebase.py Tue May 14 11:23:17 2013 -0700 @@ -779,6 +779,17 @@ raise util.Abort(_('--tool can only be used with --rebase')) orig(ui, repo, *args, **opts) +def summaryhook(ui, repo): + if not os.path.exists(repo.join('rebasestate')): + return + state = restorestatus(repo)[2] + numrebased = len([i for i in state.itervalues() if i != -1]) + # i18n: column positioning for "hg summary" + ui.write(_('rebase: %s, %s (rebase --continue)\n') % + (ui.label(_('%d rebased'), 'rebase.rebased') % numrebased, + ui.label(_('%d remaining'), 'rebase.remaining') % + (len(state) - numrebased))) + def uisetup(ui): 'Replace pull with a decorator to provide --rebase option' entry = extensions.wrapcommand(commands.table, 'pull', pullrebase) @@ -786,3 +797,4 @@ _("rebase working directory to branch head"))) entry[1].append(('t', 'tool', '', _("specify merge tool for rebase"))) + cmdutil.summaryhooks.add('rebase', summaryhook) diff -r f324a9b8d4bf -r 0250047a365e tests/test-rebase-parameters.t --- a/tests/test-rebase-parameters.t Tue May 14 11:23:17 2013 -0700 +++ b/tests/test-rebase-parameters.t Tue May 14 11:23:17 2013 -0700 @@ -427,6 +427,7 @@ branch: default commit: 1 modified, 1 unresolved (merge) update: (current) + rebase: 0 rebased, 1 remaining (rebase --continue) $ hg resolve -l U c2