comparison mercurial/context.py @ 14420:137b03b5aea1

workingctx: unlink paths while holding the wlock
author Adrian Buehlmann <adrian@cadifra.com>
date Tue, 24 May 2011 14:08:20 +0200
parents 81e6d42b3228
children c4c5e3802e9c
comparison
equal deleted inserted replaced
14419:ede7cea1550f 14420:137b03b5aea1
850 for a in self._repo.changelog.ancestors( 850 for a in self._repo.changelog.ancestors(
851 *[p.rev() for p in self._parents]): 851 *[p.rev() for p in self._parents]):
852 yield changectx(self._repo, a) 852 yield changectx(self._repo, a)
853 853
854 def remove(self, list, unlink=False): 854 def remove(self, list, unlink=False):
855 if unlink:
856 for f in list:
857 try:
858 util.unlinkpath(self._repo.wjoin(f))
859 except OSError, inst:
860 if inst.errno != errno.ENOENT:
861 raise
862 wlock = self._repo.wlock() 855 wlock = self._repo.wlock()
863 try: 856 try:
857 if unlink:
858 for f in list:
859 try:
860 util.unlinkpath(self._repo.wjoin(f))
861 except OSError, inst:
862 if inst.errno != errno.ENOENT:
863 raise
864 for f in list: 864 for f in list:
865 if unlink and os.path.lexists(self._repo.wjoin(f)): 865 if unlink and os.path.lexists(self._repo.wjoin(f)):
866 self._repo.ui.warn(_("%s still exists!\n") % f) 866 self._repo.ui.warn(_("%s still exists!\n") % f)
867 elif self._repo.dirstate[f] == 'a': 867 elif self._repo.dirstate[f] == 'a':
868 self._repo.dirstate.forget(f) 868 self._repo.dirstate.forget(f)