changeset 19215:f184fe1e2ac5

summary: add a histedit hook
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 14 May 2013 11:23:18 -0700
parents 0250047a365e
children 0ec31231afad
files hgext/color.py hgext/histedit.py tests/test-histedit-edit.t
diffstat 3 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Tue May 14 11:23:17 2013 -0700
+++ b/hgext/color.py	Tue May 14 11:23:18 2013 -0700
@@ -63,6 +63,8 @@
   rebase.rebased = blue
   rebase.remaining = red bold
 
+  histedit.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
@@ -251,6 +253,7 @@
            'diff.trailingwhitespace': 'bold red_background',
            'diffstat.deleted': 'red',
            'diffstat.inserted': 'green',
+           'histedit.remaining': 'red bold',
            'ui.prompt': 'yellow',
            'log.changeset': 'yellow',
            'rebase.rebased': 'blue',
--- a/hgext/histedit.py	Tue May 14 11:23:17 2013 -0700
+++ b/hgext/histedit.py	Tue May 14 11:23:18 2013 -0700
@@ -856,3 +856,16 @@
             repair.strip(ui, repo, c)
     finally:
         lockmod.release(lock)
+
+def summaryhook(ui, repo):
+    if not os.path.exists(repo.join('histedit-state')):
+        return
+    (parentctxnode, rules, keep, topmost, replacements) = readstate(repo)
+    if rules:
+        # i18n: column positioning for "hg summary"
+        ui.write(_('hist:   %s (histedit --continue)\n') %
+                 (ui.label(_('%d remaining'), 'histedit.remaining') %
+                  len(rules)))
+
+def extsetup(ui):
+    cmdutil.summaryhooks.add('histedit', summaryhook)
--- a/tests/test-histedit-edit.t	Tue May 14 11:23:17 2013 -0700
+++ b/tests/test-histedit-edit.t	Tue May 14 11:23:18 2013 -0700
@@ -159,6 +159,7 @@
   branch: default
   commit: 1 added (new branch head)
   update: 1 new changesets (update)
+  hist:   1 remaining (histedit --continue)
 
   $ HGEDITOR='true' hg histedit --continue
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved