comparison mercurial/cmdutil.py @ 23500:9601229ed361 stable

log: fix log -f slow path to actually follow history The revset created when -f was used with a slow path (for patterns and directories) did not actually contain any logic to enforce follow. Instead it was depending on the passed in subset to already be limited (which was limited to :. but not ::.). This fixes it by adding a '& ::.' to any -f log revset. hg log -f <file> is still broken, in that it can return results that aren't actually ancestors of the current file, but fixing that has major perf implications, so we'll deal with it later.
author Durham Goode <durham@fb.com>
date Fri, 05 Dec 2014 14:27:32 -0800
parents edf29f9c15f0
children 424d669118d3
comparison
equal deleted inserted replaced
23478:30b602168c3b 23500:9601229ed361
1743 if path == '.' or path in repo.store: 1743 if path == '.' or path in repo.store:
1744 break 1744 break
1745 else: 1745 else:
1746 slowpath = False 1746 slowpath = False
1747 1747
1748 fpats = ('_patsfollow', '_patsfollowfirst')
1749 fnopats = (('_ancestors', '_fancestors'),
1750 ('_descendants', '_fdescendants'))
1748 if slowpath: 1751 if slowpath:
1749 # See walkchangerevs() slow path. 1752 # See walkchangerevs() slow path.
1750 # 1753 #
1751 # pats/include/exclude cannot be represented as separate 1754 # pats/include/exclude cannot be represented as separate
1752 # revset expressions as their filtering logic applies at file 1755 # revset expressions as their filtering logic applies at file
1761 matchargs.append('i:' + p) 1764 matchargs.append('i:' + p)
1762 for p in opts.get('exclude', []): 1765 for p in opts.get('exclude', []):
1763 matchargs.append('x:' + p) 1766 matchargs.append('x:' + p)
1764 matchargs = ','.join(('%r' % p) for p in matchargs) 1767 matchargs = ','.join(('%r' % p) for p in matchargs)
1765 opts['_matchfiles'] = matchargs 1768 opts['_matchfiles'] = matchargs
1769 if follow:
1770 opts[fnopats[0][followfirst]] = '.'
1766 else: 1771 else:
1767 if follow: 1772 if follow:
1768 fpats = ('_patsfollow', '_patsfollowfirst')
1769 fnopats = (('_ancestors', '_fancestors'),
1770 ('_descendants', '_fdescendants'))
1771 if pats: 1773 if pats:
1772 # follow() revset interprets its file argument as a 1774 # follow() revset interprets its file argument as a
1773 # manifest entry, so use match.files(), not pats. 1775 # manifest entry, so use match.files(), not pats.
1774 opts[fpats[followfirst]] = list(match.files()) 1776 opts[fpats[followfirst]] = list(match.files())
1775 else: 1777 else: