##// END OF EJS Templates
merge: skip syntactic path checks in [_checkunknownfile]...
Arseniy Alekseyev -
r50804:b7cf91ef default
parent child Browse files
Show More
@@ -46,7 +46,7 b' def _getcheckunknownconfig(repo, section'
46 return config
46 return config
47
47
48
48
49 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
49 def _checkunknownfile(repo, 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,7 b' def _checkunknownfile(repo, wctx, mctx, '
58 if f2 is None:
58 if f2 is None:
59 f2 = f
59 f2 = f
60 return (
60 return (
61 repo.wvfs.audit.check(f)
61 repo.wvfs.isfileorlink_checkdir(dircache, f)
62 and repo.wvfs.isfileorlink(f)
63 and repo.dirstate.normalize(f) not in repo.dirstate
62 and repo.dirstate.normalize(f) not in repo.dirstate
64 and mctx[f2].cmp(wctx[f])
63 and mctx[f2].cmp(wctx[f])
65 )
64 )
@@ -136,6 +135,7 b' def _checkunknownfiles(repo, wctx, mctx,'
136 pathconfig = repo.ui.configbool(
135 pathconfig = repo.ui.configbool(
137 b'experimental', b'merge.checkpathconflicts'
136 b'experimental', b'merge.checkpathconflicts'
138 )
137 )
138 dircache = dict()
139 if not force:
139 if not force:
140
140
141 def collectconflicts(conflicts, config):
141 def collectconflicts(conflicts, config):
@@ -145,19 +145,18 b' def _checkunknownfiles(repo, wctx, mctx,'
145 warnconflicts.update(conflicts)
145 warnconflicts.update(conflicts)
146
146
147 checkunknowndirs = _unknowndirschecker()
147 checkunknowndirs = _unknowndirschecker()
148 with repo.wvfs.audit.cached():
148 for f in mresult.files(
149 for f in mresult.files(
149 (
150 (
150 mergestatemod.ACTION_CREATED,
151 mergestatemod.ACTION_CREATED,
151 mergestatemod.ACTION_DELETED_CHANGED,
152 mergestatemod.ACTION_DELETED_CHANGED,
152 )
153 )
153 ):
154 ):
154 if _checkunknownfile(repo, dircache, wctx, mctx, f):
155 if _checkunknownfile(repo, wctx, mctx, f):
155 fileconflicts.add(f)
156 fileconflicts.add(f)
156 elif pathconfig and f not in wctx:
157 elif pathconfig and f not in wctx:
157 path = checkunknowndirs(repo, wctx, f)
158 path = checkunknowndirs(repo, wctx, f)
158 if path is not None:
159 if path is not None:
159 pathconflicts.add(path)
160 pathconflicts.add(path)
161 for f, args, msg in mresult.getactions(
160 for f, args, msg in mresult.getactions(
162 [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
161 [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
163 ):
162 ):
@@ -422,6 +422,25 b' class vfs(abstractvfs):'
422 raise error.Abort(b"%s: %r" % (r, path))
422 raise error.Abort(b"%s: %r" % (r, path))
423 self.audit(path, mode=mode)
423 self.audit(path, mode=mode)
424
424
425 def isfileorlink_checkdir(
426 self, dircache, path: Optional[bytes] = None
427 ) -> bool:
428 """return True if the path is a regular file or a symlink and
429 the directories along the path are "normal", that is
430 not symlinks or nested hg repositories."""
431 try:
432 for prefix in pathutil.finddirs_rev_noroot(util.localpath(path)):
433 if prefix in dircache:
434 res = dircache[prefix]
435 else:
436 res = self.audit._checkfs_exists(prefix, path)
437 dircache[prefix] = res
438 if not res:
439 return False
440 except (OSError, error.Abort):
441 return False
442 return self.isfileorlink(path)
443
425 def __call__(
444 def __call__(
426 self,
445 self,
427 path: bytes,
446 path: bytes,
General Comments 0
You need to be logged in to leave comments. Login now