changeset 1388:c96e4ab4e5cc

merge with stable
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 18 Jun 2015 17:57:11 -0700
parents 3d2d3333fb0b (current diff) eb044bcf342d (diff)
children 35518d26b549
files README hgext/evolve.py tests/test-stabilize-result.t
diffstat 3 files changed, 42 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/README	Thu Jun 18 15:25:51 2015 -0700
+++ b/README	Thu Jun 18 17:57:11 2015 -0700
@@ -57,7 +57,6 @@
 - evolve: revision are processed in the order they stack on destination
 - evolve: properly skip unstable revision with non-evolved unstable parent
 
-
 5.1.5 --
 
 - minor documentation cleanup
@@ -67,6 +66,8 @@
 - fix simple4server bug tracker URL
 - compatibility with bookmark API change in future Mercurial 3.5
 - prune no longer move the active bookmark for no reason (issue4559)
+- evolve: stop reporting divergence base as missing when we actually have it
+- significant performance improvement for all revsets.
 
 5.1.4 -- 2015-04-23
 
--- a/hgext/evolve.py	Thu Jun 18 15:25:51 2015 -0700
+++ b/hgext/evolve.py	Thu Jun 18 17:57:11 2015 -0700
@@ -257,7 +257,7 @@
 
 
     def templatekw(self, keywordname):
-        """Decorated function is a revset keyword
+        """Decorated function is a template keyword
 
         The name of the keyword must be given as the decorator argument.
         The symbol is added during `extsetup`.
@@ -444,7 +444,9 @@
     troubled.update(getrevs(repo, 'unstable'))
     troubled.update(getrevs(repo, 'bumped'))
     troubled.update(getrevs(repo, 'divergent'))
-    return subset & revset.baseset(troubled)
+    troubled = revset.baseset(troubled)
+    troubled.sort() # set is non-ordered, enforce order
+    return subset & troubled
 
 ### Obsolescence graph
 
@@ -455,16 +457,19 @@
     cs = set()
     nm = repo.changelog.nodemap
     markerbysubj = repo.obsstore.precursors
+    node = repo.changelog.node
     for r in s:
-        for p in markerbysubj.get(repo[r].node(), ()):
+        for p in markerbysubj.get(node(r), ()):
             pr = nm.get(p[0])
             if pr is not None:
                 cs.add(pr)
+    cs -= repo.changelog.filteredrevs # nodemap has no filtering
     return cs
 
 def _allprecursors(repo, s):  # XXX we need a better naming
     """transitive precursors of a subset"""
-    toproceed = [repo[r].node() for r in s]
+    node = repo.changelog.node
+    toproceed = [node(r) for r in s]
     seen = set()
     allsubjects = repo.obsstore.precursors
     while toproceed:
@@ -480,19 +485,22 @@
         pr = nm.get(p)
         if pr is not None:
             cs.add(pr)
+    cs -= repo.changelog.filteredrevs # nodemap has no filtering
     return cs
 
 def _successors(repo, s):
     """Successors of a changeset"""
     cs = set()
+    node = repo.changelog.node
     nm = repo.changelog.nodemap
     markerbyobj = repo.obsstore.successors
     for r in s:
-        for p in markerbyobj.get(repo[r].node(), ()):
+        for p in markerbyobj.get(node(r), ()):
             for sub in p[1]:
                 sr = nm.get(sub)
                 if sr is not None:
                     cs.add(sr)
+    cs -= repo.changelog.filteredrevs # nodemap has no filtering
     return cs
 
 def _allsuccessors(repo, s, haltonflags=0):  # XXX we need a better naming
@@ -500,7 +508,8 @@
 
     haltonflags allows to provide flags which prevent the evaluation of a
     marker.  """
-    toproceed = [repo[r].node() for r in s]
+    node = repo.changelog.node
+    toproceed = [node(r) for r in s]
     seen = set()
     allobjects = repo.obsstore.successors
     while toproceed:
@@ -520,6 +529,7 @@
         sr = nm.get(s)
         if sr is not None:
             cs.add(sr)
+    cs -= repo.changelog.filteredrevs # nodemap has no filtering
     return cs
 
 
@@ -540,8 +550,9 @@
     Obsolete changesets with non-obsolete descendants.
     """
     revset.getargs(x, 0, 0, 'suspended takes no arguments')
