# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1505497385 -19800 # Node ID b54abc7e80e290c644045e55a99e4abb18f8aa7d # Parent 3a9303b7b6480dd24be8c3f7f8857a3ad0b0d6a4 topics: improve the description if topic is not touched Instead of an empty stack in `hg stack` when topic does not contain any changeset, we show `not yet touched`. diff -r 3a9303b7b648 -r b54abc7e80e2 hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Fri Sep 15 22:48:55 2017 +0530 +++ b/hgext3rd/topic/stack.py Fri Sep 15 23:13:05 2017 +0530 @@ -207,6 +207,9 @@ label = 'topic.active' data = stackdata(repo, branch=branch, topic=topic) + empty = False + if data['changesetcount'] == 0: + empty = True if topic is not None: fm.plain(_('### topic: %s') % ui.label(topic, label), @@ -236,6 +239,9 @@ fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount') fm.plain('\n') + if empty: + fm.plain(_("(stack is empty)\n")) + for idx, r in enumerate(stack(repo, branch=branch, topic=topic), 0): ctx = repo[r] # special case for t0, b0 as it's hard to plugin into rest of the logic diff -r 3a9303b7b648 -r b54abc7e80e2 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Fri Sep 15 22:48:55 2017 +0530 +++ b/tests/test-topic-stack.t Fri Sep 15 23:13:05 2017 +0530 @@ -67,6 +67,7 @@ $ hg stack ### topic: other ### branch: default + (stack is empty) $ hg up foo switching to topic foo @@ -225,6 +226,7 @@ $ hg topic --clear $ hg stack ### branch: default + (stack is empty) Test "t#" reference ------------------- diff -r 3a9303b7b648 -r b54abc7e80e2 tests/test-topic.t --- a/tests/test-topic.t Fri Sep 15 22:48:55 2017 +0530 +++ b/tests/test-topic.t Fri Sep 15 23:13:05 2017 +0530 @@ -143,6 +143,7 @@ $ hg stack ### topic: narf ### branch: default + (stack is empty) Add commits to topic