Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

filedata: use mercurial.util.posixfile

instead of Python's open().

Python's silly open() does not set FILE_SHARE_DELETE on the dwShareMode for the
CreateFile API function of Windows. Deleting files will fail in that state on
Windows.

As usual with this stuff, I cannot prove anything conclusive that this exact
open() call was truly bad here and the file is closed quickly anyway, but *not*
setting FILE_SHARE_DELETE when reading a file on Windows is a stupid thing.

One day, I might finally convince myself to try having a chat with the
Python folks about fixing their open(). Until that happens, I'm using
Mercurial's posixfile.

See also http://mercurial.selenic.com/wiki/UnlinkingFilesOnWindows

Changeset a1f52609de83

Parent 6105aded6606

by Adrian Buehlmann

Changes to one file · Browse files at a1f52609de83 Showing diff from parent 6105aded6606 Diff from another changeset...

 
255
256
257
258
 
259
260
261
 
255
256
257
 
258
259
260
261
@@ -255,7 +255,7 @@
  if os.path.getsize(repo.wjoin(wfile)) > ctx._repo.maxdiff:   self.error = mde   else: - data = open(repo.wjoin(wfile), 'r').read() + data = util.posixfile(repo.wjoin(wfile), 'r').read()   if '\0' in data:   self.error = 'binary file'   else: