##// END OF EJS Templates
merge: avoid dereferencing repo fields repeatedly
Arseniy Alekseyev -
r50805:7b474609 default
parent child Browse files
Show More
@@ -511,10 +511,12 b' def overridedebugstate(orig, ui, repo, *'
511 # largefiles. This makes the merge proceed and we can then handle this
511 # largefiles. This makes the merge proceed and we can then handle this
512 # case further in the overridden calculateupdates function below.
512 # case further in the overridden calculateupdates function below.
513 @eh.wrapfunction(merge, b'_checkunknownfile')
513 @eh.wrapfunction(merge, b'_checkunknownfile')
514 def overridecheckunknownfile(origfn, repo, wctx, mctx, f, f2=None):
514 def overridecheckunknownfile(
515 if lfutil.standin(repo.dirstate.normalize(f)) in wctx:
515 origfn, dirstate, wvfs, dircache, wctx, mctx, f, f2=None
516 ):
517 if lfutil.standin(dirstate.normalize(f)) in wctx:
516 return False
518 return False
517 return origfn(repo, wctx, mctx, f, f2)
519 return origfn(dirstate, wvfs, dircache, wctx, mctx, f, f2)
518
520
519
521
520 # The manifest merge handles conflicts on the manifest level. We want
522 # The manifest merge handles conflicts on the manifest level. We want
@@ -46,7 +46,7 b' def _getcheckunknownconfig(repo, section'
46 return config
46 return config
47
47
48
48
49 def _checkunknownfile(repo, dircache, wctx, mctx, f, f2=None):
49 def _checkunknownfile(dirstate, wvfs, dircache, wctx, mctx, f, f2=None):
50 if wctx.isinmemory():
50 if wctx.isinmemory():
51 # Nothing to do in IMM because nothing in the "working copy" can be an
51 # Nothing to do in IMM because nothing in the "working copy" can be an
52 # unknown file.
52 # unknown file.
@@ -58,8 +58,8 b' def _checkunknownfile(repo, dircache, wc'
58 if f2 is None:
58 if f2 is None:
59 f2 = f
59 f2 = f
60 return (
60 return (
61 repo.wvfs.isfileorlink_checkdir(dircache, f)
61 wvfs.isfileorlink_checkdir(dircache, f)
62 and repo.dirstate.normalize(f) not in repo.dirstate
62 and dirstate.normalize(f) not in dirstate
63 and mctx[f2].cmp(wctx[f])
63 and mctx[f2].cmp(wctx[f])
64 )
64 )
65
65
@@ -136,6 +136,8 b' def _checkunknownfiles(repo, wctx, mctx,'
136 b'experimental', b'merge.checkpathconflicts'
136 b'experimental', b'merge.checkpathconflicts'
137 )
137 )
138 dircache = dict()
138 dircache = dict()
139 dirstate = repo.dirstate
140 wvfs = repo.wvfs
139 if not force:
141 if not force:
140
142
141 def collectconflicts(conflicts, config):
143 def collectconflicts(conflicts, config):
@@ -151,7 +153,7 b' def _checkunknownfiles(repo, wctx, mctx,'
151 mergestatemod.ACTION_DELETED_CHANGED,
153 mergestatemod.ACTION_DELETED_CHANGED,
152 )
154 )
153 ):
155 ):
154 if _checkunknownfile(repo, dircache, wctx, mctx, f):
156 if _checkunknownfile(dirstate, wvfs, dircache, wctx, mctx, f):
155 fileconflicts.add(f)
157 fileconflicts.add(f)
156 elif pathconfig and f not in wctx:
158 elif pathconfig and f not in wctx:
157 path = checkunknowndirs(repo, wctx, f)
159 path = checkunknowndirs(repo, wctx, f)
@@ -160,7 +162,9 b' def _checkunknownfiles(repo, wctx, mctx,'
160 for f, args, msg in mresult.getactions(
162 for f, args, msg in mresult.getactions(
161 [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
163 [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
162 ):
164 ):
163 if _checkunknownfile(repo, wctx, mctx, f, args[0]):
165 if _checkunknownfile(
166 dirstate, wvfs, dircache, wctx, mctx, f, args[0]
167 ):
164 fileconflicts.add(f)
168 fileconflicts.add(f)
165
169
166 allconflicts = fileconflicts | pathconflicts
170 allconflicts = fileconflicts | pathconflicts
@@ -173,7 +177,9 b' def _checkunknownfiles(repo, wctx, mctx,'
173 mresult.getactions([mergestatemod.ACTION_CREATED_MERGE])
177 mresult.getactions([mergestatemod.ACTION_CREATED_MERGE])
174 ):
178 ):
175 fl2, anc = args
179 fl2, anc = args
176 different = _checkunknownfile(repo, wctx, mctx, f)
180 different = _checkunknownfile(
181 dirstate, wvfs, dircache, wctx, mctx, f
182 )
177 if repo.dirstate._ignore(f):
183 if repo.dirstate._ignore(f):
178 config = ignoredconfig
184 config = ignoredconfig
179 else:
185 else:
General Comments 0
You need to be logged in to leave comments. Login now