mercurial/hg.py
changeset 24440 27ad6b91f5c2
parent 24306 6ddc86eedc3b
child 24945 e0b0fbd47491
equal deleted inserted replaced
24439:2ddfac2f163e 24440:27ad6b91f5c2
   241     '''
   241     '''
   242     destlock = None
   242     destlock = None
   243     try:
   243     try:
   244         hardlink = None
   244         hardlink = None
   245         num = 0
   245         num = 0
       
   246         closetopic = [None]
       
   247         def prog(topic, pos):
       
   248             if pos is None:
       
   249                 closetopic[0] = topic
       
   250             else:
       
   251                 ui.progress(topic, pos + num)
   246         srcpublishing = srcrepo.ui.configbool('phases', 'publish', True)
   252         srcpublishing = srcrepo.ui.configbool('phases', 'publish', True)
   247         srcvfs = scmutil.vfs(srcrepo.sharedpath)
   253         srcvfs = scmutil.vfs(srcrepo.sharedpath)
   248         dstvfs = scmutil.vfs(destpath)
   254         dstvfs = scmutil.vfs(destpath)
   249         for f in srcrepo.store.copylist():
   255         for f in srcrepo.store.copylist():
   250             if srcpublishing and f.endswith('phaseroots'):
   256             if srcpublishing and f.endswith('phaseroots'):
   257                     # 'dstbase' may be empty (e.g. revlog format 0)
   263                     # 'dstbase' may be empty (e.g. revlog format 0)
   258                     lockfile = os.path.join(dstbase, "lock")
   264                     lockfile = os.path.join(dstbase, "lock")
   259                     # lock to avoid premature writing to the target
   265                     # lock to avoid premature writing to the target
   260                     destlock = lock.lock(dstvfs, lockfile)
   266                     destlock = lock.lock(dstvfs, lockfile)
   261                 hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f),
   267                 hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f),
   262                                              hardlink)
   268                                              hardlink, progress=prog)
   263                 num += n
   269                 num += n
   264         if hardlink:
   270         if hardlink:
   265             ui.debug("linked %d files\n" % num)
   271             ui.debug("linked %d files\n" % num)
       
   272             if closetopic[0]:
       
   273                 ui.progress(closetopic[0], None)
   266         else:
   274         else:
   267             ui.debug("copied %d files\n" % num)
   275             ui.debug("copied %d files\n" % num)
       
   276             if closetopic[0]:
       
   277                 ui.progress(closetopic[0], None)
   268         return destlock
   278         return destlock
   269     except: # re-raises
   279     except: # re-raises
   270         release(destlock)
   280         release(destlock)
   271         raise
   281         raise
   272 
   282