mercurial/cmdutil.py
changeset 21877 dbbae63865a6
parent 21872 abae1eb695c0
parent 21876 584bbfd1b50d
child 21878 e2530d4a47c1
equal deleted inserted replaced
21875:33020e87f8c5 21877:dbbae63865a6
  1486             if stopiteration:
  1486             if stopiteration:
  1487                 break
  1487                 break
  1488 
  1488 
  1489     return iterate()
  1489     return iterate()
  1490 
  1490 
  1491 def _makelogfilematcher(repo, pats, followfirst):
  1491 def _makelogfilematcher(repo, files, followfirst):
  1492     # When displaying a revision with --patch --follow FILE, we have
  1492     # When displaying a revision with --patch --follow FILE, we have
  1493     # to know which file of the revision must be diffed. With
  1493     # to know which file of the revision must be diffed. With
  1494     # --follow, we want the names of the ancestors of FILE in the
  1494     # --follow, we want the names of the ancestors of FILE in the
  1495     # revision, stored in "fcache". "fcache" is populated by
  1495     # revision, stored in "fcache". "fcache" is populated by
  1496     # reproducing the graph traversal already done by --follow revset
  1496     # reproducing the graph traversal already done by --follow revset
  1500     fcacheready = [False]
  1500     fcacheready = [False]
  1501     pctx = repo['.']
  1501     pctx = repo['.']
  1502     wctx = repo[None]
  1502     wctx = repo[None]
  1503 
  1503 
  1504     def populate():
  1504     def populate():
  1505         for fn in pats:
  1505         for fn in files:
  1506             for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
  1506             for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
  1507                 for c in i:
  1507                 for c in i:
  1508                     fcache.setdefault(c.linkrev(), set()).add(c.path())
  1508                     fcache.setdefault(c.linkrev(), set()).add(c.path())
  1509 
  1509 
  1510     def filematcher(rev):
  1510     def filematcher(rev):
  1625             opts['_patslog'] = list(pats)
  1625             opts['_patslog'] = list(pats)
  1626 
  1626 
  1627     filematcher = None
  1627     filematcher = None
  1628     if opts.get('patch') or opts.get('stat'):
  1628     if opts.get('patch') or opts.get('stat'):
  1629         if follow:
  1629         if follow:
  1630             filematcher = _makelogfilematcher(repo, pats, followfirst)
  1630             # _makelogfilematcher expects its files argument to be relative to
       
  1631             # the repo root, so use match.files(), not pats.
       
  1632             filematcher = _makelogfilematcher(repo, match.files(), followfirst)
  1631         else:
  1633         else:
  1632             filematcher = lambda rev: match
  1634             filematcher = lambda rev: match
  1633 
  1635 
  1634     expr = []
  1636     expr = []
  1635     for op, val in opts.iteritems():
  1637     for op, val in opts.iteritems():