prev: also use stack shortcut in output when possible
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 12 Oct 2018 14:40:03 +0200
changeset 4161 3c28f8a3a5a5
parent 4160 44133463372f
child 4162 ba1e83c841f2
child 4181 ab3581bc0637
prev: also use stack shortcut in output when possible This mirror what `hg evolve` is doing since cc3a0b13ae57.
CHANGELOG
hgext3rd/evolve/__init__.py
tests/test-evolve-topic.t
tests/test-topic-stack-complex.t
tests/test-topic-tutorial.t
--- a/CHANGELOG	Fri Oct 12 14:33:03 2018 +0200
+++ b/CHANGELOG	Fri Oct 12 14:40:03 2018 +0200
@@ -6,6 +6,7 @@
 
   * evolve: avoid redundant output when handling linear orphans
   * evolve: use stack alias s# in `hg evolve` messages
+  * next, prev: use stack alias s# when relevant
   * rewind: add an undo alias
 
 8.2.1 -- 2018-09-14
--- a/hgext3rd/evolve/__init__.py	Fri Oct 12 14:33:03 2018 +0200
+++ b/hgext3rd/evolve/__init__.py	Fri Oct 12 14:40:03 2018 +0200
@@ -1076,9 +1076,14 @@
                     exc.hint = _('do you want --merge?')
                     raise
 
-        displayer = compat.changesetdisplayer(ui, repo,
-                                              {'template': shorttemplate})
         topic = not opts.get("no_topic", False)
+        hastopic = bool(_getcurrenttopic(repo))
+
+        template = shorttemplate
+        if topic and hastopic:
+            template = utility.stacktemplate
+
+        displayer = compat.changesetdisplayer(ui, repo, {'template': template})
 
         target, bookmark = _findprevtarget(repo, displayer,
                                            opts.get('move_bookmark'), topic)
--- a/tests/test-evolve-topic.t	Fri Oct 12 14:33:03 2018 +0200
+++ b/tests/test-evolve-topic.t	Fri Oct 12 14:40:03 2018 +0200
@@ -207,7 +207,7 @@
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [12] add eee
+  [s3] add eee
   $ hg next
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   [s4] add fff
@@ -222,7 +222,7 @@
   $ hg prev
   preserving the current topic 'bar'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [13] add fff
+  [s4] add fff
   $ hg prev
   no parent in topic "bar"
   (do you want --no-topic)
@@ -274,7 +274,7 @@
 
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [18] add fff
+  [s1] add fff
 
 Testing issue 5708 when we are on obsolete changeset and there is active topic
 ------------------------------------------------------------------------------
@@ -332,7 +332,7 @@
 
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [14] add ggg
+  [s2] add ggg
 
 When the current topic and successors topic are same, but obsolete cset has
 different topic
@@ -380,4 +380,4 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [12] add eee
+  [s3] add eee
--- a/tests/test-topic-stack-complex.t	Fri Oct 12 14:33:03 2018 +0200
+++ b/tests/test-topic-stack-complex.t	Fri Oct 12 14:40:03 2018 +0200
@@ -48,7 +48,7 @@
   s0^ Added foo (base)
   $ hg prev
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  [2] Added c and d
+  [s2] Added c and d
 
   $ echo 0 > num
   $ cat > editor.sh << '__EOF__'
@@ -103,7 +103,7 @@
 
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [4] split1
+  [s2] split1
   $ echo foo > c
   $ hg diff
   diff -r f26c1b9addde c
--- a/tests/test-topic-tutorial.t	Fri Oct 12 14:33:03 2018 +0200
+++ b/tests/test-topic-tutorial.t	Fri Oct 12 14:40:03 2018 +0200
@@ -1151,7 +1151,7 @@
 
   $ hg previous
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  [14] Adding saw
+  [s2] Adding saw
 
   $ hg stack
   ### topic: tools