[PATCH 1 of 4 emacs-for-augie] ui: add a parameter to set the temporary directory for edit

Augie Fackler raf at durin42.com
Tue Jan 17 15:40:26 EST 2017


On Mon, Jan 16, 2017 at 09:41:11PM -0800, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean at farley.io>
> # Date 1484629522 28800
> #      Mon Jan 16 21:05:22 2017 -0800
> # Node ID cb18a2517507a169a7b3c38b369199130b1c89c0
> # Parent  43c5526916752b0f7476a26069709f35590ddb04
> ui: add a parameter to set the temporary directory for edit
>
> This currently does nothing but will allow hg tooling in emacs to use
> this to allow buffers to find the repo via the temp file's parent
> directory.
>
> diff --git a/mercurial/ui.py b/mercurial/ui.py
> index 1e82af6..7da75c3 100644
> --- a/mercurial/ui.py
> +++ b/mercurial/ui.py
> @@ -1010,20 +1010,26 @@ class ui(object):
>          '''
>          if self.debugflag:
>              opts['label'] = opts.get('label', '') + ' ui.debug'
>              self.write(*msg, **opts)
>
> -    def edit(self, text, user, extra=None, editform=None, pending=None):
> +    def edit(self, text, user, extra=None, editform=None, pending=None,
> +             tmpdir=None):
>          extra_defaults = {
>              'prefix': 'editor',
>              'suffix': '.txt',
>          }
>          if extra is not None:
>              extra_defaults.update(extra)
>          extra = extra_defaults
> +
> +        tdir = None
> +        if self.configbool('experimental', 'tmpsubhg'):
> +            tdir = tmpdir

I'm not following what this config knob is for - it looks like it's
new in this change, but it's not documented here. Can you elaborate?

In general, series seems okay though.

>          (fd, name) = tempfile.mkstemp(prefix='hg-' + extra['prefix'] + '-',
> -                                      suffix=extra['suffix'], text=True)
> +                                      suffix=extra['suffix'], text=True,
> +                                      dir=tdir)
>          try:
>              f = os.fdopen(fd, "w")
>              f.write(text)
>              f.close()
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list