[PATCH V3] record: make hg record always use the non curses interface
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu May 14 00:25:39 CDT 2015
On 05/13/2015 08:36 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1431574212 25200
> # Wed May 13 20:30:12 2015 -0700
> # Node ID a245678708a810f8fdbbc35ce4fe0a672ea8cfb0
> # Parent 7c324f65e4efb3310f7664df3da94363bef76765
> record: make hg record always use the non curses interface
>
> Before this patch, hg record was running hg commit -i, therefore with the
> experimental.crecord=True flag, hg record was actually launching the curses
> record interface. Some of our users could be confused by that.
> This patch makes the hg record command set this flag to False, ensuring that
> hg record never shows the curses interface.
> commit -i, shelve -i and revert -i remain unchanged and use the curses
> interface if the experimental.crecord flag is set.
>
> diff --git a/hgext/record.py b/hgext/record.py
> --- a/hgext/record.py
> +++ b/hgext/record.py
> @@ -50,7 +50,12 @@
> This command is not available when committing a merge.'''
>
> opts["interactive"] = True
> - commands.commit(ui, repo, *pats, **opts)
> + try:
> + backup = ui.backupconfig('experimental', 'crecord')
> + ui.setconfig('experimental', 'crecord', False, 'record')
> + commands.commit(ui, repo, *pats, **opts)
> + finally:
> + ui.restoreconfig(backup)
wrong pattern usage here:
backup config have no side effect and can be safely called outside of
the try. However with your current code, if backupconfig were to fail,
the "backup" variable would not exist and the finally would crash.
shadowing the original error.
You should use:
backup
try:
set
use
finally:
restore
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list