Patchwork [V4] record: make hg record always use the non curses interface

login
register
mail settings
Submitter Laurent Charignon
Date May 14, 2015, 2:46 p.m.
Message ID <6646328ce93ff8071ad8.1431614794@lcharignon-mbp.local>
Download mbox | patch
Permalink /patch/9073/
State Accepted
Delegated to: Pierre-Yves David
Headers show

Comments

Laurent Charignon - May 14, 2015, 2:46 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1431574212 25200
#      Wed May 13 20:30:12 2015 -0700
# Node ID 6646328ce93ff8071ad87f68ee7320759b7a1144
# 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.
Pierre-Yves David - May 15, 2015, 7:41 p.m.
On 05/14/2015 07:46 AM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1431574212 25200
> #      Wed May 13 20:30:12 2015 -0700
> # Node ID 6646328ce93ff8071ad87f68ee7320759b7a1144
> # 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)
> +    backup = ui.backupconfig('experimental', 'crecord')
> +    try:
> +        ui.setconfig('experimental', 'crecord', False, 'record')
> +        commands.commit(ui, repo, *pats, **opts)
> +    finally:
> +        ui.restoreconfig(backup)
>
>   def qrefresh(origfn, ui, repo, *pats, **opts):
>       if not opts['interactive']:
> @@ -66,8 +71,13 @@
>           mq.refresh(ui, repo, **opts)
>
>       # backup all changed files
> -    cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
> +    backup = ui.backupconfig('experimental', 'crecord')
> +    try:
> +        ui.setconfig('experimental', 'crecord', False, 'record')
> +        cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
>                       cmdutil.recordfilter, *pats, **opts)
> +    finally:
> +        ui.restoreconfig(backup)

I do not think we should enforce the old UI on 'qrefresh -i' forcing it 
on 'qrecord' if we force it on 'crecord' make sense, but forcing it on 
'qrefresh -i' if we do not force it on 'commit -i' (and we do not want 
to force it imho) does not make too much sense.

If you agree I'll drop this hunk and push the patch.
Pierre-Yves David - May 19, 2015, 4:35 p.m.
On 05/15/2015 02:41 PM, Pierre-Yves David wrote:
>
>
> On 05/14/2015 07:46 AM, Laurent Charignon wrote:
>> # HG changeset patch
>> # User Laurent Charignon <lcharignon@fb.com>
>> # Date 1431574212 25200
>> #      Wed May 13 20:30:12 2015 -0700
>> # Node ID 6646328ce93ff8071ad87f68ee7320759b7a1144
>> # 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)
>> +    backup = ui.backupconfig('experimental', 'crecord')
>> +    try:
>> +        ui.setconfig('experimental', 'crecord', False, 'record')
>> +        commands.commit(ui, repo, *pats, **opts)
>> +    finally:
>> +        ui.restoreconfig(backup)
>>
>>   def qrefresh(origfn, ui, repo, *pats, **opts):
>>       if not opts['interactive']:
>> @@ -66,8 +71,13 @@
>>           mq.refresh(ui, repo, **opts)
>>
>>       # backup all changed files
>> -    cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
>> +    backup = ui.backupconfig('experimental', 'crecord')
>> +    try:
>> +        ui.setconfig('experimental', 'crecord', False, 'record')
>> +        cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
>>                       cmdutil.recordfilter, *pats, **opts)
>> +    finally:
>> +        ui.restoreconfig(backup)
>
> I do not think we should enforce the old UI on 'qrefresh -i' forcing it
> on 'qrecord' if we force it on 'crecord' make sense, but forcing it on
> 'qrefresh -i' if we do not force it on 'commit -i' (and we do not want
> to force it imho) does not make too much sense.
>
> If you agree I'll drop this hunk and push the patch.

Gentle ping.
Laurent Charignon - May 19, 2015, 5:02 p.m.
On 5/19/15, 9:35 AM, "Pierre-Yves David" <pierre-yves.david@ens-lyon.org>
wrote:

