# HG changeset patch # User Pierre-Yves David # Date 1345458308 -7200 # Node ID 3f91654713dde9a7020a5d4599cba14f9fd9865f # Parent d38e02332c2cd96d05e7d8d5fd8c9eb8daea53ea obsolete Move merge failure handling into stabilize code This violate less Layer. For this purpose we crate an easy to recognize Exception Class. diff -r d38e02332c2c -r 3f91654713dd hgext/evolve.py --- 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 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()