Mercurial > evolve
changeset 463:3f91654713dd
obsolete Move merge failure handling into stabilize code
This violate less Layer. For this purpose we crate an easy to recognize
Exception Class.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Mon, 20 Aug 2012 12:25:08 +0200 |
parents | d38e02332c2c |
children | d88c761f97c4 |
files | hgext/evolve.py |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py Mon Aug 20 22:18:10 2012 +0200 +++ b/hgext/evolve.py Mon Aug 20 12:25:08 2012 +0200 @@ -131,6 +131,9 @@ return newid, created +class MergeFailure(util.Abort): + pass + def relocate(repo, orig, dest): """rewrite <rev> on dest""" try: @@ -152,10 +155,10 @@ try: nodenew = rebase.concludenode(repo, orig.node(), dest.node(), node.nullid) - except util.Abort: - repo.ui.write_err(_('/!\\ stabilize failed /!\\\n')) - repo.ui.write_err(_('/!\\ Their is no "hg stabilize --continue" /!\\\n')) - repo.ui.write_err(_('/!\\ use "hg up -C . ; hg stabilize --dry-run" /!\\\n')) + except util.Abort, exc: + class LocalMergeFailure(MergeFailure, exc.__class__): + pass + exc.__class__ = LocalMergeFailure raise oldbookmarks = repo.nodebookmarks(nodesrc) obsolete = extensions.find('obsolete') @@ -286,6 +289,11 @@ lock = repo.lock() try: relocate(repo, node, target) + except MergeFailure: + repo.ui.write_err(_('/!\\ stabilize failed /!\\\n')) + repo.ui.write_err(_('/!\\ Their is no "hg stabilize --continue" /!\\\n')) + repo.ui.write_err(_('/!\\ use "hg up -C . ; hg stabilize --dry-run" /!\\\n')) + raise finally: lock.release()