##// END OF EJS Templates
util.rename: use temporary file name for rename-targets on windows...
util.rename: use temporary file name for rename-targets on windows Use a temporary file name as target for a forced rename on Windows. The target file name is not opened at any time; just renamed into and then unlinked. Using a temporary instead of a static name is necessary since otherwise a hg crash can leave the file lying around, blocking future attempts at renaming.

File last commit:

r8225:46293a0c default
r8255:ea82a23c default
Show More
common.py
26 lines | 650 B | text/x-python | PythonLexer
Bryan O'Sullivan
Add inotify extension
r6239 # server.py - inotify common protocol code
#
# Copyright 2006, 2007, 2008 Bryan O'Sullivan <bos@serpentine.com>
# Copyright 2007, 2008 Brendan Cully <brendan@kublai.com>
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
import cStringIO, socket, struct
version = 1
resphdrfmt = '>llllllll'
resphdrsize = struct.calcsize(resphdrfmt)
def recvcs(sock):
cs = cStringIO.StringIO()
s = True
try:
while s:
s = sock.recv(65536)
cs.write(s)
finally:
sock.shutdown(socket.SHUT_RD)
cs.seek(0)
return cs