mercurial/hg.py
branchstable
changeset 20825 dda11e799529
parent 20355 7d269e7620c4
child 20829 9a09a625bc93
child 20858 bc56ec9e64df
equal deleted inserted replaced
20824:c57c9cece645 20825:dda11e799529
   211             dstbase = os.path.dirname(f)
   211             dstbase = os.path.dirname(f)
   212             if dstbase and not dstvfs.exists(dstbase):
   212             if dstbase and not dstvfs.exists(dstbase):
   213                 dstvfs.mkdir(dstbase)
   213                 dstvfs.mkdir(dstbase)
   214             if srcvfs.exists(f):
   214             if srcvfs.exists(f):
   215                 if f.endswith('data'):
   215                 if f.endswith('data'):
       
   216                     # 'dstbase' may be empty (e.g. revlog format 0)
       
   217                     lockfile = os.path.join(dstbase, "lock")
   216                     # lock to avoid premature writing to the target
   218                     # lock to avoid premature writing to the target
   217                     destlock = lock.lock(dstvfs, dstbase + "/lock")
   219                     destlock = lock.lock(dstvfs, lockfile)
   218                 hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f),
   220                 hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f),
   219                                              hardlink)
   221                                              hardlink)
   220                 num += n
   222                 num += n
   221         if hardlink:
   223         if hardlink:
   222             ui.debug("linked %d files\n" % num)
   224             ui.debug("linked %d files\n" % num)