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.
--- 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
--- 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)'