mercurial/cmdutil.py
branchstable
changeset 21876 584bbfd1b50d
parent 21825 3666331164bb
child 21877 dbbae63865a6
equal deleted inserted replaced
21868:3420346174b1 21876:584bbfd1b50d
  1455             if stopiteration:
  1455             if stopiteration:
  1456                 break
  1456                 break
  1457 
  1457 
  1458     return iterate()
  1458     return iterate()
  1459 
  1459 
  1460 def _makelogfilematcher(repo, pats, followfirst):
  1460 def _makelogfilematcher(repo, files, followfirst):
  1461     # When displaying a revision with --patch --follow FILE, we have
  1461     # When displaying a revision with --patch --follow FILE, we have
  1462     # to know which file of the revision must be diffed. With
  1462     # to know which file of the revision must be diffed. With
  1463     # --follow, we want the names of the ancestors of FILE in the
  1463     # --follow, we want the names of the ancestors of FILE in the
  1464     # revision, stored in "fcache". "fcache" is populated by
  1464     # revision, stored in "fcache". "fcache" is populated by
  1465     # reproducing the graph traversal already done by --follow revset
  1465     # reproducing the graph traversal already done by --follow revset
  1469     fcacheready = [False]
  1469     fcacheready = [False]
  1470     pctx = repo['.']
  1470     pctx = repo['.']
  1471     wctx = repo[None]
  1471     wctx = repo[None]
  1472 
  1472 
  1473     def populate():
  1473     def populate():
  1474         for fn in pats:
  1474         for fn in files:
  1475             for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
  1475             for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
  1476                 for c in i:
  1476                 for c in i:
  1477                     fcache.setdefault(c.linkrev(), set()).add(c.path())
  1477                     fcache.setdefault(c.linkrev(), set()).add(c.path())
  1478 
  1478 
  1479     def filematcher(rev):
  1479     def filematcher(rev):
  1594             opts['_patslog'] = list(pats)
  1594             opts['_patslog'] = list(pats)
  1595 
  1595 
  1596     filematcher = None
  1596     filematcher = None
  1597     if opts.get('patch') or opts.get('stat'):
  1597     if opts.get('patch') or opts.get('stat'):
  1598         if follow:
  1598         if follow:
  1599             filematcher = _makelogfilematcher(repo, pats, followfirst)
  1599             # _makelogfilematcher expects its files argument to be relative to
       
  1600             # the repo root, so use match.files(), not pats.
       
  1601             filematcher = _makelogfilematcher(repo, match.files(), followfirst)
  1600         else:
  1602         else:
  1601             filematcher = lambda rev: match
  1603             filematcher = lambda rev: match
  1602 
  1604 
  1603     expr = []
  1605     expr = []
  1604     for op, val in opts.iteritems():
  1606     for op, val in opts.iteritems():