changeset 3362:92b414710d2e stable

prev: jump to parent's successor if parent is obsolete and topic is involved `hg stack` shows a linear chain of commits even when they are not linear chain and some changesets are obsoleted and have successors as separate head. This is very nice to have a post evolution view of the stack. However when `hg prev` is run on an unstable changeset whose parent is obsolete and does not topic but parents successor has the topic, it shows no parent on the topic. This patch makes `hg prev` update to parent's successor and make things follow the stack order.
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 28 Dec 2017 03:12:54 +0530
parents 1439021d22f9
children 380fa6e8baf2
files CHANGELOG hgext3rd/evolve/__init__.py tests/test-evolve-topic.t
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Thu Dec 28 03:08:22 2017 +0530
+++ b/CHANGELOG	Thu Dec 28 03:12:54 2017 +0530
@@ -4,6 +4,8 @@
 7.1.1 - in progress
 -------------------
 
+  * fix `hg prev` behavior on obsolete changesets
+
 topic (0.6.1)
 
   * fix compatibility with Mercurial-4.3
--- a/hgext3rd/evolve/__init__.py	Thu Dec 28 03:08:22 2017 +0530
+++ b/hgext3rd/evolve/__init__.py	Thu Dec 28 03:12:54 2017 +0530
@@ -2036,6 +2036,8 @@
 
     # we do not filter in the 1 case to allow prev to t0
     if currenttopic and topic and _gettopicidx(p1) != 1:
+        parents = [repo[_singlesuccessor(repo, ctx)] if ctx.mutable() else ctx
+                   for ctx in parents]
         parents = [ctx for ctx in parents if ctx.topic() == currenttopic]
 
     # issue message for the various case
--- a/tests/test-evolve-topic.t	Thu Dec 28 03:08:22 2017 +0530
+++ b/tests/test-evolve-topic.t	Thu Dec 28 03:12:54 2017 +0530
@@ -265,6 +265,5 @@
   t0^ add eee (base)
 
   $ hg prev
-  no parent in topic "bar"
-  (do you want --no-topic)
-  [1]
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [18] add fff