[PATCH] opener: use posixfile to hold file open when calling nlinks()
Adrian Buehlmann
adrian at cadifra.com
Wed Feb 2 07:35:53 CST 2011
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1296651082 -3600
# Node ID a91fa77b170466eb5f202f6e797a7f914157aa03
# Parent 8f5c865b7b4a947b6eb2089ea31ebcc91132cc7f
opener: use posixfile to hold file open when calling nlinks()
Mercurial's posixfile is less intrusive on Windows than Python's open
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -742,7 +742,7 @@ def checknlink(testfile):
# nlinks() may behave differently for files on Windows shares if
# the file is open.
- fd = open(f2)
+ fd = posixfile(f2)
return nlinks(f2) > 1
finally:
if fd is not None:
@@ -916,7 +916,7 @@ class opener(object):
else:
# nlinks() may behave differently for files on Windows
# shares if the file is open.
- fd = open(f)
+ fd = posixfile(f)
nlink = nlinks(f)
if nlink < 1:
nlink = 2 # force mktempcopy (issue1922)
More information about the Mercurial-devel
mailing list