Pierre-Yves David avatar Pierre-Yves David committed 1525b24

obsolete: doc punch the hint about hg stabilize into the push error message.

The goal is to ease the transposition of to default where half of the message
may be raised by core directly.

Comments (0)

Files changed (1)

hgext/obsolete.py

     * patch remote to ignore obsolete heads on remote
     """
     # do not push instability
-    for h in outgoing.missingheads:
-        # checking heads only is enought because any thing base on obsolete
-        # changeset is either obsolete or unstable.
-        ctx =  repo[h]
+    try:
+        for h in outgoing.missingheads:
+            # checking heads only is enought because any thing base on obsolete
+            # changeset is either obsolete or unstable.
+            ctx =  repo[h]
+            if ctx.unstable():
+                raise util.Abort(_("push includes an unstable changeset: %s!")
+                                 % ctx)
+            if ctx.obsolete():
+                raise util.Abort(_("push includes an  obsolete changeset: %s!")
+                                 % ctx)
+            if ctx.latecomer():
+                raise util.Abort(_("push includes an latecomer changeset: %s!")
+                                 % ctx)
+            if ctx.conflicting():
+                raise util.Abort(_("push includes conflicting changeset: %s!")
+                                 % ctx)
+    except util.Abort, ex:
         hint = _("use 'hg stabilize' to get a stable history (or --force to proceed)")
-        if ctx.unstable():
-            raise util.Abort(_("push includes an unstable changeset: %s!") % ctx,
-                             hint=hint)
-        if ctx.obsolete():
-            raise util.Abort(_("push includes an  obsolete changeset: %s!") % ctx,
-                             hint=hint)
-        if ctx.latecomer():
-            raise util.Abort(_("push includes an latecomer changeset: %s!") % ctx,
-                             hint=hint)
-        if ctx.conflicting():
-            raise util.Abort(_("push includes conflicting changeset: %s!") % ctx,
-                             hint=hint)
+        if (len(ex.args) >= 1
+            and ex.args[0].startswith('push includes ')
+            and ex.hint is None):
+            ex.hint = hint
+        raise
     ### patch remote branch map
     # do not read it this burn eyes
     try:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.