Mercurial > public > mercurial-scm > hg
diff mercurial/context.py @ 34556:7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
When clearing unknown files to remove path conflicts, also delete files that
conflict with the target file's path.
Differential Revision: https://phab.mercurial-scm.org/D785
author | Mark Thomas <mbthomas@fb.com> |
---|---|
date | Mon, 02 Oct 2017 14:05:30 -0700 |
parents | 99c3dee3f6ce |
children | 4dc8a2ee0f4f |
line wrap: on
line diff
--- a/mercurial/context.py Mon Oct 02 14:05:30 2017 -0700 +++ b/mercurial/context.py Mon Oct 02 14:05:30 2017 -0700 @@ -1933,8 +1933,13 @@ ``write()`` can be called successfully. """ wvfs = self._repo.wvfs - if wvfs.isdir(self._path) and not wvfs.islink(self._path): - wvfs.removedirs(self._path) + f = self._path + 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 def setflags(self, l, x): self._repo.wvfs.setflags(self._path, l, x)