hgext/largefiles/lfcommands.py
branchstable
changeset 16717 1eede2ea2041
parent 16551 ebf6d38c9063
child 16727 3e24ce3de5f1
--- a/hgext/largefiles/lfcommands.py	Sun May 13 11:19:48 2012 +0200
+++ b/hgext/largefiles/lfcommands.py	Sun May 13 17:34:55 2012 +0200
@@ -13,6 +13,7 @@
 
 from mercurial import util, match as match_, hg, node, context, error, cmdutil
 from mercurial.i18n import _
+from mercurial.lock import release
 
 import lfutil
 import basestore
@@ -54,10 +55,12 @@
     rdst = hg.repository(ui, dest, create=True)
 
     success = False
+    dstwlock = dstlock = None
     try:
         # Lock destination to prevent modification while it is converted to.
         # Don't need to lock src because we are just reading from its history
         # which can't change.
+        dstwlock = rdst.wlock()
         dstlock = rdst.lock()
 
         # Get a list of all changesets in the source.  The easy way to do this
@@ -110,10 +113,11 @@
             ui.progress(_('converting revisions'), None)
         success = True
     finally:
+        rdst.dirstate.clear()
+        release(dstlock, dstwlock)
         if not success:
             # we failed, remove the new directory
             shutil.rmtree(rdst.root)
-        dstlock.release()
 
 def _addchangeset(ui, rsrc, rdst, ctx, revmap):
  # Convert src parents to dst parents