changeset 1997:ce86f7bb4b7b

stack: add some behind information This is the next useful thing after branch
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 26 Aug 2016 14:55:58 +0200
parents 5c40dd2cf131
children 302be26a3fd8
files hgext3rd/topic/__init__.py hgext3rd/topic/stack.py tests/test-topic-stack-data.t
diffstat 3 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Fri Aug 26 14:23:31 2016 +0200
+++ b/hgext3rd/topic/__init__.py	Fri Aug 26 14:55:58 2016 +0200
@@ -58,6 +58,8 @@
               'topic.stack.state.current': 'cyan bold',  # random pick
               'topic.stack.desc.current': 'cyan',        # random pick
               'topic.stack.state.unstable': 'red',
+              'topic.stack.summary.behindcount': 'cyan',
+              'topic.stack.summary.behinderror': 'red',
              }
 
 testedwith = '3.9'
--- a/hgext3rd/topic/stack.py	Fri Aug 26 14:23:31 2016 +0200
+++ b/hgext3rd/topic/stack.py	Fri Aug 26 14:55:58 2016 +0200
@@ -28,9 +28,16 @@
     data = stackdata(repo, topic)
     fm.plain(_('### topic: %s\n') % ui.label(topic, label),
              label='topic.stack.summary.topic')
-    fm.plain(_('### branch: %s\n')
+    fm.plain(_('### branch: %s')
              % '+'.join(data['branches']), # XXX handle multi branches
              label='topic.stack.summary.branches')
+    if data['behindcount'] == -1:
+        fm.plain(', ')
+        fm.plain('ambigious rebase destination', label='topic.stack.summary.behinderror')
+    elif data['behindcount']:
+        fm.plain(', ')
+        fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount')
+    fm.plain('\n')
 
     for idx, r in enumerate(getstack(repo, topic), 1):
         ctx = repo[r]
--- a/tests/test-topic-stack-data.t	Fri Aug 26 14:23:31 2016 +0200
+++ b/tests/test-topic-stack-data.t	Fri Aug 26 14:55:58 2016 +0200
@@ -251,19 +251,19 @@
     ^ add base_e
   $ hg stack baz
   ### topic: baz
-  ### branch: default
+  ### branch: default, 2 behind
   t2: add baz_b
   t1: add baz_a
     ^ add base_c
   $ hg stack foo
   ### topic: foo
-  ### branch: lake
+  ### branch: lake, ambigious rebase destination
   t2@ add foo_b (current)
   t1: add foo_a
     ^ add lake_a
   $ hg stack fuz
   ### topic: fuz
-  ### branch: default
+  ### branch: default, 1 behind
   t3$ add fuz_c (unstable)
   t2$ add fuz_b (unstable)
   t1: fuz1_a