topic: display a hint pointing at help when a topic becomes non-empty
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 23 May 2018 11:37:37 +0200
changeset 3769 1bc4b0807c37
parent 3768 482195001997
child 3770 eb928f5728c4
topic: display a hint pointing at help when a topic becomes non-empty This is an attempt at avoiding "mistakes" by new users of topics when they pull a topic and publish its changesets while being checked out. In this case, the topic will become empty but still be active; however, if this is a "foreign" topic, the user will not likely want to keep it active for the next commit operation. So we add a hint message pointing at general help of "topics" command so that they can eventually do something and learn about "hg topics --clear".
hgext3rd/topic/__init__.py
tests/test-evolve-topic.t
tests/test-minitopic.t
tests/test-split.t
tests/test-topic-change.t
tests/test-topic-dest.t
tests/test-topic-flow-publish-bare.t
tests/test-topic-flow-publish-flag.t
tests/test-topic-flow-single-head.t
tests/test-topic-fold.t
tests/test-topic-mode.t
tests/test-topic-push-concurrent-on.t
tests/test-topic-push.t
tests/test-topic-rebase.t
tests/test-topic-shelve.t
tests/test-topic-stack-data.t
tests/test-topic-stack.t
tests/test-topic-tutorial.t
tests/test-topic.t
--- a/hgext3rd/topic/__init__.py	Thu May 24 18:57:46 2018 +0200
+++ b/hgext3rd/topic/__init__.py	Wed May 23 11:37:37 2018 +0200
@@ -487,13 +487,14 @@
                 empty = csetcount == 0
                 if empty and not ctwasempty:
                     ui.status('active topic %r is now empty\n' % ct)
+                hint = _("(see 'hg help topics' for more information)\n")
                 if ctwasempty and not empty:
                     if csetcount == 1:
-                        msg = _('active topic %r grew its first changeset\n')
-                        ui.status(msg % ct)
+                        msg = _('active topic %r grew its first changeset\n%s')
+                        ui.status(msg % (ct, hint))
                     else:
-                        msg = _('active topic %r grew its %s first changesets\n')
-                        ui.status(msg % (ct, csetcount))
+                        msg = _('active topic %r grew its %s first changesets\n%s')
+                        ui.status(msg % (ct, csetcount, hint))
 
             tr.addpostclose('signalcurrenttopicempty', currenttopicempty)
             return tr
--- a/tests/test-evolve-topic.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-evolve-topic.t	Wed May 23 11:37:37 2018 +0200
@@ -34,12 +34,14 @@
   marked working directory as topic: foo
   $ mkcommit ccc
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit ddd
   $ mkcommit eee
   $ mkcommit fff
   $ hg topic bar
   $ mkcommit ggg
   active topic 'bar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit hhh
   $ mkcommit iii
   $ mkcommit jjj
--- a/tests/test-minitopic.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-minitopic.t	Wed May 23 11:37:37 2018 +0200
@@ -147,6 +147,7 @@
   marked working directory as topic: topic_A
   $ mkcommit c_E0
   active topic 'topic_A' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push disabled
   pushing to http://localhost:$HGPORT2/
   searching for changes
--- a/tests/test-split.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-split.t	Wed May 23 11:37:37 2018 +0200
@@ -412,6 +412,7 @@
   $ hg add babar celeste
   $ hg commit -m "Works on mytopic" babar celeste --user victor
   active topic 'mytopic' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -r . 
   changeset:   18:26f72cfaf036
   branch:      new-branch
--- a/tests/test-topic-change.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-change.t	Wed May 23 11:37:37 2018 +0200
@@ -138,6 +138,7 @@
   $ hg topic foobar
   $ hg topic -r . --current
   active topic 'foobar' grew its first changeset
+  (see 'hg help topics' for more information)
   changed topic on 1 changes
   $ hg glog -r .
   @  20:c2d6b7df5dcf {foobar}
