comparison hgext/lfs/__init__.py @ 38689:ff5b6fca1082

fileset: rewrite predicates to return matcher not closed to subset (API) (BC) This makes fileset expression open to any input, so that we can just say "hg status 'set: not binary()'" to select text files including unknowns. With this and removal of subset computation, 'set:**' becomes as fast as 'glob:**'. Further optimization will probably be possible by narrowing the file tree to compute status for example. This also fixes 'subrepo()' to not ignore the current mctx.subset. .. bc:: The fileset expression may include untracked files by default. Use ``tracked()`` to explicitly filter out files not existing at the context revision.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 09 Jun 2018 19:55:10 +0900
parents b4d85bc122bd
children 7790cd70842a 535fc8a22365
comparison
equal deleted inserted replaced
38688:2570dca0f21c 38689:ff5b6fca1082
360 @filesetpredicate('lfs()', callstatus=True) 360 @filesetpredicate('lfs()', callstatus=True)
361 def lfsfileset(mctx, x): 361 def lfsfileset(mctx, x):
362 """File that uses LFS storage.""" 362 """File that uses LFS storage."""
363 # i18n: "lfs" is a keyword 363 # i18n: "lfs" is a keyword
364 fileset.getargs(x, 0, 0, _("lfs takes no arguments")) 364 fileset.getargs(x, 0, 0, _("lfs takes no arguments"))
365 return [f for f in mctx.subset 365 ctx = mctx.ctx
366 if wrapper.pointerfromctx(mctx.ctx, f, removed=True) is not None] 366 def lfsfilep(f):
367 return wrapper.pointerfromctx(ctx, f, removed=True) is not None
368 return mctx.predicate(lfsfilep, predrepr='<lfs>')
367 369
368 @templatekeyword('lfs_files', requires={'ctx'}) 370 @templatekeyword('lfs_files', requires={'ctx'})
369 def lfsfiles(context, mapping): 371 def lfsfiles(context, mapping):
370 """List of strings. All files modified, added, or removed by this 372 """List of strings. All files modified, added, or removed by this
371 changeset.""" 373 changeset."""