comparison mercurial/fileset.py @ 38686:131aae58a316

fileset: add "tracked()" to explicitly select files in the revision I'm going to rewrite filesets to be match predicates, which means basic patterns such as '*' will no longer be "closed" to the subset constructed from the ctx. Good thing is that 'hg status "set:not binary()"' can include unknown files out of the box, and fileset computation will likely to be faster as we won't have to walk dirstate twice, for example. Bad thing is that we can't select files at a certain revision by 'set:revs(REV, **)' since '**' is "open" to any paths. So, this patch introduces "tracked()" as a replacement for the '**' in the example above.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 10 Jun 2018 22:19:56 +0900
parents 80466fd85ac9
children 1500cbe22d53
comparison
equal deleted inserted replaced
38685:80466fd85ac9 38686:131aae58a316
282 # i18n: "clean" is a keyword 282 # i18n: "clean" is a keyword
283 getargs(x, 0, 0, _("clean takes no arguments")) 283 getargs(x, 0, 0, _("clean takes no arguments"))
284 s = set(mctx.status().clean) 284 s = set(mctx.status().clean)
285 return [f for f in mctx.subset if f in s] 285 return [f for f in mctx.subset if f in s]
286 286
287 @predicate('tracked()')
288 def tracked(mctx, x):
289 """File that is under Mercurial control."""
290 # i18n: "tracked" is a keyword
291 getargs(x, 0, 0, _("tracked takes no arguments"))
292 return [f for f in mctx.subset if f in mctx.ctx]
293
287 @predicate('binary()', callexisting=True) 294 @predicate('binary()', callexisting=True)
288 def binary(mctx, x): 295 def binary(mctx, x):
289 """File that appears to be binary (contains NUL bytes). 296 """File that appears to be binary (contains NUL bytes).
290 """ 297 """
291 # i18n: "binary" is a keyword 298 # i18n: "binary" is a keyword