# HG changeset patch # User Yuya Nishihara # Date 1599915298 -32400 # Node ID c11099cc1de47df03d8818cd0aa2a6fee0588578 # Parent fb000408bca56283f01fc8a27aa27457b1cbd2db log: map --removed to walkopts.force_changelog_traversal This is the flag to forcibly enable the slowpath. I'm not sure if the slowpath parameter should be merged with this flag, so let's keep it as an immutable flag for now. I'll add another flag to support "grep --all-files". These two will be the flags which aren't directly mapped from the command-line options. diff -r fb000408bca5 -r c11099cc1de4 mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py Fri Sep 25 14:33:05 2020 +0200 +++ b/mercurial/logcmdutil.py Sat Sep 12 21:54:58 2020 +0900 @@ -693,6 +693,10 @@ # 0: no follow, 1: follow first, 2: follow both parents follow = attr.ib(default=0) # type: int + # do not attempt filelog-based traversal, which may be fast but cannot + # include revisions where files were removed + force_changelog_traversal = attr.ib(default=False) # type: bool + # limit number of changes displayed; None means unlimited limit = attr.ib(default=None) # type: Optional[int] @@ -715,6 +719,7 @@ opts=opts, revspec=opts.get(b'rev', []), follow=follow, + force_changelog_traversal=bool(opts.get(b'removed')), limit=getlimit(opts), ) @@ -736,7 +741,7 @@ wctx = repo[None] match, pats = scmutil.matchandpats(wctx, wopts.pats, wopts.opts) slowpath = match.anypats() or ( - not match.always() and wopts.opts.get(b'removed') + not match.always() and wopts.force_changelog_traversal ) if not slowpath: if wopts.follow and wopts.revspec: @@ -923,6 +928,7 @@ revs = _initialrevs(repo, wopts) if not revs: return smartset.baseset(), None + # TODO: might want to merge slowpath with wopts.force_changelog_traversal match, pats, slowpath = _makematcher(repo, revs, wopts) wopts = attr.evolve(wopts, pats=pats) @@ -931,6 +937,7 @@ if slowpath or match.always(): revs = dagop.revancestors(repo, revs, followfirst=wopts.follow == 1) else: + assert not wopts.force_changelog_traversal revs, filematcher = _fileancestors( repo, revs, match, followfirst=wopts.follow == 1 )