comparison mercurial/revset.py @ 34034:96f249dce03e

revset: move order constants from revsetlang Thanks to the recent refactor, the ordering rule is fully processed at runtime.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 30 Aug 2017 22:32:47 +0900
parents 1b28525e6698
children 62cc1f17c571
comparison
equal deleted inserted replaced
34033:2d80e078724a 34034:96f249dce03e
38 getlist = revsetlang.getlist 38 getlist = revsetlang.getlist
39 getrange = revsetlang.getrange 39 getrange = revsetlang.getrange
40 getargs = revsetlang.getargs 40 getargs = revsetlang.getargs
41 getargsdict = revsetlang.getargsdict 41 getargsdict = revsetlang.getargsdict
42 42
43 # constants used as an argument of match() and matchany()
44 anyorder = revsetlang.anyorder
45 defineorder = revsetlang.defineorder
46 followorder = revsetlang.followorder
47
48 baseset = smartset.baseset 43 baseset = smartset.baseset
49 generatorset = smartset.generatorset 44 generatorset = smartset.generatorset
50 spanset = smartset.spanset 45 spanset = smartset.spanset
51 fullreposet = smartset.fullreposet 46 fullreposet = smartset.fullreposet
47
48 # Constants for ordering requirement, used in getset():
49 #
50 # If 'define', any nested functions and operations MAY change the ordering of
51 # the entries in the set (but if changes the ordering, it MUST ALWAYS change
52 # it). If 'follow', any nested functions and operations MUST take the ordering
53 # specified by the first operand to the '&' operator.
54 #
55 # For instance,
56 #
57 # X & (Y | Z)
58 # ^ ^^^^^^^
59 # | follow
60 # define
61 #
62 # will be evaluated as 'or(y(x()), z(x()))', where 'x()' can change the order
63 # of the entries in the set, but 'y()', 'z()' and 'or()' shouldn't.
64 #
65 # 'any' means the order doesn't matter. For instance,
66 #
67 # (X & Y) | ancestors(Z)
68 # ^ ^
69 # any any
70 #
71 # For 'X & Y', 'X' decides order so the order of 'Y' does not matter. For
72 # 'ancestors(Z)', Z's order does not matter since 'ancestors' does not care
73 # about the order of its argument.
74 #
75 # Currently, most revsets do not care about the order, so 'define' is
76 # equivalent to 'follow' for them, and the resulting order is based on the
77 # 'subset' parameter passed down to them:
78 #
79 # m = revset.match(..., order=defineorder)
80 # m(repo, subset)
81 # ^^^^^^
82 # For most revsets, 'define' means using the order this subset provides
83 #
84 # There are a few revsets that always redefine the order if 'define' is
85 # specified: 'sort(X)', 'reverse(X)', 'x:y'.
86 anyorder = 'any' # don't care the order, could be even random-shuffled
87 defineorder = 'define' # ALWAYS redefine, or ALWAYS follow the current order
88 followorder = 'follow' # MUST follow the current order
52 89
53 # helpers 90 # helpers
54 91
55 def getset(repo, subset, x, order=defineorder): 92 def getset(repo, subset, x, order=defineorder):
56 if not x: 93 if not x: