changeset 4694:b6a7d2594ff3

evolve: refactor for consistent behavior of evolve when wdp is obsolete This patch make sure that when working directory parent is obsolete `hg evolve` and `hg evolve --all` don't behave differently.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sun, 09 Jun 2019 12:07:08 +0530
parents 6f6fec14e607
children 4c9f9dac8977
files hgext3rd/evolve/evolvecmd.py tests/test-evolve.t tests/test-tutorial.t
diffstat 3 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Sat Jun 15 17:17:19 2019 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Jun 09 12:07:08 2019 +0530
@@ -1632,15 +1632,11 @@
         return
 
     targetcat = 'orphan'
-    has_some_opts = bool(revopt or anyopt or allopt or contopt or stopopt or abortopt)
     if 1 < len(specifiedcategories):
         msg = _('cannot specify more than one trouble category to solve (yet)')
         raise error.Abort(msg)
     elif len(specifiedcategories) == 1:
         targetcat = specifiedcategories[0]
-    elif repo['.'].obsolete() and not has_some_opts:
-        # if no args and parent is obsolete, update to successors
-        return solveobswdp(ui, repo, opts)
 
     ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve')
 
@@ -1684,17 +1680,17 @@
 
         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 '.::')
+        hadobswdp = False
         if repo['.'].obsolete():
+            hadobswdp = True
             result = solveobswdp(ui, repo, opts)
             if result != 0 or result is True:
                 # return as solving obswdp wasn't successful
                 return result
 
         if not revs:
+            if hadobswdp:
+                return 0
             return _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat)
 
         # Progress handling
--- a/tests/test-evolve.t	Sat Jun 15 17:17:19 2019 +0530
+++ b/tests/test-evolve.t	Sun Jun 09 12:07:08 2019 +0530
@@ -1442,7 +1442,6 @@
   update:[1] added a
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory is now at ab832e43dd5a
-  no troubled changesets
 
   $ hg log -GT "{rev}:{node|short} {desc} ({bookmarks})\n" --hidden
   @  1:ab832e43dd5a added a (book)
--- a/tests/test-tutorial.t	Sat Jun 15 17:17:19 2019 +0530
+++ b/tests/test-tutorial.t	Sun Jun 09 12:07:08 2019 +0530
@@ -1528,7 +1528,6 @@
   update:[8] animals
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory is now at 2a2b36e14660
-  no troubled changesets
 
 Relocating unstable change after prune
 ----------------------------------------------