workingctx: unlink paths while holding the wlock
authorAdrian Buehlmann <adrian@cadifra.com>
Tue, 24 May 2011 14:08:20 +0200
changeset 14420 137b03b5aea1
parent 14419 ede7cea1550f
child 14421 639f26cab2f5
workingctx: unlink paths while holding the wlock
mercurial/context.py
--- a/mercurial/context.py	Tue May 24 16:12:01 2011 +0200
+++ b/mercurial/context.py	Tue May 24 14:08:20 2011 +0200
@@ -852,15 +852,15 @@
             yield changectx(self._repo, a)
 
     def remove(self, list, unlink=False):
-        if unlink:
-            for f in list:
-                try:
-                    util.unlinkpath(self._repo.wjoin(f))
-                except OSError, inst:
-                    if inst.errno != errno.ENOENT:
-                        raise
         wlock = self._repo.wlock()
         try:
+            if unlink:
+                for f in list:
+                    try:
+                        util.unlinkpath(self._repo.wjoin(f))
+                    except OSError, inst:
+                        if inst.errno != errno.ENOENT:
+                            raise
             for f in list:
                 if unlink and os.path.lexists(self._repo.wjoin(f)):
                     self._repo.ui.warn(_("%s still exists!\n") % f)