@@ -223,6 +224,7 @@
   $ hg topic wat
   $ hg ci --amend
   active topic 'wat' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg glog -r .
   @  28:61470c956807 {wat}
   |  Added h  ()
@@ -243,6 +245,7 @@
   marked working directory as topic: watwat
   $ hg ci --amend
   active topic 'watwat' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg glog -r .
   @  30:a24c31c35013 {watwat}
   |  Added h  ()
--- a/tests/test-topic-dest.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-dest.t	Wed May 23 11:37:37 2018 +0200
@@ -29,6 +29,7 @@
   $ hg add jungle
   $ hg ci -t elephant -m babar
   active topic 'elephant' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg log -G
   @  4 (elephant) babar
@@ -55,6 +56,7 @@
   $ hg add jungle
   $ hg ci -t monkey -m zephir
   active topic 'monkey' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G
   @  5 (monkey) zephir
   |
--- a/tests/test-topic-flow-publish-bare.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-flow-publish-bare.t	Wed May 23 11:37:37 2018 +0200
@@ -116,6 +116,7 @@
   marked working directory as topic: foo
   $ mkcommit c_dF0
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push
   pushing to $TESTTMP/bare-branch-server
   searching for changes
@@ -149,6 +150,7 @@
   marked working directory as topic: bar
   $ mkcommit c_dH0
   active topic 'bar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push
   pushing to $TESTTMP/bare-branch-server
   searching for changes
--- a/tests/test-topic-flow-publish-flag.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-flow-publish-flag.t	Wed May 23 11:37:37 2018 +0200
@@ -291,6 +291,7 @@
   marked working directory as topic: topic_A
   $ mkcommit c_dK0
   active topic 'topic_A' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push -r 'desc("c_dK0")' --publish
   pushing to $TESTTMP/bare-branch-server
   searching for changes
@@ -331,6 +332,7 @@
   $ hg topic topic_A
   $ mkcommit c_dL0
   active topic 'topic_A' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push -r 'desc("c_dL0")'
   pushing to $TESTTMP/bare-branch-server
   searching for changes
@@ -387,6 +389,7 @@
   marked working directory as topic: topic_B
   $ mkcommit c_dN0
   active topic 'topic_B' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push -r 'desc("c_dN0")' --publish
   pushing to $TESTTMP/bare-branch-server
   searching for changes
--- a/tests/test-topic-flow-single-head.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-flow-single-head.t	Wed May 23 11:37:37 2018 +0200
@@ -100,6 +100,7 @@
   marked working directory as topic: foo
   $ mkcommit c_dF0
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push
   pushing to $TESTTMP/single-head-server
   searching for changes
@@ -116,6 +117,7 @@
   marked working directory as topic: bar
   $ mkcommit c_dG0
   active topic 'bar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push
   pushing to $TESTTMP/single-head-server
   searching for changes
--- a/tests/test-topic-fold.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-fold.t	Wed May 23 11:37:37 2018 +0200
@@ -40,6 +40,7 @@
   marked working directory as topic: myfeature
   $ mkcommit feature1
   active topic 'myfeature' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit feature2
   $ logtopic
   @  2:d76a6166b18c835be9a487c5e21c7d260f0a1676
@@ -83,6 +84,7 @@
   marked working directory as topic: myotherfeature
   $ mkcommit feature4
   active topic 'myotherfeature' grew its first changeset
+  (see 'hg help topics' for more information)
   $ logtopic
   @  5:5ded4d6d578c37f339b0716de2e46e12ece7cbde
   |  topics: myotherfeature
--- a/tests/test-topic-mode.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-mode.t	Wed May 23 11:37:37 2018 +0200
@@ -108,6 +108,7 @@
   marked working directory as topic: mytopic
   $ hg ci -m "Added a"
   active topic 'mytopic' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg up -r "desc('ROOT')"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -171,6 +172,7 @@
   marked working directory as topic: mytopic
   $ hg ci -m "Added a"
   active topic 'mytopic' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg up -r "desc('ROOT')"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -227,6 +229,7 @@
   $ hg add A
   $ hg commit -m "Add A" --config devel.randomseed=42
   active topic 'panoramic-antelope' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg up -r "desc(ROOT)"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -235,6 +238,7 @@
   $ hg add B
   $ hg commit -m "Add B" --config devel.randomseed=128
   active topic 'various-dove' grew its first changeset
