Patchwork dispatch: don't clamp the range of the exit code twice

login
register
mail settings
Submitter Kevin Bullock
Date March 4, 2018, 12:09 a.m.
Message ID <53daf5db6dada7eade4d.1520122180@ingalls.local>
Download mbox | patch
Permalink /patch/28887/
State Accepted
Headers show

Comments

Kevin Bullock - March 4, 2018, 12:09 a.m.
# HG changeset patch
# User Kevin Bullock <kbullock+mercurial@ringworld.org>
# Date 1520121770 18000
#      Sat Mar 03 19:02:50 2018 -0500
# Node ID 53daf5db6dada7eade4de6d4c328b78feb0425cf
# Parent  c1af0dc644d4c109efee03786aca819a8ac7775c
dispatch: don't clamp the range of the exit code twice

We already limit the range to (0, 255) in the call to sys.exit(). The
duplicated operation can't possibly be hurting us, but let's clean it up
to avoid confusion.
Yuya Nishihara - March 4, 2018, 12:11 p.m.
On Sat, 03 Mar 2018 19:09:40 -0500, Kevin Bullock wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock+mercurial@ringworld.org>
> # Date 1520121770 18000
> #      Sat Mar 03 19:02:50 2018 -0500
> # Node ID 53daf5db6dada7eade4de6d4c328b78feb0425cf
> # Parent  c1af0dc644d4c109efee03786aca819a8ac7775c
> dispatch: don't clamp the range of the exit code twice

Queued, thanks.

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -85,7 +85,7 @@  def run():
     req = request(pycompat.sysargv[1:])
     err = None
     try:
-        status = (dispatch(req) or 0) & 255
+        status = (dispatch(req) or 0)
     except error.StdioError as e:
         err = e
         status = -1