comparison mercurial/cmdutil.py @ 21878:e2530d4a47c1

log: use an exact matcher for --patch --follow The arguments to log --patch --follow are expected to be exact paths. This will be used to make manifest filtering for these cases more efficient in upcoming patches.
author Siddharth Agarwal <sid0@fb.com>
date Sat, 12 Jul 2014 18:31:18 -0700
parents dbbae63865a6
children e582e20cd3e6
comparison
equal deleted inserted replaced
21877:dbbae63865a6 21878:e2530d4a47c1
1497 # and relating linkrevs to file names (which is not "correct" but 1497 # and relating linkrevs to file names (which is not "correct" but
1498 # good enough). 1498 # good enough).
1499 fcache = {} 1499 fcache = {}
1500 fcacheready = [False] 1500 fcacheready = [False]
1501 pctx = repo['.'] 1501 pctx = repo['.']
1502 wctx = repo[None]
1503 1502
1504 def populate(): 1503 def populate():
1505 for fn in files: 1504 for fn in files:
1506 for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)): 1505 for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
1507 for c in i: 1506 for c in i:
1510 def filematcher(rev): 1509 def filematcher(rev):
1511 if not fcacheready[0]: 1510 if not fcacheready[0]:
1512 # Lazy initialization 1511 # Lazy initialization
1513 fcacheready[0] = True 1512 fcacheready[0] = True
1514 populate() 1513 populate()
1515 return scmutil.match(wctx, fcache.get(rev, []), default='path') 1514 return scmutil.matchfiles(repo, fcache.get(rev, []))
1516 1515
1517 return filematcher 1516 return filematcher
1518 1517
1519 def _makelogrevset(repo, pats, opts, revs): 1518 def _makelogrevset(repo, pats, opts, revs):
1520 """Return (expr, filematcher) where expr is a revset string built 1519 """Return (expr, filematcher) where expr is a revset string built