# HG changeset patch # User Matt Harbison # Date 1412298648 14400 # Node ID c8750f4388c8d8ef9daef415d06f3e4938a6fa5c # Parent 1a39b1b8e0926325dcc81650bd00760bbc1730c6 evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea diff -r 1a39b1b8e092 -r c8750f4388c8 hgext/evolve.py --- a/hgext/evolve.py Wed Oct 08 18:17:21 2014 -0700 +++ b/hgext/evolve.py Thu Oct 02 21:10:48 2014 -0400 @@ -611,28 +611,21 @@ ui.warn(_('%i new divergent changesets\n') % newdivergents) return ret -@eh.reposetup -def _repostabilizesetup(ui, repo): +@eh.wrapfunction(mercurial.exchange, 'push') +def push(orig, repo, *args, **opts): """Add a hint for "hg evolve" when troubles make push fails """ - if not repo.local(): - return - - class evolvingrepo(repo.__class__): - def push(self, remote, *args, **opts): - """wrapper around pull that pull obsolete relation""" - try: - result = super(evolvingrepo, self).push(remote, *args, **opts) - except util.Abort, ex: - hint = _("use 'hg evolve' to get a stable history " - "or --force to ignore warnings") - if (len(ex.args) >= 1 - and ex.args[0].startswith('push includes ') - and ex.hint is None): - ex.hint = hint - raise - return result - repo.__class__ = evolvingrepo + try: + return orig(repo, *args, **opts) + except util.Abort, ex: + hint = _("use 'hg evolve' to get a stable history " + "or --force to ignore warnings") + if (len(ex.args) >= 1 + and ex.args[0].startswith('push includes ') + and ex.hint is None): + ex.hint = hint + raise + return result def summaryhook(ui, repo): def write(fmt, count):