changeset 590:02cadd3dc9f4

evolve: adapt to 2.4 code
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 23 Oct 2012 17:12:53 +0200
parents 8945a62f9096
children 012e48e80840
files hgext/evolve.py tests/test-obsolete.t tests/test-tutorial.t
diffstat 3 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Tue Oct 23 16:53:11 2012 +0200
+++ b/hgext/evolve.py	Tue Oct 23 17:12:53 2012 +0200
@@ -328,7 +328,7 @@
 
 cachefuncs = obsolete.cachefuncs
 cachefor = obsolete.cachefor
-getobscache = obsolete.getobscache
+getrevs = obsolete.getrevs
 clearobscaches = obsolete.clearobscaches
 
 #####################################################################
@@ -363,7 +363,7 @@
     obsstore = repo.obsstore
     newermap = {}
     for ctx in repo.set('(not public()) - obsolete()'):
-        mark = obsstore.successors.get(ctx.node(), ())
+        mark = obsstore.precursors.get(ctx.node(), ())
         toprocess = set(mark)
         while toprocess:
             prec = toprocess.pop()[0]
@@ -373,7 +373,7 @@
             if len(newer) > 1:
                 divergent.add(ctx.rev())
                 break
-            toprocess.update(obsstore.successors.get(prec, ()))
+            toprocess.update(obsstore.precursors.get(prec, ()))
     return divergent
 
 ### changectx method
@@ -383,7 +383,7 @@
     """is the changeset latecomer (Try to succeed to public change)"""
     if ctx.node() is None:
         return False
-    return ctx.rev() in getobscache(ctx._repo, 'latecomer')
+    return ctx.rev() in getrevs(ctx._repo, 'latecomer')
 
 @eh.addattr(context.changectx, 'conflicting')
 @eh.addattr(context.changectx, 'divergent')
@@ -391,7 +391,7 @@
     """is the changeset divergent (Try to succeed to public change)"""
     if ctx.node() is None:
         return False
-    return ctx.rev() in getobscache(ctx._repo, 'divergent')
+    return ctx.rev() in getrevs(ctx._repo, 'divergent')
 
 ### revset symbol
 
@@ -401,7 +401,7 @@
     Changesets marked as successors of public changesets.
     """
     args = revset.getargs(x, 0, 0, 'latecomer takes no arguments')
-    lates = getobscache(repo, 'latecomer')
+    lates = getrevs(repo, 'latecomer')
     return [r for r in subset if r in lates]
 
 @eh.revset('conflicting')
@@ -411,7 +411,7 @@
     Changesets marked as successors of a same changeset.
     """
     args = revset.getargs(x, 0, 0, 'divergent takes no arguments')
-    conf = getobscache(repo, 'divergent')
+    conf = getrevs(repo, 'divergent')
     return [r for r in subset if r in conf]
 
 
@@ -536,7 +536,7 @@
     """Precursor of a changeset"""
     cs = set()
     nm = repo.changelog.nodemap
-    markerbysubj = repo.obsstore.successors
+    markerbysubj = repo.obsstore.precursors
     for r in s:
         for p in markerbysubj.get(repo[r].node(), ()):
             pr = nm.get(p[0])
@@ -548,7 +548,7 @@
     """transitive precursors of a subset"""
     toproceed = [repo[r].node() for r in s]
     seen = set()
-    allsubjects = repo.obsstore.successors
+    allsubjects = repo.obsstore.precursors
     while toproceed:
         nc = toproceed.pop()
         for mark in allsubjects.get(nc, ()):
@@ -568,7 +568,7 @@
     """Successors of a changeset"""
     cs = set()
     nm = repo.changelog.nodemap
-    markerbyobj = repo.obsstore.precursors
+    markerbyobj = repo.obsstore.successors
     for r in s:
         for p in markerbyobj.get(repo[r].node(), ()):
             for sub in p[1]:
@@ -584,7 +584,7 @@
     marker.  """
     toproceed = [repo[r].node() for r in s]
     seen = set()
-    allobjects = repo.obsstore.precursors
+    allobjects = repo.obsstore.successors
     while toproceed:
         nc = toproceed.pop()
         for mark in allobjects.get(nc, ()):
@@ -609,7 +609,7 @@
     """Return the newer version of an obsolete changeset"""
 
     # prec -> markers mapping
-    markersfor = repo.obsstore.precursors
+    markersfor = repo.obsstore.successors
 
     # Stack of node need to know the last successors set
     toproceed = [initialnode]
@@ -738,7 +738,7 @@
     Obsolete changesets with non-obsolete descendants.
     """
     args = revset.getargs(x, 0, 0, 'suspended takes no arguments')
