changeset 382:58fdb2180064

Use the core check heads mecanism to prevent zaelous warning
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 25 Jul 2012 19:07:20 +0200
parents 3a161a89d65d
children 57bccc6452e9
files hgext/obsolete.py
diffstat 1 files changed, 1 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Wed Jul 25 19:08:45 2012 +0200
+++ b/hgext/obsolete.py	Wed Jul 25 19:07:20 2012 +0200
@@ -448,71 +448,13 @@
         # checking heads only is enought because any thing base on obsolete
         # changeset is either obsolete or unstable.
         ctx =  repo[h]
-        if ctx.unstable():
-            raise util.Abort(_("push includes an unstable changeset: %s!")
-                             % ctx)
-        if ctx.obsolete():
-            raise util.Abort(_("push includes an  obsolete changeset: %s!")
-                             % ctx)
         if ctx.latecomer():
             raise util.Abort(_("push includes an latecomer changeset: %s!")
                              % ctx)
         if ctx.conflicting():
             raise util.Abort(_("push includes conflicting changeset: %s!")
                              % ctx)
-    ### patch remote branch map
-    # do not read it this burn eyes
-    try:
-        if 'oldbranchmap' not in vars(remote):
-            remote.oldbranchmap = remote.branchmap
-            def branchmap():
-                newbm = {}
-                oldbm = None
-                if (util.safehasattr(discovery, 'visiblebranchmap')
-                    and not util.safehasattr(remote, 'ignorevisiblebranchmap')
-                   ):
-                    remote.ignorevisiblebranchmap = False
-                    remote.branchmap = remote.oldbranchmap
-                    oldbm = phases.visiblebranchmap(remote)
-                    remote.branchmap = remote.newbranchmap
-                    remote.ignorevisiblebranchmap = True
-                if oldbm is None:
-                    oldbm = remote.oldbranchmap()
-                for branch, nodes in oldbm.iteritems():
-                    nodes = list(nodes)
-                    new = set()
-                    while nodes:
-                        n = nodes.pop()
-                        if n in repo.obsstore.precursors:
-                            markers = repo.obsstore.precursors[n]
-                            for mark in markers:
-                                for newernode in mark[1]:
-                                    if newernode is not None:
-                                        nodes.append(newernode)
-                        else:
-                            new.add(n)
-                    if new:
-                        newbm[branch] = list(new)
-                return newbm
-            remote.ignorevisiblebranchmap = True
-            remote.branchmap = branchmap
-            remote.newbranchmap = branchmap
-        return orig(repo, remote, outgoing, *args, **kwargs)
-    finally:
-        remote.__dict__.pop('branchmap', None) # restore class one
-        remote.__dict__.pop('oldbranchmap', None)
-        remote.__dict__.pop('newbranchmap', None)
-        remote.__dict__.pop('ignorevisiblebranchmap', None)
-
-# eye are still burning
-def wrapvisiblebranchmap(orig, repo):
-    ignore = getattr(repo, 'ignorevisiblebranchmap', None)
-    if ignore is None:
-        return orig(repo)
-    elif ignore:
-        return repo.branchmap()
-    else:
-        return None # break recursion
+    return orig(repo, remote, outgoing, *args, **kwargs)
 
 def wrapclearcache(orig, repo, *args, **kwargs):
     try:
@@ -711,8 +653,6 @@
     extensions.wrapfunction(discovery, 'checkheads', wrapcheckheads)
     extensions.wrapfunction(discovery, 'visibleheads', noextinctsvisibleheads)
     extensions.wrapfunction(phases, 'advanceboundary', wrapclearcache)
-    if util.safehasattr(discovery, 'visiblebranchmap'):
-        extensions.wrapfunction(discovery, 'visiblebranchmap', wrapvisiblebranchmap)
 
 ### serialisation
 #############################