Mercurial > hg
comparison mercurial/fileset.py @ 38879:e79a69af1593
fileset: insert hints where status should be computed
This will allow us to compute status against a narrowed set of files.
For example, "path:build/ & (unknown() + missing())" is rewritten as
"path:build/ & <withstatus>(unknown() + missing(), 'unknown missing')",
and the status call can be narrowed by the left-hand-side matcher,
"path:build/".
mctx.buildstatus() calls will be solely processed by getmatchwithstatus().
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 21 Jul 2018 20:27:53 +0900 |
parents | 0f56d08e6271 |
children | 80fd7371f2d8 |
comparison
equal
deleted
inserted
replaced
38878:0f56d08e6271 | 38879:e79a69af1593 |
---|---|
40 | 40 |
41 def getmatch(mctx, x): | 41 def getmatch(mctx, x): |
42 if not x: | 42 if not x: |
43 raise error.ParseError(_("missing argument")) | 43 raise error.ParseError(_("missing argument")) |
44 return methods[x[0]](mctx, *x[1:]) | 44 return methods[x[0]](mctx, *x[1:]) |
45 | |
46 def getmatchwithstatus(mctx, x, hint): | |
47 return getmatch(mctx, x) | |
45 | 48 |
46 def stringmatch(mctx, x): | 49 def stringmatch(mctx, x): |
47 return mctx.matcher([x]) | 50 return mctx.matcher([x]) |
48 | 51 |
49 def kindpatmatch(mctx, x, y): | 52 def kindpatmatch(mctx, x, y): |
441 predrepr=('subrepo(%r)', pat)) | 444 predrepr=('subrepo(%r)', pat)) |
442 else: | 445 else: |
443 return mctx.predicate(sstate.__contains__, predrepr='subrepo') | 446 return mctx.predicate(sstate.__contains__, predrepr='subrepo') |
444 | 447 |
445 methods = { | 448 methods = { |
449 'withstatus': getmatchwithstatus, | |
446 'string': stringmatch, | 450 'string': stringmatch, |
447 'symbol': stringmatch, | 451 'symbol': stringmatch, |
448 'kindpat': kindpatmatch, | 452 'kindpat': kindpatmatch, |
449 'patterns': patternsmatch, | 453 'patterns': patternsmatch, |
450 'and': andmatch, | 454 'and': andmatch, |