comparison mercurial/context.py @ 38493:da2a7d8354b2

unlinkpath: make empty directory removal optional (issue5901) (issue5826) There are known cases where performing operations such as rebase from a directory that is newly created can fail or at least lead to being in a directory handle that no longer exists. This is even reproducible by just doing something as simple as: cd foo; hg rm * The behavior is different if you use `hg addremove`, the directory is not removed until we attempt to go back to the node after committing it: cd foo; rm *; hg addremove; hg ci -m'bye foo'; hg co .^; hg co tip Differential Revision: https://phab.mercurial-scm.org/D3859
author Kyle Lippincott <spectral@google.com>
date Thu, 28 Jun 2018 18:07:22 -0700
parents aaed058a0390
children 4455e5d4d59c
comparison
equal deleted inserted replaced
38492:2394cd58b81f 38493:da2a7d8354b2
1705 # invert comparison to reuse the same code path 1705 # invert comparison to reuse the same code path
1706 return fctx.cmp(self) 1706 return fctx.cmp(self)
1707 1707
1708 def remove(self, ignoremissing=False): 1708 def remove(self, ignoremissing=False):
1709 """wraps unlink for a repo's working directory""" 1709 """wraps unlink for a repo's working directory"""
1710 self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing) 1710 rmdir = self._repo.ui.configbool('experimental', 'removeemptydirs')
1711 self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing,
1712 rmdir=rmdir)
1711 1713
1712 def write(self, data, flags, backgroundclose=False, **kwargs): 1714 def write(self, data, flags, backgroundclose=False, **kwargs):
1713 """wraps repo.wwrite""" 1715 """wraps repo.wwrite"""
1714 self._repo.wwrite(self._path, data, flags, 1716 self._repo.wwrite(self._path, data, flags,
1715 backgroundclose=backgroundclose, 1717 backgroundclose=backgroundclose,