Mercurial > hg
comparison mercurial/copies.py @ 33867:252fb66ee5bb
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 19 Aug 2017 11:23:33 +0900 |
parents | 42ad7cc645a4 |
children | 169baf3d1d3c |
comparison
equal
deleted
inserted
replaced
33866:4e8a46c25fac | 33867:252fb66ee5bb |
---|---|
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import heapq | 10 import heapq |
11 | 11 |
12 from . import ( | 12 from . import ( |
13 match as matchmod, | |
13 node, | 14 node, |
14 pathutil, | 15 pathutil, |
15 scmutil, | 16 scmutil, |
16 util, | 17 util, |
17 ) | 18 ) |
180 # case of computing what copies are in a commit versus its parent (like | 181 # case of computing what copies are in a commit versus its parent (like |
181 # during a rebase or histedit). Note, we exclude merge commits from this | 182 # during a rebase or histedit). Note, we exclude merge commits from this |
182 # optimization, since the ctx.files() for a merge commit is not correct for | 183 # optimization, since the ctx.files() for a merge commit is not correct for |
183 # this comparison. | 184 # this comparison. |
184 forwardmissingmatch = match | 185 forwardmissingmatch = match |
185 if not match and b.p1() == a and b.p2().node() == node.nullid: | 186 if b.p1() == a and b.p2().node() == node.nullid: |
186 forwardmissingmatch = scmutil.matchfiles(a._repo, b.files()) | 187 filesmatcher = scmutil.matchfiles(a._repo, b.files()) |
188 forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher) | |
187 missing = _computeforwardmissing(a, b, match=forwardmissingmatch) | 189 missing = _computeforwardmissing(a, b, match=forwardmissingmatch) |
188 | 190 |
189 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True) | 191 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True) |
190 for f in missing: | 192 for f in missing: |
191 fctx = b[f] | 193 fctx = b[f] |