# HG changeset patch # User Yuya Nishihara # Date 1503109413 -32400 # Node ID 252fb66ee5bbfab6dcd63f2fc1b75aa9eb33fd4d # Parent 4e8a46c25facaebca476634d52dd78431d3143e8 copies: use intersectmatchers() in non-merge p1 optimization This enables the optimization introduced by d4247c306d82 for non-rebase cases. Before, the match couldn't be narrowed if it was e.g. alwaysmatcher. The logic is copied from bd56bea5ecf8. diff -r 4e8a46c25fac -r 252fb66ee5bb mercurial/copies.py --- a/mercurial/copies.py Tue Aug 22 11:00:00 2017 +0200 +++ b/mercurial/copies.py Sat Aug 19 11:23:33 2017 +0900 @@ -10,6 +10,7 @@ import heapq from . import ( + match as matchmod, node, pathutil, scmutil, @@ -182,8 +183,9 @@ # optimization, since the ctx.files() for a merge commit is not correct for # this comparison. forwardmissingmatch = match - if not match and b.p1() == a and b.p2().node() == node.nullid: - forwardmissingmatch = scmutil.matchfiles(a._repo, b.files()) + if b.p1() == a and b.p2().node() == node.nullid: + filesmatcher = scmutil.matchfiles(a._repo, b.files()) + forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher) missing = _computeforwardmissing(a, b, match=forwardmissingmatch) ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)