diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1890,6 +1890,8 @@ def sort(repo, subset, x): '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 --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -962,6 +962,13 @@ test sorting two sorted collections in d 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)'