comparison mercurial/util.py @ 917:7f3f55903496

Fix hg clone race with writer Most read operations in hg don't need locks because we order reads and writes for consistency. Clone is an exception to this as we're copying entire file histories and could end up with more file history copied than we have commits. For now, make clone take a lock on the source repo. Non-hardlinked clone should eventually be changed to use lockless pull.
author mpm@selenic.com
date Tue, 16 Aug 2005 14:53:47 -0800
parents 302f83b85054
children 22571b8d35d3
comparison
equal deleted inserted replaced
916:fe094cca9915 917:7f3f55903496
185 if os.path.isdir(srcname): 185 if os.path.isdir(srcname):
186 copytree(srcname, dstname, copyfile) 186 copytree(srcname, dstname, copyfile)
187 elif os.path.isfile(srcname): 187 elif os.path.isfile(srcname):
188 copyfile(srcname, dstname) 188 copyfile(srcname, dstname)
189 else: 189 else:
190 raise IOError("Not a regular file: %r" % srcname) 190 pass
191 191
192 def _makelock_file(info, pathname): 192 def _makelock_file(info, pathname):
193 ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL) 193 ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL)
194 os.write(ld, info) 194 os.write(ld, info)
195 os.close(ld) 195 os.close(ld)