Mercurial > evolve
comparison hgext/evolve.py @ 1122:c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 02 Oct 2014 21:10:48 -0400 |
parents | 9bc4857f573b |
children | aabb145058d7 |
comparison
equal
deleted
inserted
replaced
1121:1a39b1b8e092 | 1122:c8750f4388c8 |
---|---|
609 ui.warn(_('%i new bumped changesets\n') % newbumpeds) | 609 ui.warn(_('%i new bumped changesets\n') % newbumpeds) |
610 if newdivergents > 0: | 610 if newdivergents > 0: |
611 ui.warn(_('%i new divergent changesets\n') % newdivergents) | 611 ui.warn(_('%i new divergent changesets\n') % newdivergents) |
612 return ret | 612 return ret |
613 | 613 |
614 @eh.reposetup | 614 @eh.wrapfunction(mercurial.exchange, 'push') |
615 def _repostabilizesetup(ui, repo): | 615 def push(orig, repo, *args, **opts): |
616 """Add a hint for "hg evolve" when troubles make push fails | 616 """Add a hint for "hg evolve" when troubles make push fails |
617 """ | 617 """ |
618 if not repo.local(): | 618 try: |
619 return | 619 return orig(repo, *args, **opts) |
620 | 620 except util.Abort, ex: |
621 class evolvingrepo(repo.__class__): | 621 hint = _("use 'hg evolve' to get a stable history " |
622 def push(self, remote, *args, **opts): | 622 "or --force to ignore warnings") |
623 """wrapper around pull that pull obsolete relation""" | 623 if (len(ex.args) >= 1 |
624 try: | 624 and ex.args[0].startswith('push includes ') |
625 result = super(evolvingrepo, self).push(remote, *args, **opts) | 625 and ex.hint is None): |
626 except util.Abort, ex: | 626 ex.hint = hint |
627 hint = _("use 'hg evolve' to get a stable history " | 627 raise |
628 "or --force to ignore warnings") | 628 return result |
629 if (len(ex.args) >= 1 | |
630 and ex.args[0].startswith('push includes ') | |
631 and ex.hint is None): | |
632 ex.hint = hint | |
633 raise | |
634 return result | |
635 repo.__class__ = evolvingrepo | |
636 | 629 |
637 def summaryhook(ui, repo): | 630 def summaryhook(ui, repo): |
638 def write(fmt, count): | 631 def write(fmt, count): |
639 s = fmt % count | 632 s = fmt % count |
640 if count: | 633 if count: |