# HG changeset patch # User Pierre-Yves David # Date 1343236040 -7200 # Node ID 58fdb2180064695b4624b6609078748ac7bb353f # Parent 3a161a89d65d78874b7f7dbbd19f1e0a3c704c20 Use the core check heads mecanism to prevent zaelous warning diff -r 3a161a89d65d -r 58fdb2180064 hgext/obsolete.py --- 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 #############################