-    suspended = getobscache(repo, 'suspended')
+    suspended = getrevs(repo, 'suspended')
     return [r for r in subset if r in suspended]
 
 
@@ -875,9 +875,9 @@
             ui.note(s)
 
     ret = orig(ui, repo, *args, **kwargs)
-    nbunstable = len(getobscache(repo, 'unstable'))
-    nblatecomer = len(getobscache(repo, 'latecomer'))
-    nbdivergent = len(getobscache(repo, 'unstable'))
+    nbunstable = len(getrevs(repo, 'unstable'))
+    nblatecomer = len(getrevs(repo, 'latecomer'))
+    nbdivergent = len(getrevs(repo, 'unstable'))
     write('unstable: %i changesets\n', nbunstable)
     write('latecomer: %i changesets\n', nblatecomer)
     write('divergent: %i changesets\n', nbdivergent)
--- a/tests/test-obsolete.t	Tue Oct 23 16:53:11 2012 +0200
+++ b/tests/test-obsolete.t	Tue Oct 23 17:12:53 2012 +0200
@@ -164,7 +164,7 @@
   $ hg push ../other-new
   pushing to ../other-new
   searching for changes
-  abort: push includes an unstable changeset: a7a6f2b5d8a5!
+  abort: push includes unstable changeset: a7a6f2b5d8a5!
   (use 'hg evolve' to get a stable history or --force to ignore warnings)
   [255]
   $ hg push -f ../other-new
@@ -217,7 +217,7 @@
   $ hg push ../other-new
   pushing to ../other-new
   searching for changes
-  abort: push includes an unstable changeset: 95de7fc6918d!
+  abort: push includes unstable changeset: 95de7fc6918d!
   (use 'hg evolve' to get a stable history or --force to ignore warnings)
   [255]
   $ hg push ../other-new -f # use f because there is unstability
@@ -562,7 +562,7 @@
   $ hg push ../other-new/
   pushing to ../other-new/
   searching for changes
-  abort: push includes a latecomer changeset: 6db5e282cb91!
+  abort: push includes bumped changeset: 6db5e282cb91!
   (use 'hg evolve' to get a stable history or --force to ignore warnings)
   [255]
 
@@ -575,7 +575,7 @@
   $ echo 42 >> f
   $ hg commit --amend --traceback --quiet
   $ hg log -G
-  @  changeset:   1[35]:3734a65252e6 (re)
+  @  changeset:   15:705ab2a6b72e
   |  tag:         tip
   |  parent:      10:2033b4e49474
   |  user:        test
@@ -626,7 +626,7 @@
   0d3f46688ccc6e756c7e96cf64c391c411309597 2033b4e494742365851fac84d276640cbf52833e 0 {'date': '* *', 'user': 'test'} (glob)
   159dfc9fa5d334d7e03a0aecfc7f7ab4c3431fea 9468a5f5d8b2c5d91e17474e95ae4791e9718fdf 0 {'date': '* *', 'user': 'test'} (glob)
   9468a5f5d8b2c5d91e17474e95ae4791e9718fdf 6db5e282cb91df5c43ff1f1287c119ff83230d42 0 {'date': '', 'user': 'test'} (glob)
-  0b1b6dd009c037985363e2290a0b579819f659db 3734a65252e69ddcced85901647a4f335d40de1e 0 {'date': '* *', 'user': 'test'} (glob)
+  0b1b6dd009c037985363e2290a0b579819f659db 705ab2a6b72e2cd86edb799ebe15f2695f86143e 0 {'date': '* *', 'user': 'test'} (glob)
 #no produced by 2.3
 33d458d86621f3186c40bfccd77652f4a122743e 3734a65252e69ddcced85901647a4f335d40de1e 0 {'date': '* *', 'user': 'test'} (glob)
 
@@ -650,7 +650,7 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     add obsol_d'''
   
-  changeset:   14:50f11e5e3a63
+  changeset:   16:50f11e5e3a63
   tag:         tip
   parent:      11:9468a5f5d8b2
   user:        test
--- a/tests/test-tutorial.t	Tue Oct 23 16:53:11 2012 +0200
+++ b/tests/test-tutorial.t	Tue Oct 23 17:12:53 2012 +0200
@@ -612,7 +612,7 @@
   $ hg push other
   pushing to $TESTTMP/other
   searching for changes
-  abort: push includes an unstable changeset: 9ac5d0e790a2!
+  abort: push includes unstable changeset: 9ac5d0e790a2!
   (use 'hg evolve' to get a stable history or --force to ignore warnings)
   [255]