comparison mercurial/cmdutil.py @ 22173:d3702a822241

merge with stable
author Matt Mackall <mpm@selenic.com>
date Thu, 14 Aug 2014 16:25:47 -0500
parents 03a45eff9d2b d4bc38f6eab7
children afead12e724b
comparison
equal deleted inserted replaced
22165:3ddfb9b3fdc6 22173:d3702a822241
1498 if stopiteration: 1498 if stopiteration:
1499 break 1499 break
1500 1500
1501 return iterate() 1501 return iterate()
1502 1502
1503 def _makelogfilematcher(repo, files, followfirst): 1503 def _makefollowlogfilematcher(repo, files, followfirst):
1504 # When displaying a revision with --patch --follow FILE, we have 1504 # When displaying a revision with --patch --follow FILE, we have
1505 # to know which file of the revision must be diffed. With 1505 # to know which file of the revision must be diffed. With
1506 # --follow, we want the names of the ancestors of FILE in the 1506 # --follow, we want the names of the ancestors of FILE in the
1507 # revision, stored in "fcache". "fcache" is populated by 1507 # revision, stored in "fcache". "fcache" is populated by
1508 # reproducing the graph traversal already done by --follow revset 1508 # reproducing the graph traversal already done by --follow revset
1524 fcacheready[0] = True 1524 fcacheready[0] = True
1525 populate() 1525 populate()
1526 return scmutil.matchfiles(repo, fcache.get(rev, [])) 1526 return scmutil.matchfiles(repo, fcache.get(rev, []))
1527 1527
1528 return filematcher 1528 return filematcher
1529
1530 def _makenofollowlogfilematcher(repo, pats, opts):
1531 '''hook for extensions to override the filematcher for non-follow cases'''
1532 return None
1529 1533
1530 def _makelogrevset(repo, pats, opts, revs): 1534 def _makelogrevset(repo, pats, opts, revs):
1531 """Return (expr, filematcher) where expr is a revset string built 1535 """Return (expr, filematcher) where expr is a revset string built
1532 from log options and file patterns or None. If --stat or --patch 1536 from log options and file patterns or None. If --stat or --patch
1533 are not passed filematcher is None. Otherwise it is a callable 1537 are not passed filematcher is None. Otherwise it is a callable
1644 # If we're forced to take the slowpath it means we're following 1648 # If we're forced to take the slowpath it means we're following
1645 # at least one pattern/directory, so don't bother with rename tracking. 1649 # at least one pattern/directory, so don't bother with rename tracking.
1646 if follow and not match.always() and not slowpath: 1650 if follow and not match.always() and not slowpath:
1647 # _makelogfilematcher expects its files argument to be relative to 1651 # _makelogfilematcher expects its files argument to be relative to
1648 # the repo root, so use match.files(), not pats. 1652 # the repo root, so use match.files(), not pats.
1649 filematcher = _makelogfilematcher(repo, match.files(), followfirst) 1653 filematcher = _makefollowlogfilematcher(repo, match.files(),
1654 followfirst)
1650 else: 1655 else:
1651 filematcher = lambda rev: match 1656 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
1657 if filematcher is None:
1658 filematcher = lambda rev: match
1652 1659
1653 expr = [] 1660 expr = []
1654 for op, val in opts.iteritems(): 1661 for op, val in opts.iteritems():
1655 if not val: 1662 if not val:
1656 continue 1663 continue