drop relevant marker compat
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 27 Aug 2014 10:22:50 +0200
changeset 1070 527b12a59628
parent 1069 356552e55489
child 1071 3009e6eaea4c
drop relevant marker compat
hgext/evolve.py
--- a/hgext/evolve.py	Wed Aug 27 10:21:30 2014 +0200
+++ b/hgext/evolve.py	Wed Aug 27 10:22:50 2014 +0200
@@ -348,84 +348,6 @@
         opts['user'] = ui.username()
 
 
-createmarkers = obsolete.createmarkers
-if not util.safehasattr(obsolete.obsstore, 'relevantmarkers'):
-
-    @eh.wrapfunction(mercurial.obsolete, 'createmarkers')
-    def _createmarkers(orig, repo, relations, *args, **kwargs):
-        """register parent information at prune time"""
-        # every time this test is run, a kitten is slain.
-        # Change it as soon as possible
-        if '[,{metadata}]' in orig.__doc__:
-            relations = list(relations)
-            for idx, rel in enumerate(relations):
-                prec = rel[0]
-                sucs = rel[1]
-                if not sucs:
-                    meta = {}
-                    if 2 < len(rel):
-                        meta.update(rel[2])
-                    for i, p in enumerate(prec.parents(), 1):
-                        meta['p%i' % i] = p.hex()
-                    relations[idx] = (prec, sucs, meta)
-        return orig(repo, relations, *args, **kwargs)
-
-    def createmarkers(*args, **kwargs):
-        return obsolete.createmarkers(*args, **kwargs)
-
-    class pruneobsstore(obsolete.obsstore):
-
-        def __init__(self, *args, **kwargs):
-            self.prunedchildren = {}
-            return super(pruneobsstore, self).__init__(*args, **kwargs)
-
-        def _load(self, markers):
-            markers = self._prunedetectingmarkers(markers)
-            return super(pruneobsstore, self)._load(markers)
-
-
-        def _prunedetectingmarkers(self, markers):
-            for m in markers:
-                if not m[1]: # no successors
-                    meta = obsolete.decodemeta(m[3])
-                    if 'p1' in meta:
-                        p1 = node.bin(meta['p1'])
-                        self.prunedchildren.setdefault(p1, set()).add(m)
-                    if 'p2' in meta:
-                        p2 = node.bin(meta['p2'])
-                        self.prunedchildren.setdefault(p2, set()).add(m)
-                yield m
-
-    obsolete.obsstore = pruneobsstore
-
-    @eh.addattr(obsolete.obsstore, 'relevantmarkers')
-    def relevantmarkers(self, nodes):
-        """return a set of all obsolescence marker relevant to a set of node.
-
-        "relevant" to a set of node mean:
-
-        - marker that use this changeset as successors
-        - prune marker of direct children on this changeset.
-        - recursive application of the two rules on precursors of these markers
-
-        It  a set so you cannot rely on order"""
-        seennodes = set(nodes)
-        seenmarkers = set()
-        pendingnodes = set(nodes)
-        precursorsmarkers = self.precursors
-        prunedchildren = self.prunedchildren
-        while pendingnodes:
-            direct = set()
-            for current in pendingnodes:
-                direct.update(precursorsmarkers.get(current, ()))
-                direct.update(prunedchildren.get(current, ()))
-            direct -= seenmarkers
-            pendingnodes = set([m[0] for m in direct])
-            seenmarkers |= direct
-            pendingnodes -= seennodes
-            seennodes |= pendingnodes
-        return seenmarkers
-
 #####################################################################
 ### Critical fix                                                  ###
 #####################################################################
@@ -897,11 +819,11 @@
         oldbookmarks = repo.nodebookmarks(nodesrc)
         if nodenew is not None:
             phases.retractboundary(repo, tr, destphase, [nodenew])
-            createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))])
+            obsolete.createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))])
             for book in oldbookmarks:
                 repo._bookmarks[book] = nodenew
         else:
-            createmarkers(repo, [(repo[nodesrc], ())])
+            obsolete.createmarkers(repo, [(repo[nodesrc], ())])
             # Behave like rebase, move bookmarks to dest
             for book in oldbookmarks:
                 repo._bookmarks[book] = dest.node()
@@ -1456,7 +1378,7 @@
                 tmpid = relocate(repo, bumped, prec.p1())
                 if tmpid is not None:
                     tmpctx = repo[tmpid]
-                    createmarkers(repo, [(bumped, (tmpctx,))])
+                    obsolete.createmarkers(repo, [(bumped, (tmpctx,))])
             except MergeFailure:
                 repo.opener.write('graftstate', bumped.hex() + '\n')
                 repo.ui.write_err(_('evolution failed!\n'))
@@ -1498,11 +1420,11 @@
 
             newid = repo.commitctx(new)
         if newid is None:
-            createmarkers(repo, [(tmpctx, ())])
+            obsolete.createmarkers(repo, [(tmpctx, ())])
             newid = prec.node()
         else:
             phases.retractboundary(repo, tr, bumped.phase(), [newid])
-            createmarkers(repo, [(tmpctx, (repo[newid],))],
+            obsolete.createmarkers(repo, [(tmpctx, (repo[newid],))],
                                    flag=obsolete.bumpedfix)
         bmupdate(newid)
         tr.close()
@@ -1606,7 +1528,7 @@
             # no changes
         else:
             new = repo['.']
-        createmarkers(repo, [(other, (new,))])
+        obsolete.createmarkers(repo, [(other, (new,))])
         phases.retractboundary(repo, tr, other.phase(), [new.node()])
         tr.close()
     finally:
@@ -1811,7 +1733,7 @@
             relations = [(p, (s,)) for p, s in zip(precs, sucs)]
 
         # create markers
-        createmarkers(repo, relations, metadata=metadata)
+        obsolete.createmarkers(repo, relations, metadata=metadata)
 
         # informs that changeset have been pruned
         ui.status(_('%i changesets pruned\n') % len(precs))
@@ -2037,7 +1959,7 @@
             raise util.Abort(_('nothing to uncommit'),
                              hint=_("use --all to uncommit all files"))
         # Move local changes on filtered changeset
-        createmarkers(repo, [(old, (repo[newid],))])
+        obsolete.createmarkers(repo, [(old, (repo[newid],))])
         phases.retractboundary(repo, tr, oldphase, [newid])
         repo.dirstate.setparents(newid, node.nullid)
         _uncommitdirstate(repo, old, match)
@@ -2068,7 +1990,7 @@
                 oldbookmarks.extend(repo.nodebookmarks(old.node()))
                 markers.append((old, (new,)))
             if markers:
-                createmarkers(repo, markers)
+                obsolete.createmarkers(repo, markers)
             for book in oldbookmarks:
                 repo._bookmarks[book] = new.node()
             if oldbookmarks:
@@ -2123,7 +2045,7 @@
                 # store touched version to help potential children
                 newmapping[ctx.node()] = new
                 if not duplicate:
-                    createmarkers(repo, [(ctx, (repo[new],))])
+                    obsolete.createmarkers(repo, [(ctx, (repo[new],))])
                 phases.retractboundary(repo, tr, ctx.phase(), [new])
                 if ctx in repo[None].parents():
                     repo.dirstate.setparents(new, node.nullid)
@@ -2228,7 +2150,7 @@
                                             [root.p1().node(), root.p2().node()],
                                             commitopts=commitopts)
             phases.retractboundary(repo, tr, targetphase, [newid])
-            createmarkers(repo, [(ctx, (repo[newid],))
+            obsolete.createmarkers(repo, [(ctx, (repo[newid],))
                                  for ctx in allctx])
             tr.close()
         finally: