# HG changeset patch # User Kevin Bullock <kbull...@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 _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel