# HG changeset patch # User Yuya Nishihara # Date 1465990644 -32400 # Node ID ec75d77df9d7730b83c716799a05cf26b23b5565 # Parent 8a080faba2eb8670dcf99d804869f8f0ee720e32 revset: fix crash on empty sort key Make it noop as before 2188f170f5b6. We could change it to an error, but allowing empty key makes some sense for scripting that builds a key string programmatically. diff -r 8a080faba2eb -r ec75d77df9d7 mercurial/revset.py --- a/mercurial/revset.py Mon Jun 13 22:41:45 2016 +0100 +++ b/mercurial/revset.py Wed Jun 15 20:37:24 2016 +0900 @@ -1890,6 +1890,8 @@ 'topo.firstbranch can only be used when using the topo sort ' 'key')) + if not keys: + return revs if keys == ["rev"]: revs.sort() return revs diff -r 8a080faba2eb -r ec75d77df9d7 tests/test-revset.t --- a/tests/test-revset.t Mon Jun 13 22:41:45 2016 +0100 +++ b/tests/test-revset.t Wed Jun 15 20:37:24 2016 +0900 @@ -962,6 +962,13 @@ 6 2 +test empty sort key which is noop + + $ log 'sort(0 + 2 + 1, "")' + 0 + 2 + 1 + test invalid sort keys $ log 'sort(all(), -invalid)'