Mercurial > hg-stable
changeset 37463:bbd240f81ac5
procutil: make explainexit() simply return a message (API)
Almost all callers want it.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 07 Apr 2018 21:23:42 +0900 |
parents | c0d0fd87ba7c |
children | 632b92899203 |
files | hgext/bugzilla.py hgext/convert/common.py mercurial/hook.py mercurial/mail.py mercurial/patch.py mercurial/scmutil.py mercurial/ui.py mercurial/utils/procutil.py |
diffstat | 8 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bugzilla.py Sat Apr 07 21:21:03 2018 +0900 +++ b/hgext/bugzilla.py Sat Apr 07 21:23:42 2018 +0900 @@ -534,7 +534,7 @@ if ret: self.ui.warn(out) raise error.Abort(_('bugzilla notify command %s') % - procutil.explainexit(ret)[0]) + procutil.explainexit(ret)) self.ui.status(_('done\n')) def get_user_id(self, user):
--- a/hgext/convert/common.py Sat Apr 07 21:21:03 2018 +0900 +++ b/hgext/convert/common.py Sat Apr 07 21:23:42 2018 +0900 @@ -440,7 +440,7 @@ if output: self.ui.warn(_('%s error:\n') % self.command) self.ui.warn(output) - msg = procutil.explainexit(status)[0] + msg = procutil.explainexit(status) raise error.Abort('%s %s' % (self.command, msg)) def run0(self, cmd, *args, **kwargs):
--- a/mercurial/hook.py Sat Apr 07 21:21:03 2018 +0900 +++ b/mercurial/hook.py Sat Apr 07 21:23:42 2018 +0900 @@ -154,7 +154,7 @@ ui.log('exthook', 'exthook-%s: %s finished in %0.2f seconds\n', name, cmd, duration) if r: - desc, r = procutil.explainexit(r) + desc = procutil.explainexit(r) if throw: raise error.HookAbort(_('%s hook %s') % (name, desc)) ui.warn(_('warning: %s hook %s\n') % (name, desc))
--- a/mercurial/mail.py Sat Apr 07 21:21:03 2018 +0900 +++ b/mercurial/mail.py Sat Apr 07 21:23:42 2018 +0900 @@ -150,7 +150,7 @@ if ret: raise error.Abort('%s %s' % ( os.path.basename(program.split(None, 1)[0]), - procutil.explainexit(ret)[0])) + procutil.explainexit(ret))) def _mbox(mbox, sender, recipients, msg): '''write mails to mbox'''
--- a/mercurial/patch.py Sat Apr 07 21:21:03 2018 +0900 +++ b/mercurial/patch.py Sat Apr 07 21:23:42 2018 +0900 @@ -2133,7 +2133,7 @@ code = fp.close() if code: raise PatchError(_("patch command failed: %s") % - procutil.explainexit(code)[0]) + procutil.explainexit(code)) return fuzz def patchbackend(ui, backend, patchobj, strip, prefix, files=None,
--- a/mercurial/scmutil.py Sat Apr 07 21:21:03 2018 +0900 +++ b/mercurial/scmutil.py Sat Apr 07 21:23:42 2018 +0900 @@ -1173,7 +1173,7 @@ src.close() if proc and proc.returncode != 0: raise error.Abort(_("extdata command '%s' failed: %s") - % (cmd, procutil.explainexit(proc.returncode)[0])) + % (cmd, procutil.explainexit(proc.returncode))) return data
--- a/mercurial/ui.py Sat Apr 07 21:21:03 2018 +0900 +++ b/mercurial/ui.py Sat Apr 07 21:23:42 2018 +0900 @@ -1501,7 +1501,7 @@ rc = self._runsystem(cmd, environ=environ, cwd=cwd, out=out) if rc and onerr: errmsg = '%s %s' % (os.path.basename(cmd.split(None, 1)[0]), - procutil.explainexit(rc)[0]) + procutil.explainexit(rc)) if errprefix: errmsg = '%s: %s' % (errprefix, errmsg) raise onerr(errmsg)
--- a/mercurial/utils/procutil.py Sat Apr 07 21:21:03 2018 +0900 +++ b/mercurial/utils/procutil.py Sat Apr 07 21:23:42 2018 +0900 @@ -79,11 +79,11 @@ closefds = pycompat.isposix def explainexit(code): - """return a 2-tuple (desc, code) describing a subprocess status + """return a message describing a subprocess status (codes from kill are negative - not os.system/wait encoding)""" if code >= 0: - return _("exited with status %d") % code, code - return _("killed by signal %d") % -code, code + return _("exited with status %d") % code + return _("killed by signal %d") % -code class _pfile(object): """File-like wrapper for a stream opened by subprocess.Popen()""" @@ -179,7 +179,7 @@ code = 0 if code: raise error.Abort(_("command '%s' failed: %s") % - (cmd, explainexit(code)[0])) + (cmd, explainexit(code))) with open(outname, 'rb') as fp: return fp.read() finally: