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

Augie Fackler raf at durin42.com
Fri Jun 12 22:13:34 UTC 2015


On Fri, Jun 12, 2015 at 05:33:35PM -0400, Matt Harbison wrote:
> # 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

Seems like the polite thing for largefiles to do. Thanks!

>
> 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:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list