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

Adrian Buehlmann adrian at cadifra.com
Thu Dec 2 15:38:38 CST 2010

# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1291199708 -3600
# Node ID 497150900da017b0f5030087b1ef819eb6eb1b33
# Parent  dbfd099828fa78c4e767acc30aa93d705adbb3a2
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
@@ -630,7 +630,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