mercurial/commands.py
changeset 1241 3b4f05ff3130
parent 1238 6a4f181497c9
child 1242 4a6efec8b698
child 1247 7a70dafbf4b9
equal deleted inserted replaced
1240:cc756ffd4d04 1241:3b4f05ff3130
   618     abspath = source
   618     abspath = source
   619     other = hg.repository(ui, source)
   619     other = hg.repository(ui, source)
   620 
   620 
   621     if other.dev() != -1:
   621     if other.dev() != -1:
   622         abspath = os.path.abspath(source)
   622         abspath = os.path.abspath(source)
   623         copyfile = (os.stat(dest).st_dev == other.dev()
       
   624                     and getattr(os, 'link', None) or shutil.copy2)
       
   625         if copyfile is not shutil.copy2:
       
   626             ui.note("cloning by hardlink\n")
       
   627 
   623 
   628         # we use a lock here because if we race with commit, we can
   624         # we use a lock here because if we race with commit, we can
   629         # end up with extra data in the cloned revlogs that's not
   625         # end up with extra data in the cloned revlogs that's not
   630         # pointed to by changesets, thus causing verify to fail
   626         # pointed to by changesets, thus causing verify to fail
   631         l1 = lock.lock(os.path.join(source, ".hg", "lock"))
   627         l1 = lock.lock(os.path.join(source, ".hg", "lock"))
   636 
   632 
   637         files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i"
   633         files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i"
   638         for f in files.split():
   634         for f in files.split():
   639             src = os.path.join(source, ".hg", f)
   635             src = os.path.join(source, ".hg", f)
   640             dst = os.path.join(dest, ".hg", f)
   636             dst = os.path.join(dest, ".hg", f)
   641             util.copyfiles(src, dst, copyfile)
   637             util.copyfiles(src, dst)
   642 
   638 
   643         repo = hg.repository(ui, dest)
   639         repo = hg.repository(ui, dest)
   644 
   640 
   645     else:
   641     else:
   646         repo = hg.repository(ui, dest, create=1)
   642         repo = hg.repository(ui, dest, create=1)