changeset 470:a2dfe82f27a0

obsolete: use flag to detect that a obsolescence marker fix a latecomer Otherwise latecomer fix will be latecomer too.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 20 Aug 2012 19:12:20 +0200
parents abeb17a9e313
children 8be3973adf34
files hgext/evolve.py hgext/obsolete.py tests/test-evolve.t
diffstat 3 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Tue Aug 21 10:10:44 2012 +0200
+++ b/hgext/evolve.py	Mon Aug 20 19:12:20 2012 +0200
@@ -423,7 +423,8 @@
                     newid = prec.node()
                 else:
                     phases.retractboundary(repo, latecomer.phase(), [newid])
-                    obsolete.createmarkers(repo, [(tmpctx, (repo[newid],))])
+                    obsolete.createmarkers(repo, [(tmpctx, (repo[newid],))],
+                                           flag=obsolete.latediff)
                 bmupdate(newid)
                 tr.close()
                 repo.ui.status(_('commited as %s\n') % node.short(newid))
--- a/hgext/obsolete.py	Tue Aug 21 10:10:44 2012 +0200
+++ b/hgext/obsolete.py	Mon Aug 20 19:12:20 2012 +0200
@@ -487,12 +487,15 @@
 # - push warning
 
 ### Cache computation
+latediff = 1  # flag to prevent taking late comer fix into account
 
 @cachefor('latecomer')
 def _computelatecomerset(repo):
     """the set of rev trying to obsolete public revision"""
-    query = 'allsuccessors(public()) - obsolete() - public()'
-    return set(repo.revs(query))
+    candidates = _allsuccessors(repo, repo.revs('public()'),
+                                                haltonflags=latediff)
+    query = '%ld - obsolete() - public()'
+    return set(repo.revs(query, candidates))
 
 @cachefor('conflicting')
 def _computeconflictingset(repo):
@@ -709,14 +712,19 @@
                     cs.add(sr)
     return cs
 
-def _allsuccessors(repo, s):  # XXX we need a better naming
-    """transitive successors of a subset"""
+def _allsuccessors(repo, s, haltonflags=0):  # XXX we need a better naming
+    """transitive successors of a subset
+
+    haltonflags allows to provide flags which prevent the evaluation of a
+    marker.  """
     toproceed = [repo[r].node() for r in s]
     seen = set()
     allobjects = repo.obsstore.precursors
     while toproceed:
         nc = toproceed.pop()
         for mark in allobjects.get(nc, ()):
+            if mark[2] & haltonflags:
+                continue
             for sub in mark[1]:
                 if sub == nullid:
                     continue # should not be here!
--- a/tests/test-evolve.t	Tue Aug 21 10:10:44 2012 +0200
+++ b/tests/test-evolve.t	Mon Aug 20 19:12:20 2012 +0200
@@ -320,6 +320,7 @@
   @@ -3,1 +3,1 @@
   -Zwei
   +deux
+  $ hg log -r 'latecomer()' # no more latecomer
 
   $ cd ..