[PATCH] win32mbcs: use extsetup() to wrap functions only once

Martin Geisler mg at aragost.com
Mon Nov 22 10:38:55 CST 2010


shunichi.goto at gmail.com writes:

> # HG changeset patch
> # User Shun-ichi GOTO <shunichi.goto at gmail.com>
> # Date 1290157635 -32400
> # Node ID 30967c86462b3a407ff2de737e2b8c4cf208b317
> # Parent  a229184d6ce45af31d156809736c8cf2c9df4181
> win32mbcs: use extsetup() to wrap functions only once.
> Using reposetup() may cause multiple-wrap issue in some situation
> like "hg serve".

A minor thing: please include a blank line after the first line in your
commit messages.

> -def reposetup(ui, repo):
> +def extsetup(ui):
>      # TODO: decide use of config section for this extension
>      if not os.path.supports_unicode_filenames:
>          ui.warn(_("[win32mbcs] cannot activate on this platform.\n"))
> @@ -149,6 +150,10 @@
>          for f in funcs.split():
>              wrapname(f, wrapper)
>          wrapname("mercurial.osutil.listdir", wrapperforlistdir)
> -        ui.debug("[win32mbcs] activated with encoding: %s\n"
> -                 % _encoding)
> +        # Check sys.args manually instead of using ui.debug() because
> +        # command line options is not yet applied when
> +        # extensions.loadall() is called.
> +        if '--debug' in sys.argv:
> +            ui.write("[win32mbcs] activated with encoding: %s\n"
> +                     % _encoding)

This sounds like something that should be solved in ui instead of here.
Can you have a look and see if we can delay the loadall call until we
have parsed the command line?

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list