Commits

Pierre-Yves David committed 02cadd3

evolve: adapt to 2.4 code

Comments (0)

Files changed (3)

 
 cachefuncs = obsolete.cachefuncs
 cachefor = obsolete.cachefor
-getobscache = obsolete.getobscache
+getrevs = obsolete.getrevs
 clearobscaches = obsolete.clearobscaches
 
 #####################################################################
     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]
             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
     """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')
     """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
 
     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')
     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]
 
 
     """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])
     """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, ()):
     """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]:
     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, ()):
     """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]
     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]
 
 
             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)

tests/test-obsolete.t

   $ 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
   $ 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
   $ 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]
 
   $ 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
   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)
 
   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

tests/test-tutorial.t

   $ 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]
  
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.