Commits

Pierre-Yves David committed 3f91654

obsolete Move merge failure handling into stabilize code

This violate less Layer. For this purpose we crate an easy to recognize
Exception Class.

Comments (0)

Files changed (1)

 
     return newid, created
 
+class MergeFailure(util.Abort):
+    pass
+
 def relocate(repo, orig, dest):
     """rewrite <rev> on dest"""
     try:
         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')
         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()