Mercurial > hg
changeset 521:0fb8ade0f756
[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-----
author | mpm@selenic.com |
---|---|
date | Wed, 29 Jun 2005 11:16:41 -0800 |
parents | 12b4b5612fe4 |
children | 2f1de824798a |
files | mercurial/util.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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):