mercurial/hg.py
changeset 20829 9a09a625bc93
parent 20800 8253e55930a3
parent 20825 dda11e799529
child 20860 81d6dc8c3c63
equal deleted inserted replaced
20828:3210b7930899 20829:9a09a625bc93
   228             dstbase = os.path.dirname(f)
   228             dstbase = os.path.dirname(f)
   229             if dstbase and not dstvfs.exists(dstbase):
   229             if dstbase and not dstvfs.exists(dstbase):
   230                 dstvfs.mkdir(dstbase)
   230                 dstvfs.mkdir(dstbase)
   231             if srcvfs.exists(f):
   231             if srcvfs.exists(f):
   232                 if f.endswith('data'):
   232                 if f.endswith('data'):
       
   233                     # 'dstbase' may be empty (e.g. revlog format 0)
       
   234                     lockfile = os.path.join(dstbase, "lock")
   233                     # lock to avoid premature writing to the target
   235                     # lock to avoid premature writing to the target
   234                     destlock = lock.lock(dstvfs, dstbase + "/lock")
   236                     destlock = lock.lock(dstvfs, lockfile)
   235                 hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f),
   237                 hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f),
   236                                              hardlink)
   238                                              hardlink)
   237                 num += n
   239                 num += n
   238         if hardlink:
   240         if hardlink:
   239             ui.debug("linked %d files\n" % num)
   241             ui.debug("linked %d files\n" % num)