comparison mercurial/context.py @ 14518:a67e866f46f9

workingctx: eliminate remove function Inlining it into it's last remaining call place in cmdutil.copy. Note that cmdutil.copy is called with the wlock already held, so no additional locking is needed to call util.unlinkpath. We do not need to wrap the util.unlinkpath call into a try block, because at that point we already know whether abssrc exists or not -- thanks to the preceding util.copyfile call. Adding a new local 'srcexists' in cmdutil.copy for that purpose.
author Adrian Buehlmann <adrian@cadifra.com>
date Thu, 02 Jun 2011 00:33:33 +0200
parents f3b50431eb7e
children 0bd69e37fd20
comparison
equal deleted inserted replaced
14517:5a931246afc5 14518:a67e866f46f9
851 def ancestors(self): 851 def ancestors(self):
852 for a in self._repo.changelog.ancestors( 852 for a in self._repo.changelog.ancestors(
853 *[p.rev() for p in self._parents]): 853 *[p.rev() for p in self._parents]):
854 yield changectx(self._repo, a) 854 yield changectx(self._repo, a)
855 855
856 def remove(self, list, unlink=False):
857 wlock = self._repo.wlock()
858 try:
859 if unlink:
860 for f in list:
861 try:
862 util.unlinkpath(self._repo.wjoin(f))
863 except OSError, inst:
864 if inst.errno != errno.ENOENT:
865 raise
866 self.forget(list)
867 finally:
868 wlock.release()
869
870 def undelete(self, list): 856 def undelete(self, list):
871 pctxs = self.parents() 857 pctxs = self.parents()
872 wlock = self._repo.wlock() 858 wlock = self._repo.wlock()
873 try: 859 try:
874 for f in list: 860 for f in list: