##// END OF EJS Templates
revset: make sort() noop depending on ordering requirement (BC)...
Yuya Nishihara -
r29946:285a8c3e default
parent child Browse files
Show More
@@ -1901,8 +1901,8 b' def _getsortargs(x):'
1901
1901
1902 return args['set'], keyflags, opts
1902 return args['set'], keyflags, opts
1903
1903
1904 @predicate('sort(set[, [-]key... [, ...]])', safe=True)
1904 @predicate('sort(set[, [-]key... [, ...]])', safe=True, takeorder=True)
1905 def sort(repo, subset, x):
1905 def sort(repo, subset, x, order):
1906 """Sort set by keys. The default sort order is ascending, specify a key
1906 """Sort set by keys. The default sort order is ascending, specify a key
1907 as ``-key`` to sort in descending order.
1907 as ``-key`` to sort in descending order.
1908
1908
@@ -1923,7 +1923,7 b' def sort(repo, subset, x):'
1923 s, keyflags, opts = _getsortargs(x)
1923 s, keyflags, opts = _getsortargs(x)
1924 revs = getset(repo, subset, s)
1924 revs = getset(repo, subset, s)
1925
1925
1926 if not keyflags:
1926 if not keyflags or order != defineorder:
1927 return revs
1927 return revs
1928 if len(keyflags) == 1 and keyflags[0][0] == "rev":
1928 if len(keyflags) == 1 and keyflags[0][0] == "rev":
1929 revs.sort(reverse=keyflags[0][1])
1929 revs.sort(reverse=keyflags[0][1])
@@ -1633,12 +1633,20 b' ordering defined by it.'
1633 define)
1633 define)
1634 * set:
1634 * set:
1635 <filteredset
1635 <filteredset
1636 <spanset- 0:2>,
1636 <spanset+ 0:2>,
1637 <spanset+ 0:9>>
1637 <spanset+ 0:9>>
1638 0
1639 1
1638 2
1640 2
1639 1
1641
1640 0
1642 invalid argument passed to noop sort():
1641 BROKEN: should be '0 1 2'
1643
1644 $ log '0:2 & sort()'
1645 hg: parse error: sort requires one or two arguments
1646 [255]
1647 $ log '0:2 & sort(all(), -invalid)'
1648 hg: parse error: unknown sort key '-invalid'
1649 [255]
1642
1650
1643 for 'A & f(B)', 'B' should not be affected by the order of 'A':
1651 for 'A & f(B)', 'B' should not be affected by the order of 'A':
1644
1652
General Comments 0
You need to be logged in to leave comments. Login now