+  (see 'hg help topics' for more information)
 
 Test a merge too
 
@@ -288,6 +292,7 @@
   $ hg add A
   $ hg commit -m "Add A" --config devel.randomseed=42
   active topic 'panoramic-antelope' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg up -r "desc(ROOT)"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -296,6 +301,7 @@
   $ hg add B
   $ hg commit -m "Add B" --config devel.randomseed=128
   active topic 'various-dove' grew its first changeset
+  (see 'hg help topics' for more information)
 
 Test a merge too
 
@@ -328,3 +334,4 @@
   (branch merge, don't forget to commit)
   $ hg ci -m 'merge'  --config devel.randomseed=1337
   active topic 'omniscient-locust' grew its first changeset
+  (see 'hg help topics' for more information)
--- a/tests/test-topic-push-concurrent-on.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-push-concurrent-on.t	Wed May 23 11:37:37 2018 +0200
@@ -136,6 +136,7 @@
   $ hg add ddd
   $ hg commit -m 'CD'
   active topic 'babar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G # keep track of phase because I saw some strange bug during developement
   @  4 default babar draft CD
   |
@@ -194,6 +195,7 @@
   $ hg add eee
   $ hg commit -m 'CE'
   active topic 'celeste' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G # keep track of phase because I saw some strange bug during developement
   @  5 default celeste draft CE
   |
@@ -389,6 +391,7 @@
   marked working directory as topic: topicA
   $ hg commit -m 'CA'
   active topic 'topicA' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg up 'desc(CBASE)'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo aaa > bbb
@@ -397,6 +400,7 @@
   marked working directory as topic: topicB
   $ hg commit -m 'CB'
   active topic 'topicB' grew its first changeset
+  (see 'hg help topics' for more information)
   $ cd ..
   $ hg push -R repoA repoB
   pushing to repoB
--- a/tests/test-topic-push.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-push.t	Wed May 23 11:37:37 2018 +0200
@@ -132,6 +132,7 @@
   $ hg add ddd
   $ hg commit -m 'CD'
   active topic 'babar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G # keep track of phase because I saw some strange bug during developement
   @  4 default babar draft CD
   |
@@ -245,6 +246,7 @@
   $ hg add eee
   $ hg commit -m 'CE'
   active topic 'celeste' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G # keep track of phase because I saw some strange bug during developement
   @  5 default celeste draft CE
   |
@@ -440,6 +442,7 @@
   marked working directory as topic: topicA
   $ hg commit -m 'CA'
   active topic 'topicA' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg up 'desc(CBASE)'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo aaa > bbb
@@ -448,6 +451,7 @@
   marked working directory as topic: topicB
   $ hg commit -m 'CB'
   active topic 'topicB' grew its first changeset
+  (see 'hg help topics' for more information)
   $ cd ..
   $ hg push -R repoA repoB
   pushing to repoB
--- a/tests/test-topic-rebase.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-rebase.t	Wed May 23 11:37:37 2018 +0200
@@ -43,6 +43,7 @@
   marked working directory as topic: myfeature
   $ mkcommit feature1
   active topic 'myfeature' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg stack
   ### topic: myfeature
   ### target: default (branch)
@@ -109,6 +110,7 @@
   $ echo "B" >> file
   $ hg commit -m "myotherfeature1"
   active topic 'myotherfeature' grew its first changeset
+  (see 'hg help topics' for more information)
 
 Update the common file in default
   $ hg update --rev default
--- a/tests/test-topic-shelve.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-shelve.t	Wed May 23 11:37:37 2018 +0200
@@ -19,6 +19,7 @@
   $ hg ci -m "First commit" -A
   adding a
   active topic 'testing-shelve' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg topic
    * testing-shelve (1 changesets)
   $ echo " World" >> a
--- a/tests/test-topic-stack-data.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-stack-data.t	Wed May 23 11:37:37 2018 +0200
@@ -58,6 +58,7 @@
   marked working directory as topic: baz
   $ mkcommit baz_a
   active topic 'baz' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit baz_b
 
 A simple topic with unstability
@@ -68,6 +69,7 @@
   marked working directory as topic: fuz
   $ mkcommit fuz_a
   active topic 'fuz' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit fuz_b
   $ mkcommit fuz_c
   $ hg up 'desc(fuz_a)'
@@ -83,6 +85,7 @@
   marked working directory as topic: bar
   $ mkcommit bar_a
   active topic 'bar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit bar_b
   $ mkcommit bar_c
   $ hg up 'desc(bar_b)'
@@ -102,6 +105,7 @@
   marked working directory as topic: foo
   $ mkcommit foo_a
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit foo_b
 
 Summary
--- a/tests/test-topic-stack.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-stack.t	Wed May 23 11:37:37 2018 +0200
@@ -18,6 +18,7 @@
   $ hg add aaa
   $ hg commit -m c_a
   active topic 'other' grew its first changeset
+  (see 'hg help topics' for more information)
   $ echo aaa > bbb
   $ hg add bbb
   $ hg commit -m c_b
@@ -26,6 +27,7 @@
   $ hg add ccc
   $ hg commit -m c_c
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ echo aaa > ddd
   $ hg add ddd
   $ hg commit -m c_d
@@ -582,6 +584,7 @@
   $ hg commit -Am 'c_B'
   adding bbb
   active topic 'red' grew its first changeset
+  (see 'hg help topics' for more information)
   $ echo ccc > ccc
   $ hg commit -Am 'c_C'
   adding ccc
@@ -590,6 +593,7 @@
   $ hg commit -Am 'c_D'
   adding ddd
   active topic 'blue' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg up 'desc("c_B")'
   switching to topic red
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
--- a/tests/test-topic-tutorial.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic-tutorial.t	Wed May 23 11:37:37 2018 +0200
@@ -154,6 +154,7 @@
 
   $ hg commit -m "adding condiments"
   active topic 'food' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg log --graph --rev 'topic("food")'
   @  changeset:   1:13900241408b
@@ -753,6 +754,7 @@
   $ echo hammer >> shopping
   $ hg commit -m 'Adding hammer'
   active topic 'tools' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ echo saw >> shopping
   $ hg commit -m 'Adding saw'
@@ -772,6 +774,7 @@
   $ echo 'apple juice' >> shopping
   $ hg commit -m 'Adding apple juice'
   active topic 'drinks' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ echo 'orange juice' >> shopping
   $ hg commit -m 'Adding orange juice'
--- a/tests/test-topic.t	Thu May 24 18:57:46 2018 +0200
+++ b/tests/test-topic.t	Wed May 23 11:37:37 2018 +0200
@@ -278,6 +278,7 @@
   $ echo topic work >> alpha
   $ hg ci -m 'start on narf'
   active topic 'narf' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg co .^
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg topic fran
@@ -290,6 +291,7 @@
   $ echo >> fran work >> beta
   $ hg ci -m 'start on fran'
   active topic 'fran' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg co narf
   switching to topic narf
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -447,6 +449,7 @@
   marked working directory as topic: query
   $ hg ci -m 'what is narf, pinky?'
   active topic 'query' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -Gl2
   @  changeset:   5:c01515cfc331
   |  tag:         tip
@@ -832,10 +835,12 @@
   $ hg topic topic1990
   $ hg ci -m "Added b" --config devel.default-date="631152000 0" --user "foo"
   active topic 'topic1990' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg add c
   $ hg topic topic2010
   $ hg ci -m "Added c" --config devel.default-date="1262304000 0" --user "bar"
   active topic 'topic2010' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg log -G
   @  changeset:   3:76b16af75125