hgext/largefiles/lfcommands.py
changeset 15171 547da6115d1d
parent 15170 c1a4a3220711
child 15172 fb1dcd2aae2a
--- a/hgext/largefiles/lfcommands.py	Thu Sep 29 17:04:57 2011 -0500
+++ b/hgext/largefiles/lfcommands.py	Thu Sep 29 17:14:47 2011 -0500
@@ -65,6 +65,7 @@
         ui.traceback()
         raise util.Abort(_('%s is not a repo') % dest)
 
+    success = False
     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
@@ -106,7 +107,7 @@
                     os.unlink(rdst.wjoin(f))
                 try:
                     os.removedirs(os.path.dirname(rdst.wjoin(f)))
-                except:
+                except OSError:
                     pass
 
         else:
@@ -116,11 +117,11 @@
                 _addchangeset(ui, rsrc, rdst, ctx, revmap)
 
             ui.progress(_('converting revisions'), None)
-    except:
-        # we failed, remove the new directory
-        shutil.rmtree(rdst.root)
-        raise
+        success = True
     finally:
+        if not success:
+            # we failed, remove the new directory
+            shutil.rmtree(rdst.root)
         dst_lock.release()
 
 def _addchangeset(ui, rsrc, rdst, ctx, revmap):