[PATCH 2 of 2] util/rename: update to work better with virus scanners on Windows
mpm at selenic.com
Mon Feb 16 12:15:56 CST 2009
On Mon, 2009-02-16 at 13:58 +0100, Sune Foldager wrote:
I queued up this patch yesterday, is there any reason this won't work?
rename: simplify forced renaming
This should help work around virus scanner issues with rename on Windows.
diff -r 2db6f7f95e47 mercurial/util.py
--- a/mercurial/util.py Sun Feb 15 17:07:49 2009 -0600
+++ b/mercurial/util.py Sun Feb 15 21:46:21 2009 -0600
@@ -740,12 +740,10 @@
# on windows, rename to existing file is not allowed, so we
# must delete destination first. but if file is open, unlink
# schedules it for delete but does not delete it. rename
- # happens immediately even for open files, so we create
- # temporary file, delete it, rename destination to that name,
- # then delete that. then rename is safe to do.
- fd, temp = tempfile.mkstemp(dir=os.path.dirname(dst) or '.')
+ # happens immediately even for open files, so we rename
+ # destination to a temporary name, then delete that. then
+ # rename is safe to do.
+ temp = dst + "-force-rename"
http://selenic.com : development and support for Mercurial and Linux
More information about the Mercurial-devel