Submitter | Kevin Bullock |
---|---|
Date | May 2, 2018, 8:31 p.m. |
Message ID | <bafcc443cd52382c5748.1525293112@ingalls.local> |
Download | mbox | patch |
Permalink | /patch/31254/ |
State | Accepted |
Headers | show |
Comments
LGTM, please deploy to end the torrent of cron mail ;) > On May 2, 2018, at 16:31, Kevin Bullock <kbullock+mercurial@ringworld.org> wrote: > > # HG changeset patch > # User Kevin Bullock <kbullock@ringworld.org> > # Date 1525292842 18000 > # Wed May 02 15:27:22 2018 -0500 > # Node ID bafcc443cd52382c574822bd4fef2f83141b10e1 > # Parent 335d45810dd93321242e7c329cf6d603a3aa7516 > land: fix JSON error when no accepted changes to land > > diff --git a/land b/land > --- a/land > +++ b/land > @@ -50,6 +50,9 @@ all_accepted = [n for n in cq.draft() if > acceptrange = collections.namedtuple('acceptrange', 'roots head') > > def accepted_ranges(all_accepted): > + if not all_accepted: > + return [] > + > accepted_revset = ' + '.join(all_accepted) > info = json.load(os.popen("hg log -R %s -r '%s' -Tjson" % ( > conf.source, accepted_revset))) > diff --git a/tests/test-land.t b/tests/test-land.t > --- a/tests/test-land.t > +++ b/tests/test-land.t > @@ -1,22 +1,6 @@ > $ . "$TESTDIR/lib.sh" > -BUG: Fails with no accepted nodes to land. > +Works correctly with no accepted nodes to land. > $ land > - hg: parse error: empty query > - Traceback (most recent call last): > - File "/Users/kbullock/Source/Projects/hg/accept/tests/../land", line 87, in <module> > - for r in accepted_ranges(all_accepted): > - File "/Users/kbullock/Source/Projects/hg/accept/tests/../land", line 53, in accepted_ranges > - conf.source, accepted_revset))) > - File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 290, in load > - **kw) > - File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads > - return _default_decoder.decode(s) > - File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode > - obj, end = self.raw_decode(s, idx=_w(s, 0).end()) > - File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode > - raise ValueError("No JSON object could be decoded") > - ValueError: No JSON object could be decoded > - [1] > > If only r2 is accepted, nothing happens. > $ echo `hg log -r 2 -R source --template '{node}'` > bob-accepted
Patch
diff --git a/land b/land --- a/land +++ b/land @@ -50,6 +50,9 @@ all_accepted = [n for n in cq.draft() if acceptrange = collections.namedtuple('acceptrange', 'roots head') def accepted_ranges(all_accepted): + if not all_accepted: + return [] + accepted_revset = ' + '.join(all_accepted) info = json.load(os.popen("hg log -R %s -r '%s' -Tjson" % ( conf.source, accepted_revset))) diff --git a/tests/test-land.t b/tests/test-land.t --- a/tests/test-land.t +++ b/tests/test-land.t @@ -1,22 +1,6 @@ $ . "$TESTDIR/lib.sh" -BUG: Fails with no accepted nodes to land. +Works correctly with no accepted nodes to land. $ land - hg: parse error: empty query - Traceback (most recent call last): - File "/Users/kbullock/Source/Projects/hg/accept/tests/../land", line 87, in <module> - for r in accepted_ranges(all_accepted): - File "/Users/kbullock/Source/Projects/hg/accept/tests/../land", line 53, in accepted_ranges - conf.source, accepted_revset))) - File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 290, in load - **kw) - File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads - return _default_decoder.decode(s) - File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode - obj, end = self.raw_decode(s, idx=_w(s, 0).end()) - File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode - raise ValueError("No JSON object could be decoded") - ValueError: No JSON object could be decoded - [1] If only r2 is accepted, nothing happens. $ echo `hg log -r 2 -R source --template '{node}'` > bob-accepted