comparison mercurial/fileset.py @ 27024:ceef5fb14872

fileset: add missing() predicate (issue4925) Help of status cmd defines status file of 'missing', what is called in fileset 'deleted'. To stay consistent this patch introduces missing() predicate which in fact is alias to 'deleted'.
author liscju <piotr.listkiewicz@gmail.com>
date Wed, 18 Nov 2015 20:55:32 +0100
parents d5a6be56970b
children 2f15253e415f
comparison
equal deleted inserted replaced
27023:0c8ef79b9fd7 27024:ceef5fb14872
157 s = mctx.status().removed 157 s = mctx.status().removed
158 return [f for f in mctx.subset if f in s] 158 return [f for f in mctx.subset if f in s]
159 159
160 def deleted(mctx, x): 160 def deleted(mctx, x):
161 """``deleted()`` 161 """``deleted()``
162 File that is deleted according to :hg:`status`. 162 Alias for ``missing()``.
163 """ 163 """
164 # i18n: "deleted" is a keyword 164 # i18n: "deleted" is a keyword
165 getargs(x, 0, 0, _("deleted takes no arguments")) 165 getargs(x, 0, 0, _("deleted takes no arguments"))
166 s = mctx.status().deleted
167 return [f for f in mctx.subset if f in s]
168
169 def missing(mctx, x):
170 """``missing()``
171 File that is missing according to :hg:`status`.
172 """
173 # i18n: "missing" is a keyword
174 getargs(x, 0, 0, _("missing takes no arguments"))
166 s = mctx.status().deleted 175 s = mctx.status().deleted
167 return [f for f in mctx.subset if f in s] 176 return [f for f in mctx.subset if f in s]
168 177
169 def unknown(mctx, x): 178 def unknown(mctx, x):
170 """``unknown()`` 179 """``unknown()``
439 'eol': eol, 448 'eol': eol,
440 'exec': exec_, 449 'exec': exec_,
441 'grep': grep, 450 'grep': grep,
442 'ignored': ignored, 451 'ignored': ignored,
443 'hgignore': hgignore, 452 'hgignore': hgignore,
453 'missing': missing,
444 'modified': modified, 454 'modified': modified,
445 'portable': portable, 455 'portable': portable,
446 'removed': removed, 456 'removed': removed,
447 'resolved': resolved, 457 'resolved': resolved,
448 'size': size, 458 'size': size,
509 def getfileset(ctx, expr): 519 def getfileset(ctx, expr):
510 tree = parse(expr) 520 tree = parse(expr)
511 521
512 # do we need status info? 522 # do we need status info?
513 if (_intree(['modified', 'added', 'removed', 'deleted', 523 if (_intree(['modified', 'added', 'removed', 'deleted',
514 'unknown', 'ignored', 'clean'], tree) or 524 'missing', 'unknown', 'ignored', 'clean'], tree) or
515 # Using matchctx.existing() on a workingctx requires us to check 525 # Using matchctx.existing() on a workingctx requires us to check
516 # for deleted files. 526 # for deleted files.
517 (ctx.rev() is None and _intree(_existingcallers, tree))): 527 (ctx.rev() is None and _intree(_existingcallers, tree))):
518 unknown = _intree(['unknown'], tree) 528 unknown = _intree(['unknown'], tree)
519 ignored = _intree(['ignored'], tree) 529 ignored = _intree(['ignored'], tree)