Mercurial > public > mercurial-scm > hg
comparison mercurial/fileset.py @ 38881:dec16c0cce50
fileset: move copy constructor of matchctx near __init__
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 22 Jul 2018 19:43:57 +0900 |
parents | 80fd7371f2d8 |
children | ff42ec7845e4 |
comparison
equal
deleted
inserted
replaced
38880:80fd7371f2d8 | 38881:dec16c0cce50 |
---|---|
459 def __init__(self, basectx, ctx, badfn=None): | 459 def __init__(self, basectx, ctx, badfn=None): |
460 self._basectx = basectx | 460 self._basectx = basectx |
461 self.ctx = ctx | 461 self.ctx = ctx |
462 self._badfn = badfn | 462 self._badfn = badfn |
463 self._status = None | 463 self._status = None |
464 | |
465 def switch(self, basectx, ctx): | |
466 return matchctx(basectx, ctx, self._badfn) | |
464 | 467 |
465 def withstatus(self, keys): | 468 def withstatus(self, keys): |
466 """Create matchctx which has precomputed status specified by the keys""" | 469 """Create matchctx which has precomputed status specified by the keys""" |
467 mctx = matchctx(self._basectx, self.ctx, self._badfn) | 470 mctx = matchctx(self._basectx, self.ctx, self._badfn) |
468 mctx._buildstatus(keys) | 471 mctx._buildstatus(keys) |
526 """Create a matcher to select nothing""" | 529 """Create a matcher to select nothing""" |
527 repo = self.ctx.repo() | 530 repo = self.ctx.repo() |
528 return matchmod.nevermatcher(repo.root, repo.getcwd(), | 531 return matchmod.nevermatcher(repo.root, repo.getcwd(), |
529 badfn=self._badfn) | 532 badfn=self._badfn) |
530 | 533 |
531 def switch(self, basectx, ctx): | |
532 return matchctx(basectx, ctx, self._badfn) | |
533 | |
534 def match(ctx, expr, badfn=None): | 534 def match(ctx, expr, badfn=None): |
535 """Create a matcher for a single fileset expression""" | 535 """Create a matcher for a single fileset expression""" |
536 tree = filesetlang.parse(expr) | 536 tree = filesetlang.parse(expr) |
537 tree = filesetlang.analyze(tree) | 537 tree = filesetlang.analyze(tree) |
538 tree = filesetlang.optimize(tree) | 538 tree = filesetlang.optimize(tree) |