comparison 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
comparison
equal deleted inserted replaced
34555:989e884d1be9 34556:7a8a16f8ea22
1931 def clearunknown(self): 1931 def clearunknown(self):
1932 """Removes conflicting items in the working directory so that 1932 """Removes conflicting items in the working directory so that
1933 ``write()`` can be called successfully. 1933 ``write()`` can be called successfully.
1934 """ 1934 """
1935 wvfs = self._repo.wvfs 1935 wvfs = self._repo.wvfs
1936 if wvfs.isdir(self._path) and not wvfs.islink(self._path): 1936 f = self._path
1937 wvfs.removedirs(self._path) 1937 if wvfs.isdir(f) and not wvfs.islink(f):
1938 wvfs.rmtree(f, forcibly=True)
1939 for p in reversed(list(util.finddirs(f))):
1940 if wvfs.isfileorlink(p):
1941 wvfs.unlink(p)
1942 break
1938 1943
1939 def setflags(self, l, x): 1944 def setflags(self, l, x):
1940 self._repo.wvfs.setflags(self._path, l, x) 1945 self._repo.wvfs.setflags(self._path, l, x)
1941 1946
1942 class overlayworkingctx(workingctx): 1947 class overlayworkingctx(workingctx):