diff mercurial/commands.py @ 3550:eda9e7c9300d

New UnexpectedOutput exception to catch server errors in localrepo.stream_in If the unexpected is a string, the empty string will be mentioned, and long strings are cut to at most 400 chars.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 27 Oct 2006 18:17:12 +0200
parents db946221a58a
children 23f7d9621783
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3522,6 +3522,15 @@ def dispatch(args):
             u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
         else:
             u.warn(_("abort: %s\n") % inst.strerror)
+    except util.UnexpectedOutput, inst:
+        u.warn(_("abort: %s") % inst[0])
+        if not isinstance(inst[1], basestring):
+            u.warn(" %r\n" % (inst[1],))
+        elif not inst[1]:
+            u.warn(_(" empty string\n"))
+        else:
+            u.warn("\n%r%s\n" %
+                    (inst[1][:400], len(inst[1]) > 400 and '...' or ''))
     except util.Abort, inst:
         u.warn(_("abort: %s\n") % inst)
     except TypeError, inst: