evolve: exclude "identical" precursors from the precursors set
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 17 Jun 2018 03:29:34 +0200
changeset 3870 e0bf44befd6e
parent 3869 bbfbaf46f7b0
child 3871 2e32a1ef0c60
evolve: exclude "identical" precursors from the precursors set I'm not sure it is the right thing to do, but it simply thing a lot for now. Otherwise, using 'precursors' to find rewind direction become too complex. This is going to give problematic result in case of prune. Since there are no other precursors to follow.
hgext3rd/evolve/__init__.py
tests/test-rewind.t
--- a/hgext3rd/evolve/__init__.py	Sun Jun 17 03:07:53 2018 +0200
+++ b/hgext3rd/evolve/__init__.py	Sun Jun 17 03:29:34 2018 +0200
@@ -533,7 +533,7 @@
 
 # XXX SOME MAJOR CLEAN UP TO DO HERE XXX
 
-def _precursors(repo, s):
+def _precursors(repo, s, includeidentical=False):
     """Precursor of a changeset"""
     cs = set()
     nm = repo.changelog.nodemap
@@ -541,6 +541,8 @@
     node = repo.changelog.node
     for r in s:
         for p in markerbysubj.get(node(r), ()):
+            if not includeidentical and p[2] & rewind.identicalflag:
+                continue
             pr = nm.get(p[0])
             if pr is not None:
                 cs.add(pr)
--- a/tests/test-rewind.t	Sun Jun 17 03:07:53 2018 +0200
+++ b/tests/test-rewind.t	Sun Jun 17 03:29:34 2018 +0200
@@ -752,7 +752,7 @@
 ```````
 
   $ echo 'default-date = 4 0' >> $HGRCPATH
-  $ hg rewind --hidden --to 'max(precursors(.))'
+  $ hg rewind --hidden --to 'precursors(.)'
   rewinded to 1 changesets
   (1 changesets obsoleted)
   working directory is now at 7b1440274cc3
@@ -800,7 +800,7 @@
 Automaticlaly rewinding the full stack
 --------------------------------------
 
-  $ hg rewind --hidden --to 'max(precursors(.))'
+  $ hg rewind --hidden --to 'precursors(.)'
   rewinded to 2 changesets
   (2 changesets obsoleted)
   working directory is now at 70892f498f29