comparison mercurial/context.py @ 34833:07bbb208a924

context: audit paths before clearing unknown files and dirs Fix regression introduced in D785. In some circumstances, context.clearunknown can be called before the path is audited. Audit the path before deleting any conflicting files. Differential Revision: https://phab.mercurial-scm.org/D1157
author Mark Thomas <mbthomas@fb.com>
date Tue, 17 Oct 2017 08:11:13 -0700
parents 754b5117622f
children 14c87708f432
comparison
equal deleted inserted replaced
34832:d6009d1488e8 34833:07bbb208a924
1944 """Removes conflicting items in the working directory so that 1944 """Removes conflicting items in the working directory so that
1945 ``write()`` can be called successfully. 1945 ``write()`` can be called successfully.
1946 """ 1946 """
1947 wvfs = self._repo.wvfs 1947 wvfs = self._repo.wvfs
1948 f = self._path 1948 f = self._path
1949 wvfs.audit(f)
1949 if wvfs.isdir(f) and not wvfs.islink(f): 1950 if wvfs.isdir(f) and not wvfs.islink(f):
1950 wvfs.rmtree(f, forcibly=True) 1951 wvfs.rmtree(f, forcibly=True)
1951 for p in reversed(list(util.finddirs(f))): 1952 for p in reversed(list(util.finddirs(f))):
1952 if wvfs.isfileorlink(p): 1953 if wvfs.isfileorlink(p):
1953 wvfs.unlink(p) 1954 wvfs.unlink(p)