[PATCH] largefiles: restore the original converter class after lfconvert --to-normal

Matt Harbison mharbison at attotech.com
Fri Jun 12 16:33:35 CDT 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1434139902 14400
#      Fri Jun 12 16:11:42 2015 -0400
# Node ID 2629a3a4b39df2f9838a00bb641805d9fbfecc64
# Parent  386fabac4a15250e3700cfd6505a030be662c2d2
largefiles: restore the original converter class after lfconvert --to-normal

Not sure how much this really matters, but much of the largefiles code that
monkey patches like this restores things when it finishes.

diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -159,8 +159,13 @@ def lfconvert(ui, src, dest, *pats, **op
             if missing != 0:
                 raise util.Abort(_("all largefiles must be present locally"))
 
+            orig = convcmd.converter
             convcmd.converter = converter
-            convcmd.convert(ui, src, dest)
+
+            try:
+                convcmd.convert(ui, src, dest)
+            finally:
+                convcmd.converter = orig
         success = True
     finally:
         if tolfile:


More information about the Mercurial-devel mailing list