changeset 376:188afb394e10 stable

obsolete: move hint punching to push Core does not raise the warning in check heads
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 25 Jul 2012 17:43:38 +0200
parents 1525b240d806
children 1d6cc8c22cd9 822e5305e377
files hgext/obsolete.py
diffstat 1 files changed, 25 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Wed Jul 25 17:40:50 2012 +0200
+++ b/hgext/obsolete.py	Wed Jul 25 17:43:38 2012 +0200
@@ -487,30 +487,22 @@
     * patch remote to ignore obsolete heads on remote
     """
     # do not push instability
-    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 (len(ex.args) >= 1
-            and ex.args[0].startswith('push includes ')
-            and ex.hint is None):
-            ex.hint = hint
-        raise
+    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)
     ### patch remote branch map
     # do not read it this burn eyes
     try:
@@ -1208,7 +1200,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
             if 'obsolete' in remote.listkeys('namespaces') and self.obsstore:
                 data = self.obsstore._writemarkers()
                 r = remote.pushkey('obsolete', 'dump', '',