##// END OF EJS Templates
Fix hg clone race with writer...
mpm@selenic.com -
r917:7f3f5590 default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from demandload import demandload
8 from demandload import demandload
9 demandload(globals(), "os re sys signal shutil")
9 demandload(globals(), "os re sys signal shutil")
10 demandload(globals(), "fancyopts ui hg util")
10 demandload(globals(), "fancyopts ui hg util lock")
11 demandload(globals(), "fnmatch hgweb mdiff random signal time traceback")
11 demandload(globals(), "fnmatch hgweb mdiff random signal time traceback")
12 demandload(globals(), "errno socket version struct atexit")
12 demandload(globals(), "errno socket version struct atexit")
13
13
@@ -494,6 +494,9 b' def clone(ui, source, dest=None, **opts)'
494 and getattr(os, 'link', None) or shutil.copy2)
494 and getattr(os, 'link', None) or shutil.copy2)
495 if copyfile is not shutil.copy2:
495 if copyfile is not shutil.copy2:
496 ui.note("cloning by hardlink\n")
496 ui.note("cloning by hardlink\n")
497 # we use a lock here because because we're not nicely ordered
498 l = lock.lock(os.path.join(source, ".hg", "lock"))
499
497 util.copytree(os.path.join(source, ".hg"), os.path.join(dest, ".hg"),
500 util.copytree(os.path.join(source, ".hg"), os.path.join(dest, ".hg"),
498 copyfile)
501 copyfile)
499 try:
502 try:
@@ -187,7 +187,7 b' def copytree(src, dst, 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)
General Comments 0
You need to be logged in to leave comments. Login now