stack: add some header with the topic name
This is the first step of a move to add more data about a stack in the command
output.
--- a/hgext3rd/topic/stack.py Fri Aug 26 14:58:18 2016 +0200
+++ b/hgext3rd/topic/stack.py Fri Aug 26 14:14:04 2016 +0200
@@ -2,6 +2,7 @@
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+from mercurial.i18n import _
from mercurial import (
destutil,
error,
@@ -19,6 +20,14 @@
prev = None
entries = []
idxmap = {}
+
+ label = 'topic'
+ if topic == repo.currenttopic:
+ label = 'topic.active'
+
+ fm.plain(_('### topic: %s\n') % ui.label(topic, label),
+ label='topic.stack.summary.topic')
+
for idx, r in enumerate(getstack(repo, topic), 1):
ctx = repo[r]
p1 = ctx.p1()
--- a/tests/test-topic-stack-data.t Fri Aug 26 14:58:18 2016 +0200
+++ b/tests/test-topic-stack-data.t Fri Aug 26 14:14:04 2016 +0200
@@ -240,6 +240,7 @@
=======================================
$ hg stack bar
+ ### topic: bar
t5: add bar_c
t2^ add bar_b (base)
t4$ add bar_e (unstable)
@@ -248,14 +249,17 @@
t1: add bar_a
^ add base_e
$ hg stack baz
+ ### topic: baz
t2: add baz_b
t1: add baz_a
^ add base_c
$ hg stack foo
+ ### topic: foo
t2@ add foo_b (current)
t1: add foo_a
^ add lake_a
$ hg stack fuz
+ ### topic: fuz
t3$ add fuz_c (unstable)
t2$ add fuz_b (unstable)
t1: fuz1_a
--- a/tests/test-topic-stack.t Fri Aug 26 14:58:18 2016 +0200
+++ b/tests/test-topic-stack.t Fri Aug 26 14:14:04 2016 +0200
@@ -53,6 +53,7 @@
switching to topic other
0 files updated, 0 files merged, 4 files removed, 0 files unresolved
$ hg topic --list
+ ### topic: other
t2@ c_b (current)
t1: c_a
$ hg phase --public 'topic("other")'
@@ -68,6 +69,7 @@
$ hg topic
* foo
$ hg stack
+ ### topic: foo
t4@ c_f (current)
t3: c_e
t2: c_d
@@ -124,6 +126,7 @@
o 0 default {} public c_a
$ hg topic --list
+ ### topic: foo
t4$ c_f (unstable)
t3$ c_e (unstable)
t2@ c_d (current)
@@ -192,6 +195,7 @@
Test output
$ hg top -l
+ ### topic: foo
t6: c_f
t5: c_e
t2^ c_d (base)
@@ -234,6 +238,7 @@
$ hg topic --list
+ ### topic: foo
t6$ c_f (unstable)
t5$ c_e (unstable)
t2^ c_D (base)