[PATCH] Fix use of util.CommandError
authormpm@selenic.com
Wed, 29 Jun 2005 11:16:41 -0800
changeset 521 0fb8ade0f756
parent 520 12b4b5612fe4
child 522 2f1de824798a
[PATCH] Fix use of util.CommandError -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Fix use of util.CommandError From: Bryan O'Sullivan <bos@serpentine.com> Fix CommandError so error messages don't say "abort: abort: ...". manifest hash: 2aea4c8043d321882dcdf846a42a55403ce1086f -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCwvOZywK+sNU5EO8RAqF/AJ9IIr6JPPUc15tb7w4lnI7yMFxSmgCfQUYn OX7Uz7G3dJNRIjAxJtGwCLo= =xj/W -----END PGP SIGNATURE-----
mercurial/util.py
--- a/mercurial/util.py	Wed Jun 29 11:12:50 2005 -0800
+++ b/mercurial/util.py	Wed Jun 29 11:16:41 2005 -0800
@@ -22,12 +22,14 @@
         return "stopped by signal %d" % val, val
     raise ValueError("invalid exit code")
 
-def system(cmd, errprefix = "abort"):
+def system(cmd, errprefix=None):
     """execute a shell command that must succeed"""
     rc = os.system(cmd)
     if rc:
-        errmsg = "%s: %s %s" % (errprefix, os.path.basename(cmd.split(None, 1)[0]),
-                                explain_exit(rc)[0])
+        errmsg = "%s %s" % (os.path.basename(cmd.split(None, 1)[0]),
+                            explain_exit(rc)[0])
+        if errprefix:
+            errmsg = "%s: %s" % (errprefix, errmsg)
         raise CommandError(errmsg)
 
 def rename(src, dst):