topic: move the heads data to the branch line when appropriates
The topic line is dropped as it is quite confusing.
--- a/hgext3rd/topic/stack.py Wed Jun 28 02:45:57 2017 +0200
+++ b/hgext3rd/topic/stack.py Wed Jun 28 01:53:21 2017 +0200
@@ -55,24 +55,33 @@
label = 'topic.active'
data = stackdata(repo, branch=branch, topic=topic)
- fm.plain(_('### topic: %s') % ui.label(topic, label),
- label='topic.stack.summary.topic')
+ if topic is not None:
+ fm.plain(_('### topic: %s')
+ % ui.label(topic, label),
+ label='topic.stack.summary.topic')
- if 1 < data['headcount']:
- fm.plain(' (')
- fm.plain('%d heads' % data['headcount'],
- label='topic.stack.summary.headcount.multiple')
- fm.plain(')')
- fm.plain('\n')
+ if 1 < data['headcount']:
+ fm.plain(' (')
+ fm.plain('%d heads' % data['headcount'],
+ label='topic.stack.summary.headcount.multiple')
+ fm.plain(')')
+ fm.plain('\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')
+ if topic is None:
+ if 1 < data['headcount']:
+ fm.plain(' (')
+ fm.plain('%d heads' % data['headcount'],
+ label='topic.stack.summary.headcount.multiple')
+ fm.plain(')')
+ else:
+ 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, branch=branch, topic=topic), 1):
--- a/tests/test-stack-branch.t Wed Jun 28 02:45:57 2017 +0200
+++ b/tests/test-stack-branch.t Wed Jun 28 01:53:21 2017 +0200
@@ -55,7 +55,6 @@
$ hg up other
0 files updated, 0 files merged, 4 files removed, 0 files unresolved
$ hg stack
- ### topic: None
### branch: other
b2@ c_b (current)
b1: c_a
@@ -71,7 +70,6 @@
$ hg branch
foo
$ hg stack
- ### topic: None
### branch: foo
b4@ c_f (current)
b3: c_e
@@ -120,7 +118,6 @@
o 0 other {} public c_a
$ hg stack
- ### topic: None
### branch: foo
b4$ c_f (unstable)
b3$ c_e (unstable)
@@ -130,7 +127,6 @@
$ hg up b3
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg stack
- ### topic: None
### branch: foo
b4$ c_f (unstable)
b3$ c_e (current unstable)
@@ -200,8 +196,7 @@
Test output
$ hg stack
- ### topic: None (2 heads)
- ### branch: foo
+ ### branch: foo (2 heads)
b6: c_f
b5: c_e
b2^ c_d (base)
@@ -244,8 +239,7 @@
$ hg stack
- ### topic: None (2 heads)
- ### branch: foo
+ ### branch: foo (2 heads)
b6$ c_f (unstable)
b5$ c_e (unstable)
b2^ c_D (base)
--- a/tests/test-topic-stack.t Wed Jun 28 02:45:57 2017 +0200
+++ b/tests/test-topic-stack.t Wed Jun 28 01:53:21 2017 +0200
@@ -129,7 +129,6 @@
$ hg topic --clear
$ hg stack
- ### topic: None
### branch: default
b6@ c_f (current)
b5: c_e