##// END OF EJS Templates
largefiles: use wlock for lfconvert (issue3444)...
Mads Kiilerich -
r16717:1eede2ea stable
parent child Browse files
Show More
@@ -13,6 +13,7 b' import shutil'
13
13
14 from mercurial import util, match as match_, hg, node, context, error, cmdutil
14 from mercurial import util, match as match_, hg, node, context, error, cmdutil
15 from mercurial.i18n import _
15 from mercurial.i18n import _
16 from mercurial.lock import release
16
17
17 import lfutil
18 import lfutil
18 import basestore
19 import basestore
@@ -54,10 +55,12 b' def lfconvert(ui, src, dest, *pats, **op'
54 rdst = hg.repository(ui, dest, create=True)
55 rdst = hg.repository(ui, dest, create=True)
55
56
56 success = False
57 success = False
58 dstwlock = dstlock = None
57 try:
59 try:
58 # Lock destination to prevent modification while it is converted to.
60 # Lock destination to prevent modification while it is converted to.
59 # Don't need to lock src because we are just reading from its history
61 # Don't need to lock src because we are just reading from its history
60 # which can't change.
62 # which can't change.
63 dstwlock = rdst.wlock()
61 dstlock = rdst.lock()
64 dstlock = rdst.lock()
62
65
63 # Get a list of all changesets in the source. The easy way to do this
66 # Get a list of all changesets in the source. The easy way to do this
@@ -110,10 +113,11 b' def lfconvert(ui, src, dest, *pats, **op'
110 ui.progress(_('converting revisions'), None)
113 ui.progress(_('converting revisions'), None)
111 success = True
114 success = True
112 finally:
115 finally:
116 rdst.dirstate.clear()
117 release(dstlock, dstwlock)
113 if not success:
118 if not success:
114 # we failed, remove the new directory
119 # we failed, remove the new directory
115 shutil.rmtree(rdst.root)
120 shutil.rmtree(rdst.root)
116 dstlock.release()
117
121
118 def _addchangeset(ui, rsrc, rdst, ctx, revmap):
122 def _addchangeset(ui, rsrc, rdst, ctx, revmap):
119 # Convert src parents to dst parents
123 # Convert src parents to dst parents
General Comments 0
You need to be logged in to leave comments. Login now