diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1808,10 +1808,11 @@ class workingfilectx(committablefilectx) wvfs.audit(f) if wvfs.isdir(f) and not wvfs.islink(f): wvfs.rmtree(f, forcibly=True) - for p in reversed(list(util.finddirs(f))): - if wvfs.isfileorlink(p): - wvfs.unlink(p) - break + if self._repo.ui.configbool('experimental', 'merge.checkpathconflicts'): + for p in reversed(list(util.finddirs(f))): + if wvfs.isfileorlink(p): + wvfs.unlink(p) + break def setflags(self, l, x): self._repo.wvfs.setflags(self._path, l, x) diff --git a/tests/test-audit-path.t b/tests/test-audit-path.t --- a/tests/test-audit-path.t +++ b/tests/test-audit-path.t @@ -109,8 +109,7 @@ attack back/test where back symlinks to #else ('back' will be a file and cause some other system specific error) $ hg update -Cr2 - back: is both a file and a directory - abort: * (glob) + abort: $TESTTMP/target/back/test: $ENOTDIR$ [255] #endif