>
>
>On 05/15/2015 02:41 PM, Pierre-Yves David wrote:
>>
>>
>> On 05/14/2015 07:46 AM, Laurent Charignon wrote:
>>> # HG changeset patch
>>> # User Laurent Charignon <lcharignon@fb.com>
>>> # Date 1431574212 25200
>>> #      Wed May 13 20:30:12 2015 -0700
>>> # Node ID 6646328ce93ff8071ad87f68ee7320759b7a1144
>>> # 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)
>>> +    backup = ui.backupconfig('experimental', 'crecord')
>>> +    try:
>>> +        ui.setconfig('experimental', 'crecord', False, 'record')
>>> +        commands.commit(ui, repo, *pats, **opts)
>>> +    finally:
>>> +        ui.restoreconfig(backup)
>>>
>>>   def qrefresh(origfn, ui, repo, *pats, **opts):
>>>       if not opts['interactive']:
>>> @@ -66,8 +71,13 @@
>>>           mq.refresh(ui, repo, **opts)
>>>
>>>       # backup all changed files
>>> -    cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
>>> +    backup = ui.backupconfig('experimental', 'crecord')
>>> +    try:
>>> +        ui.setconfig('experimental', 'crecord', False, 'record')
>>> +        cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
>>>                       cmdutil.recordfilter, *pats, **opts)
>>> +    finally:
>>> +        ui.restoreconfig(backup)
>>
>> I do not think we should enforce the old UI on 'qrefresh -i' forcing it
>> on 'qrecord' if we force it on 'crecord' make sense, but forcing it on
>> 'qrefresh -i' if we do not force it on 'commit -i' (and we do not want
>> to force it imho) does not make too much sense.
>>
>> If you agree I'll drop this hunk and push the patch.

Agreed.

>
>Gentle ping.
>
>-- 
>Pierre-Yves David
Pierre-Yves David - May 19, 2015, 6:40 p.m.
On 05/19/2015 12:02 PM, Laurent Charignon wrote:
>
>
> On 5/19/15, 9:35 AM, "Pierre-Yves David" <pierre-yves.david@ens-lyon.org>
> wrote:
>
>>
>>
>> On 05/15/2015 02:41 PM, Pierre-Yves David wrote:
>>>
>>>
>>> On 05/14/2015 07:46 AM, Laurent Charignon wrote:
>>>> # HG changeset patch
>>>> # User Laurent Charignon <lcharignon@fb.com>
>>>> # Date 1431574212 25200
>>>> #      Wed May 13 20:30:12 2015 -0700
>>>> # Node ID 6646328ce93ff8071ad87f68ee7320759b7a1144
>>>> # 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)
>>>> +    backup = ui.backupconfig('experimental', 'crecord')
>>>> +    try:
>>>> +        ui.setconfig('experimental', 'crecord', False, 'record')
>>>> +        commands.commit(ui, repo, *pats, **opts)
>>>> +    finally:
>>>> +        ui.restoreconfig(backup)
>>>>
>>>>    def qrefresh(origfn, ui, repo, *pats, **opts):
>>>>        if not opts['interactive']:
>>>> @@ -66,8 +71,13 @@
>>>>            mq.refresh(ui, repo, **opts)
>>>>
>>>>        # backup all changed files
>>>> -    cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
>>>> +    backup = ui.backupconfig('experimental', 'crecord')
>>>> +    try:
>>>> +        ui.setconfig('experimental', 'crecord', False, 'record')
>>>> +        cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
>>>>                        cmdutil.recordfilter, *pats, **opts)
>>>> +    finally:
>>>> +        ui.restoreconfig(backup)
>>>
>>> I do not think we should enforce the old UI on 'qrefresh -i' forcing it
>>> on 'qrecord' if we force it on 'crecord' make sense, but forcing it on
>>> 'qrefresh -i' if we do not force it on 'commit -i' (and we do not want
>>> to force it imho) does not make too much sense.
>>>
>>> If you agree I'll drop this hunk and push the patch.
>
> Agreed.

Hunk dropped and patch pushed to the clowncopter.

Patch

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)
+    backup = ui.backupconfig('experimental', 'crecord')
+    try:
+        ui.setconfig('experimental', 'crecord', False, 'record')
+        commands.commit(ui, repo, *pats, **opts)
+    finally:
+        ui.restoreconfig(backup)
 
 def qrefresh(origfn, ui, repo, *pats, **opts):
     if not opts['interactive']:
@@ -66,8 +71,13 @@ 
         mq.refresh(ui, repo, **opts)
 
     # backup all changed files
-    cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
+    backup = ui.backupconfig('experimental', 'crecord')
+    try:
+        ui.setconfig('experimental', 'crecord', False, 'record')
+        cmdutil.dorecord(ui, repo, committomq, 'qrefresh', True,
                     cmdutil.recordfilter, *pats, **opts)
+    finally:
+        ui.restoreconfig(backup)
 
 # This command registration is replaced during uisetup().
 @command('qrecord',
@@ -92,8 +102,13 @@ 
         opts['checkname'] = False
         mq.new(ui, repo, patch, *pats, **opts)
 
-    cmdutil.dorecord(ui, repo, committomq, 'qnew', False,
+    backup = ui.backupconfig('experimental', 'crecord')
+    try:
+        ui.setconfig('experimental', 'crecord', False, 'record')
+        cmdutil.dorecord(ui, repo, committomq, 'qnew', False,
                     cmdutil.recordfilter, *pats, **opts)
+    finally:
+        ui.restoreconfig(backup)
 
 def qnew(origfn, ui, repo, patch, *args, **opts):
     if opts['interactive']: