[PATCH V3] record: make hg record always use the non curses interface

Laurent Charignon lcharignon at fb.com
Wed May 13 22:36:19 CDT 2015


# 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)
 
 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,
+    try:
+        backup = ui.backupconfig('experimental', 'crecord')
+        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,
+    try:
+        backup = ui.backupconfig('experimental', 'crecord')
+        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']:


More information about the Mercurial-devel mailing list