evolve: make sure we don't stop after evolution of obsparent (issue5881)
authorSushil khanchi <sushilkhanchi97@gmail.com>
Fri, 18 Jan 2019 23:09:44 +0530
changeset 4348 398c33b17d76
parent 4347 59745d6d626d
child 4349 01f4ee6779d5
evolve: make sure we don't stop after evolution of obsparent (issue5881) Before this patch, we were not handling the case when revset given by user also contain wdir parent which is obsolete. We were explicitly checking if wdir parent is obsolete, then update to its successor and return; without checking if we still have some revisions to be evolved. This patch make sure that after it update to the successor of obsolete parent it doesn't stop and continue to evolve other remaining revisions. Changes in tests/test-evolve-issue5881.t reflect the fixed behaviour.
CHANGELOG
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-issue5881.t
--- a/CHANGELOG	Fri Jan 18 23:08:43 2019 +0530
+++ b/CHANGELOG	Fri Jan 18 23:09:44 2019 +0530
@@ -11,6 +11,7 @@
   * split: support for non interactive splits
   * evolve: avoid potential crash when stabilizing orphan merges
   * evolve: pick right destination in split+prune cases issue5686 (4.9 only)
+  * evolve: prioritize --rev/--any/--all option over obsolete working directory
   * fold: concatenate commit message in revision order
   * push: have `--publish` overrule the `auto-publish` config
   * next: evolve aspiring children by default (use --no-evolve to skip)
--- a/hgext3rd/evolve/evolvecmd.py	Fri Jan 18 23:08:43 2019 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Jan 18 23:09:44 2019 +0530
@@ -1478,7 +1478,7 @@
         raise error.Abort(msg)
     elif len(specifiedcategories) == 1:
         targetcat = specifiedcategories[0]
-    elif repo['.'].obsolete():
+    elif repo['.'].obsolete() and not(revopt or anyopt or allopt):
         # if no args and parent is obsolete, update to successors
         return solveobswdp(ui, repo, opts)
 
@@ -1532,6 +1532,15 @@
 
         revs = _selectrevs(repo, allopt, revopt, anyopt, targetcat)
 
+        # Case: when wdir parent is obsolete and args passed.
+        # Handling it here otherwise `revs` set would change, after
+        # performing update to successor of obsolete wdir parent.
+        # (in case when user passes a revset related to wdir parent '.::')
+        if repo['.'].obsolete():
+            result = solveobswdp(ui, repo, opts)
+            if result != 0 or result is True:
+                return result
+
         if not revs:
             return _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat)
 
--- a/tests/test-evolve-issue5881.t	Fri Jan 18 23:08:43 2019 +0530
+++ b/tests/test-evolve-issue5881.t	Fri Jan 18 23:09:44 2019 +0530
@@ -44,9 +44,10 @@
       () draft
 
 Test `hg evolve` evolve all the revisions specified by user:
-(XXX:it stops after updating to its successor and don't evolve next revision,
-it will fixed in next patch)
   $ hg evolve -r .::
   update:[3] updated b
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory is now at e6048a693c0d
+  move:[2] added c
+  atop:[3] updated b
+  working directory is now at c3a628eb9aaf