hgext/obsolete.py
changeset 377 1d6cc8c22cd9
parent 361 ac7969043677
parent 376 188afb394e10
child 378 0313cb49fa1a
--- a/hgext/obsolete.py	Tue Jul 17 19:49:08 2012 +0200
+++ b/hgext/obsolete.py	Wed Jul 25 17:53:17 2012 +0200
@@ -455,19 +455,18 @@
         # checking heads only is enought because any thing base on obsolete
         # changeset is either obsolete or unstable.
         ctx =  repo[h]
-        hint = _("use 'hg stabilize' to get a stable history (or --force to proceed)")
         if ctx.unstable():
-            raise util.Abort(_("Trying to push unstable changeset: %s!") % ctx,
-                             hint=hint)
+            raise util.Abort(_("push includes an unstable changeset: %s!")
+                             % ctx)
         if ctx.obsolete():
-            raise util.Abort(_("Trying to push obsolete changeset: %s!") % ctx,
-                             hint=hint)
+            raise util.Abort(_("push includes an  obsolete changeset: %s!")
+                             % ctx)
         if ctx.latecomer():
-            raise util.Abort(_("Trying to push latecomer changeset: %s!") % ctx,
-                             hint=hint)
+            raise util.Abort(_("push includes an latecomer changeset: %s!")
+                             % ctx)
         if ctx.conflicting():
-            raise util.Abort(_("Trying to push conflicting changeset: %s!") % ctx,
-                             hint=hint)
+            raise util.Abort(_("push includes conflicting changeset: %s!")
+                             % ctx)
     ### patch remote branch map
     # do not read it this burn eyes
     try:
@@ -960,7 +959,15 @@
         def push(self, remote, *args, **opts):
             """wrapper around pull that pull obsolete relation"""
             self._turn_extinct_secret()
-            result = opush(remote, *args, **opts)
+            try:
+                result = opush(remote, *args, **opts)
+            except util.Abort, ex:
+                hint = _("use 'hg stabilize' to get a stable history (or --force to proceed)")
+                if (len(ex.args) >= 1
+                    and ex.args[0].startswith('push includes ')
+                    and ex.hint is None):
+                    ex.hint = hint
+                raise
             self._turn_extinct_secret()
             return result