diff -r 80c86b9bb40b -r 5f56a3b9675e mercurial/revset.py --- a/mercurial/revset.py Wed Jun 01 20:54:04 2016 +0900 +++ b/mercurial/revset.py Tue May 03 12:52:50 2016 +0900 @@ -378,12 +378,12 @@ r = spanset(repo, m, n + 1) else: r = spanset(repo, m, n - 1) - # XXX We should combine with subset first: 'subset & baseset(...)'. This is - # necessary to ensure we preserve the order in subset. - # - # This has performance implication, carrying the sorting over when possible - # would be more efficient. - return r & subset + + if order == defineorder: + return r & subset + else: + # carrying the sorting over when possible would be more efficient + return subset & r def dagrange(repo, subset, x, y, order): r = fullreposet(repo)