# HG changeset patch # User Pierre-Yves David # Date 1472241468 -7200 # Node ID 302be26a3fd8bcafa6609b3246cc4f3432a660e1 # Parent ce86f7bb4b7bdb47099273fca66812929ad0f9e0 stack: add warning about multiple heads This seems a good spot to nudge people toward reducing there head count. diff -r ce86f7bb4b7b -r 302be26a3fd8 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Fri Aug 26 14:55:58 2016 +0200 +++ b/hgext3rd/topic/__init__.py Fri Aug 26 21:57:48 2016 +0200 @@ -60,6 +60,7 @@ 'topic.stack.state.unstable': 'red', 'topic.stack.summary.behindcount': 'cyan', 'topic.stack.summary.behinderror': 'red', + 'topic.stack.summary.headcount.multiple': 'yellow', } testedwith = '3.9' diff -r ce86f7bb4b7b -r 302be26a3fd8 hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Fri Aug 26 14:55:58 2016 +0200 +++ b/hgext3rd/topic/stack.py Fri Aug 26 21:57:48 2016 +0200 @@ -26,8 +26,15 @@ label = 'topic.active' data = stackdata(repo, topic) - fm.plain(_('### topic: %s\n') % ui.label(topic, label), + 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') fm.plain(_('### branch: %s') % '+'.join(data['branches']), # XXX handle multi branches label='topic.stack.summary.branches') diff -r ce86f7bb4b7b -r 302be26a3fd8 tests/test-topic-stack-data.t --- a/tests/test-topic-stack-data.t Fri Aug 26 14:55:58 2016 +0200 +++ b/tests/test-topic-stack-data.t Fri Aug 26 21:57:48 2016 +0200 @@ -240,7 +240,7 @@ ======================================= $ hg stack bar - ### topic: bar + ### topic: bar (2 heads) ### branch: default t5: add bar_c t2^ add bar_b (base) diff -r ce86f7bb4b7b -r 302be26a3fd8 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Fri Aug 26 14:55:58 2016 +0200 +++ b/tests/test-topic-stack.t Fri Aug 26 21:57:48 2016 +0200 @@ -198,7 +198,7 @@ Test output $ hg top -l - ### topic: foo + ### topic: foo (2 heads) ### branch: default t6: c_f t5: c_e @@ -242,7 +242,7 @@ $ hg topic --list - ### topic: foo + ### topic: foo (2 heads) ### branch: default t6$ c_f (unstable) t5$ c_e (unstable)