-    suspended = getrevs(repo, 'suspended')
-    return [r for r in subset if r in suspended]
+    suspended = revset.baseset(getrevs(repo, 'suspended'))
+    suspended.sort()
+    return subset & suspended
 
 
 @eh.revset('precursors')
@@ -550,8 +561,9 @@
     Immediate precursors of changesets in set.
     """
     s = revset.getset(repo, revset.fullreposet(repo), x)
-    cs = _precursors(repo, s)
-    return [r for r in subset if r in cs]
+    s = revset.baseset(_precursors(repo, s))
+    s.sort()
+    return subset & s
 
 
 @eh.revset('allprecursors')
@@ -560,8 +572,9 @@
     Transitive precursors of changesets in set.
     """
     s = revset.getset(repo, revset.fullreposet(repo), x)
-    cs = _allprecursors(repo, s)
-    return [r for r in subset if r in cs]
+    s = revset.baseset(_allprecursors(repo, s))
+    s.sort()
+    return subset & s
 
 
 @eh.revset('successors')
@@ -570,8 +583,9 @@
     Immediate successors of changesets in set.
     """
     s = revset.getset(repo, revset.fullreposet(repo), x)
-    cs = _successors(repo, s)
-    return [r for r in subset if r in cs]
+    s = revset.baseset(_successors(repo, s))
+    s.sort()
+    return subset & s
 
 @eh.revset('allsuccessors')
 def revsetallsuccessors(repo, subset, x):
@@ -579,8 +593,9 @@
     Transitive successors of changesets in set.
     """
     s = revset.getset(repo, revset.fullreposet(repo), x)
-    cs = _allsuccessors(repo, s)
-    return [r for r in subset if r in cs]
+    s = revset.baseset(_allsuccessors(repo, s))
+    s.sort()
+    return subset & s
 
 ### template keywords
 # XXX it does not handle troubles well :-/
@@ -1740,8 +1755,8 @@
 
     XXX this woobly function won't survive XXX
     """
-    repo = ctx.repo.unfitered()
-    for base in repo.set('reverse(precursors(%d))', ctx):
+    repo = ctx._repo.unfiltered()
+    for base in repo.set('reverse(allprecursors(%d))', ctx):
         newer = obsolete.successorssets(ctx._repo, base.node())
         # drop filter and solution including the original ctx
         newer = [n for n in newer if n and ctx.node() not in n]
--- a/tests/test-stabilize-result.t	Thu Jun 18 15:25:51 2015 -0700
+++ b/tests/test-stabilize-result.t	Thu Jun 18 17:57:11 2015 -0700
@@ -320,18 +320,20 @@
   $ echo 'gotta break' >> a
   $ hg amend
   2 new divergent changesets
+# reamend so that the case is not the first precursor.
+  $ hg amend -m "More addition (2)"
   $ hg phase 'divergent()'
   21: draft
-  23: draft
+  24: draft
   $ hg evolve -qn
-  hg update -c 36e188246d67 &&
+  hg update -c 0b336205a5d0 &&
   hg merge f344982e63c4 &&
-  hg commit -m "auto merge resolving conflict between 36e188246d67 and f344982e63c4"&&
+  hg commit -m "auto merge resolving conflict between 0b336205a5d0 and f344982e63c4"&&
   hg up -C 3932c176bbaa &&
   hg revert --all --rev tip &&
-  hg commit -m "`hg log -r 36e188246d67 --template={desc}`";
+  hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`";
   $ hg evolve
-  merge:[23] More addition
+  merge:[24] More addition (2)
   with: [21] More addition
   base: [15] More addition
   merging a