1743 ``write()`` can be called successfully. |
1743 ``write()`` can be called successfully. |
1744 """ |
1744 """ |
1745 wvfs = self._repo.wvfs |
1745 wvfs = self._repo.wvfs |
1746 f = self._path |
1746 f = self._path |
1747 wvfs.audit(f) |
1747 wvfs.audit(f) |
1748 if wvfs.isdir(f) and not wvfs.islink(f): |
|
1749 wvfs.rmtree(f, forcibly=True) |
|
1750 if self._repo.ui.configbool('experimental', 'merge.checkpathconflicts'): |
1748 if self._repo.ui.configbool('experimental', 'merge.checkpathconflicts'): |
|
1749 # remove files under the directory as they should already be |
|
1750 # warned and backed up |
|
1751 if wvfs.isdir(f) and not wvfs.islink(f): |
|
1752 wvfs.rmtree(f, forcibly=True) |
1751 for p in reversed(list(util.finddirs(f))): |
1753 for p in reversed(list(util.finddirs(f))): |
1752 if wvfs.isfileorlink(p): |
1754 if wvfs.isfileorlink(p): |
1753 wvfs.unlink(p) |
1755 wvfs.unlink(p) |
1754 break |
1756 break |
|
1757 else: |
|
1758 # don't remove files if path conflicts are not processed |
|
1759 if wvfs.isdir(f) and not wvfs.islink(f): |
|
1760 wvfs.removedirs(f) |
1755 |
1761 |
1756 def setflags(self, l, x): |
1762 def setflags(self, l, x): |
1757 self._repo.wvfs.setflags(self._path, l, x) |
1763 self._repo.wvfs.setflags(self._path, l, x) |
1758 |
1764 |
1759 class overlayworkingctx(committablectx): |
1765 class overlayworkingctx(committablectx): |