##// END OF EJS Templates
relink: use context manager for lock management
Matt Harbison -
r38461:36edfbac @52 default
parent child Browse files
Show More
@@ -70,17 +70,10 b' def relink(ui, repo, origin=None, **opts'
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)
General Comments 0
You need to be logged in to leave comments. Login now