mercurial/revsetlang.py
changeset 34016 96f249dce03e
parent 34012 dcfdf4d09663
child 34020 37b82485097f
equal deleted inserted replaced
34015:2d80e078724a 34016:96f249dce03e
   255     is also None. Use _isnamedfunc() instead.
   255     is also None. Use _isnamedfunc() instead.
   256     """
   256     """
   257     if not _isnamedfunc(x, funcname):
   257     if not _isnamedfunc(x, funcname):
   258         return
   258         return
   259     return x[2]
   259     return x[2]
   260 
       
   261 # Constants for ordering requirement, used in getset():
       
   262 #
       
   263 # If 'define', any nested functions and operations MAY change the ordering of
       
   264 # the entries in the set (but if changes the ordering, it MUST ALWAYS change
       
   265 # it). If 'follow', any nested functions and operations MUST take the ordering
       
   266 # specified by the first operand to the '&' operator.
       
   267 #
       
   268 # For instance,
       
   269 #
       
   270 #   X & (Y | Z)
       
   271 #   ^   ^^^^^^^
       
   272 #   |   follow
       
   273 #   define
       
   274 #
       
   275 # will be evaluated as 'or(y(x()), z(x()))', where 'x()' can change the order
       
   276 # of the entries in the set, but 'y()', 'z()' and 'or()' shouldn't.
       
   277 #
       
   278 # 'any' means the order doesn't matter. For instance,
       
   279 #
       
   280 #   (X & Y) | ancestors(Z)
       
   281 #        ^              ^
       
   282 #        any            any
       
   283 #
       
   284 # For 'X & Y', 'X' decides order so the order of 'Y' does not matter. For
       
   285 # 'ancestors(Z)', Z's order does not matter since 'ancestors' does not care
       
   286 # about the order of its argument.
       
   287 #
       
   288 # Currently, most revsets do not care about the order, so 'define' is
       
   289 # equivalent to 'follow' for them, and the resulting order is based on the
       
   290 # 'subset' parameter passed down to them:
       
   291 #
       
   292 #   m = revset.match(..., order=defineorder)
       
   293 #   m(repo, subset)
       
   294 #           ^^^^^^
       
   295 #      For most revsets, 'define' means using the order this subset provides
       
   296 #
       
   297 # There are a few revsets that always redefine the order if 'define' is
       
   298 # specified: 'sort(X)', 'reverse(X)', 'x:y'.
       
   299 anyorder = 'any'        # don't care the order, could be even random-shuffled
       
   300 defineorder = 'define'  # ALWAYS redefine, or ALWAYS follow the current order
       
   301 followorder = 'follow'  # MUST follow the current order
       
   302 
   260 
   303 def _matchonly(revs, bases):
   261 def _matchonly(revs, bases):
   304     """
   262     """
   305     >>> f = lambda *args: _matchonly(*map(parse, args))
   263     >>> f = lambda *args: _matchonly(*map(parse, args))
   306     >>> f('ancestors(A)', 'not ancestors(B)')
   264     >>> f('ancestors(A)', 'not ancestors(B)')