# HG changeset patch # User Yuya Nishihara # Date 1523103822 -32400 # Node ID bbd240f81ac5e59bdab9060a5743a3073a41e048 # Parent c0d0fd87ba7c81f40b8071f174ab174a8c8ce969 procutil: make explainexit() simply return a message (API) Almost all callers want it. diff -r c0d0fd87ba7c -r bbd240f81ac5 hgext/bugzilla.py --- 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): diff -r c0d0fd87ba7c -r bbd240f81ac5 hgext/convert/common.py --- 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): diff -r c0d0fd87ba7c -r bbd240f81ac5 mercurial/hook.py --- 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)) diff -r c0d0fd87ba7c -r bbd240f81ac5 mercurial/mail.py --- 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''' diff -r c0d0fd87ba7c -r bbd240f81ac5 mercurial/patch.py --- 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, diff -r c0d0fd87ba7c -r bbd240f81ac5 mercurial/scmutil.py --- 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 diff -r c0d0fd87ba7c -r bbd240f81ac5 mercurial/ui.py --- 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) diff -r c0d0fd87ba7c -r bbd240f81ac5 mercurial/utils/procutil.py --- 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: