hgext/relink.py
changeset 38442 36edfbac7281
parent 38404 398716063c2d
child 40293 c303d65d2e34
equal deleted inserted replaced
38441:e219e355e088 38442:36edfbac7281
    68 
    68 
    69     if not util.samedevice(src.store.path, repo.store.path):
    69     if not util.samedevice(src.store.path, repo.store.path):
    70         # No point in continuing
    70         # No point in continuing
    71         raise error.Abort(_('source and destination are on different devices'))
    71         raise error.Abort(_('source and destination are on different devices'))
    72 
    72 
    73     locallock = repo.lock()
    73     with repo.lock(), src.lock():
    74     try:
    74         candidates = sorted(collect(src, ui))
    75         remotelock = src.lock()
    75         targets = prune(candidates, src.store.path, repo.store.path, ui)
    76         try:
    76         do_relink(src.store.path, repo.store.path, targets, ui)
    77             candidates = sorted(collect(src, ui))
       
    78             targets = prune(candidates, src.store.path, repo.store.path, ui)
       
    79             do_relink(src.store.path, repo.store.path, targets, ui)
       
    80         finally:
       
    81             remotelock.release()
       
    82     finally:
       
    83         locallock.release()
       
    84 
    77 
    85 def collect(src, ui):
    78 def collect(src, ui):
    86     seplen = len(os.path.sep)
    79     seplen = len(os.path.sep)
    87     candidates = []
    80     candidates = []
    88     live = len(src['tip'].manifest())
    81     live = len(src['tip'].manifest())