topic: list the branches this topic belong to when verbose
Using the verbose listing a bit more, this seems to be useful information.
--- a/hgext3rd/topic/__init__.py Tue Aug 16 15:43:06 2016 +0200
+++ b/hgext3rd/topic/__init__.py Tue Aug 23 23:38:28 2016 +0200
@@ -301,6 +301,10 @@
# XXX we should include the data even when not verbose
data = stack.stackdata(repo, topic)
fm.plain(' (')
+ fm.write('branches+', 'on branch: %s',
+ '+'.join(data['branches']), # XXX use list directly after 4.0 is released
+ label='topic.list.branches')
+ fm.plain(', ')
fm.write('changesetcount', '%d changesets', data['changesetcount'],
label='topic.list.changesetcount')
if data['troubledcount']:
--- a/hgext3rd/topic/stack.py Tue Aug 16 15:43:06 2016 +0200
+++ b/hgext3rd/topic/stack.py Tue Aug 23 23:38:28 2016 +0200
@@ -91,6 +91,7 @@
data['behindcount'] = 0
except error.ManyMergeDestAbort:
data['behindcount'] = -1
+ data['branches'] = sorted(set(repo[r].branch() for r in revs))
return data
--- a/tests/test-topic-list.t Tue Aug 16 15:43:06 2016 +0200
+++ b/tests/test-topic-list.t Tue Aug 23 23:38:28 2016 +0200
@@ -173,10 +173,10 @@
verbose
$ hg topic --verbose
- bar (5 changesets, 1 troubled, 2 heads)
- baz (2 changesets, 2 behind)
- * foo (2 changesets, ambiguous destination)
- fuz (3 changesets, 2 troubled, 1 behind)
+ bar (on branch: default, 5 changesets, 1 troubled, 2 heads)
+ baz (on branch: default, 2 changesets, 2 behind)
+ * foo (on branch: lake, 2 changesets, ambiguous destination)
+ fuz (on branch: default, 3 changesets, 2 troubled, 1 behind)
json
@@ -206,6 +206,7 @@
[
{
"active": false,
+ "branches+": "default",
"changesetcount": 5,
"headcount": 2,
"topic": "bar",
@@ -214,18 +215,21 @@
{
"active": false,
"behindcount": 2,
+ "branches+": "default",
"changesetcount": 2,
"topic": "baz"
},
{
"active": true,
"behinderror": "ambiguous destination",
+ "branches+": "lake",
"changesetcount": 2,
"topic": "foo"
},
{
"active": false,
"behindcount": 1,
+ "branches+": "default",
"changesetcount": 3,
"topic": "fuz",
"troubledcount": 2