changeset 1996:5c40dd2cf131

stack: add some basic branch information In the same spirit as knowing the topic you are on, having some branch data seem useful (yet, this smell a bit like summary)
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 26 Aug 2016 14:23:31 +0200
parents 54d6dff699f0
children ce86f7bb4b7b
files hgext3rd/topic/stack.py tests/test-topic-stack-data.t tests/test-topic-stack.t
diffstat 3 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Fri Aug 26 14:14:04 2016 +0200
+++ b/hgext3rd/topic/stack.py	Fri Aug 26 14:23:31 2016 +0200
@@ -25,8 +25,12 @@
     if topic == repo.currenttopic:
         label = 'topic.active'
 
+    data = stackdata(repo, topic)
     fm.plain(_('### topic: %s\n') % ui.label(topic, label),
              label='topic.stack.summary.topic')
+    fm.plain(_('### branch: %s\n')
+             % '+'.join(data['branches']), # XXX handle multi branches
+             label='topic.stack.summary.branches')
 
     for idx, r in enumerate(getstack(repo, topic), 1):
         ctx = repo[r]
--- a/tests/test-topic-stack-data.t	Fri Aug 26 14:14:04 2016 +0200
+++ b/tests/test-topic-stack-data.t	Fri Aug 26 14:23:31 2016 +0200
@@ -241,6 +241,7 @@
 
   $ hg stack bar
   ### topic: bar
+  ### branch: default
   t5: add bar_c
   t2^ add bar_b (base)
   t4$ add bar_e (unstable)
@@ -250,16 +251,19 @@
     ^ add base_e
   $ hg stack baz
   ### topic: baz
+  ### branch: default
   t2: add baz_b
   t1: add baz_a
     ^ add base_c
   $ hg stack foo
   ### topic: foo
+  ### branch: lake
   t2@ add foo_b (current)
   t1: add foo_a
     ^ add lake_a
   $ hg stack fuz
   ### topic: fuz
+  ### branch: default
   t3$ add fuz_c (unstable)
   t2$ add fuz_b (unstable)
   t1: fuz1_a
--- a/tests/test-topic-stack.t	Fri Aug 26 14:14:04 2016 +0200
+++ b/tests/test-topic-stack.t	Fri Aug 26 14:23:31 2016 +0200
@@ -54,6 +54,7 @@
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   $ hg topic --list
   ### topic: other
+  ### branch: default
   t2@ c_b (current)
   t1: c_a
   $ hg phase --public 'topic("other")'
@@ -70,6 +71,7 @@
    * foo
   $ hg stack
   ### topic: foo
+  ### branch: default
   t4@ c_f (current)
   t3: c_e
   t2: c_d
@@ -127,6 +129,7 @@
   
   $ hg topic --list
   ### topic: foo
+  ### branch: default
   t4$ c_f (unstable)
   t3$ c_e (unstable)
   t2@ c_d (current)
@@ -196,6 +199,7 @@
 
   $ hg top -l
   ### topic: foo
+  ### branch: default
   t6: c_f
   t5: c_e
   t2^ c_d (base)
@@ -239,6 +243,7 @@
 
   $ hg topic --list
   ### topic: foo
+  ### branch: default
   t6$ c_f (unstable)
   t5$ c_e (unstable)
   t2^ c_D (base)