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