[PATCH 3 of 3 STABLE] localrepo.wwrite: use unlinkopened instead of os.unlink

Adrian Buehlmann adrian at cadifra.com
Wed Dec 1 06:53:54 CST 2010

# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1291199708 -3600
# Branch stable
# Node ID 18d06beed4a794331427e89f3828cb9408012b6a
# Parent  52f97fe43a6be964691d78a0147f6650855fc303
localrepo.wwrite: use unlinkopened instead of os.unlink

Windows delays deleting open files, preventing recreation under
the same name until the file is closed.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -618,7 +618,7 @@ class localrepository(repo.repository):
     def wwrite(self, filename, data, flags):
         data = self._filter(self._decodefilterpats, filename, data)
-            os.unlink(self.wjoin(filename))
+            util.unlinkopened(self.wjoin(filename))
         except OSError:
         if 'l' in flags:

More information about the Mercurial-devel mailing list