On Sun, May 24, 2009 at 4:17 AM, Yuki KODAMA <[email protected]> wrote:
> # HG changeset patch
> # User Yuki KODAMA <[email protected]>
> # Date 1243156511 -32400
> # Node ID b303eb01df2f58402548114addef683653a9321e
> # Parent  7368374fb0c5f71c873d7e3099725333f3610e48
> thgconfig: correcting editor path if contains whitespace
>
> this fix support some path patterns:
> - c:\tools\editor.exe (no ws)
> - "C:\Program Files\Foo\Bar.exe" (has ws, but bracketed)
> - C:\Program Files\Foo\Bar.exe (has ws, not bracketed)
>
> diff --git a/hggtk/thgconfig.py b/hggtk/thgconfig.py
> --- a/hggtk/thgconfig.py
> +++ b/hggtk/thgconfig.py
> @@ -507,6 +507,9 @@
>                 os.environ.get('HGEDITOR') or
>                 u.config('ui', 'editor') or
>                 os.environ.get('EDITOR', 'vi'))
> +        # correcting path if contains whitespace in it
> +        if editor.find(' ') != -1 and editor.count('"') != 2:
> +            editor = '"' + editor + '"'
>         if os.path.basename(editor) in ('vi', 'vim', 'hgeditor'):
>             gdialog.Prompt(_('No visual editor configured'),
>                    _('Please configure a visual editor.'), self).run()

This code was copied from gdialog, and from mercurial.util before
that, so this issue is in a few other places.

Perhaps it would be better to inform the user to fix their
configuration by adding the quotes themselves.  That way their
configuration will work properly if they use command line hg as well.

--
Steve Borho

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to