[PATCH] copies: use intersectmatchers() in non-merge p1 optimization
Yuya Nishihara
yuya at tcha.org
Sat Aug 19 06:58:54 UTC 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1503109413 -32400
# Sat Aug 19 11:23:33 2017 +0900
# Node ID 57b175605401373c0c37bd9937a209676a734947
# Parent 6f6c87888b228948e202bd5967dc306bed56af7d
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 --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -10,6 +10,7 @@ from __future__ import absolute_import
import heapq
from . import (
+ match as matchmod,
node,
pathutil,
scmutil,
@@ -182,8 +183,9 @@ def _forwardcopies(a, b, match=None):
# 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)
More information about the Mercurial-devel
mailing list