summary: add a histedit hook
authorBryan O'Sullivan <bryano@fb.com>
Tue, 14 May 2013 11:23:18 -0700
changeset 19215 f184fe1e2ac5
parent 19214 0250047a365e
child 19216 0ec31231afad
summary: add a histedit hook
hgext/color.py
hgext/histedit.py
tests/test-histedit-edit.t
--- 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