diff hgext/largefiles/lfcommands.py @ 16727:3e24ce3de5f1

merge with stable
author Matt Mackall <mpm@selenic.com>
date Tue, 15 May 2012 07:00:55 +0200
parents 28001e8a5149 1eede2ea2041
children 9e1616307c4c
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Sun May 13 22:59:22 2012 +0200
+++ b/hgext/largefiles/lfcommands.py	Tue May 15 07:00:55 2012 +0200
@@ -14,6 +14,7 @@
 from mercurial import util, match as match_, hg, node, context, error, \
     cmdutil, scmutil
 from mercurial.i18n import _
+from mercurial.lock import release
 
 import lfutil
 import basestore
@@ -55,10 +56,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
@@ -111,10 +114,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