Patchwork [1,of,2] repair: move ui.history-editing-backup to [rewrite] section

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 12, 2019, 10:47 a.m.
Message ID <f52ca65e212c9a56eb63.1547290055@mimosa>
Download mbox | patch
Permalink /patch/37688/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 12, 2019, 10:47 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1547282616 -32400
#      Sat Jan 12 17:43:36 2019 +0900
# Node ID f52ca65e212c9a56eb631c81434c4c1fe262ea68
# Parent  4f675c12d083a23049d75930bb765ed8bd27cd2c
repair: move ui.history-editing-backup to [rewrite] section

Since we have the "rewrite" section for general history-editing options, the
backup option should be there.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1680,8 +1680,8 @@  def _histedit(ui, repo, state, *freeargs
     fm.startitem()
     goal = _getgoal(opts)
     revs = opts.get('rev', [])
-    # experimental config: ui.history-editing-backup
-    nobackup = not ui.configbool('ui', 'history-editing-backup')
+    # experimental config: rewrite.backup-bundle
+    nobackup = not ui.configbool('rewrite', 'backup-bundle')
     rules = opts.get('commands', '')
     state.keep = opts.get('keep', False)
 
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -177,7 +177,7 @@  class rebaseruntime(object):
         if e:
             self.extrafns = [e]
 
-        self.backupf = ui.configbool('ui', 'history-editing-backup')
+        self.backupf = ui.configbool('rewrite', 'backup-bundle')
         self.keepf = opts.get('keep', False)
         self.keepbranchesf = opts.get('keepbranches', False)
         self.obsoletenotrebased = {}
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2588,7 +2588,7 @@  def amend(ui, repo, old, extra, pats, op
         obsmetadata = None
         if opts.get('note'):
             obsmetadata = {'note': encoding.fromlocal(opts['note'])}
-        backup = ui.configbool('ui', 'history-editing-backup')
+        backup = ui.configbool('rewrite', 'backup-bundle')
         scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata,
                              fixphase=True, targetphase=commitphase,
                              backup=backup)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -991,6 +991,10 @@  coreconfigitem('storage', 'mmap-threshol
     default='1MB',
     alias=[('experimental', 'mmapindexthreshold')],
 )
+coreconfigitem('rewrite', 'backup-bundle',
+    default=True,
+    alias=[('ui', 'history-editing-backup')],
+)
 coreconfigitem('rewrite', 'update-timestamp',
     default=False,
 )
@@ -1168,9 +1172,6 @@  coreconfigitem('ui', 'formatted',
 coreconfigitem('ui', 'graphnodetemplate',
     default=None,
 )
-coreconfigitem('ui', 'history-editing-backup',
-    default=True,
-)
 coreconfigitem('ui', 'interactive',
     default=None,
 )
diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -332,9 +332,9 @@  working directory should be all clean (w
   ? missing_content2_content3-untracked
   ? missing_missing_content3-untracked
 
-==========================================
-Test history-editing-backup config option|
-==========================================
+=================================
+Test backup-bundle config option|
+=================================
   $ hg init $TESTTMP/repo4
   $ cd $TESTTMP/repo4
   $ echo a>a
@@ -346,20 +346,20 @@  Test history-editing-backup config optio
 #if obsstore-off
   $ hg amend
   saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
-When history-editing-backup config option is set:
+When backup-bundle config option is set:
   $ cat << EOF >> $HGRCPATH
-  > [ui]
-  > history-editing-backup = False
+  > [rewrite]
+  > backup-bundle = False
   > EOF
   $ echo fixed > b
   $ hg amend
 
 #else
   $ hg amend
-When history-editing-backup config option is set:
+When backup-bundle config option is set:
   $ cat << EOF >> $HGRCPATH
-  > [ui]
-  > history-editing-backup = False
+  > [rewrite]
+  > backup-bundle = False
   > EOF
   $ echo fixed > b
   $ hg amend
diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -6,9 +6,9 @@  Enable extension used by this test
   > histedit=
   > EOF
 
-==========================================
-Test history-editing-backup config option|
-==========================================
+=================================
+Test backup-bundle config option|
+=================================
 Repo setup:
   $ hg init foo
   $ cd foo
@@ -33,7 +33,7 @@  Repo setup:
   o  0   36b4bdd91f5b   1970-01-01 00:00 +0000   test
        one
   
-Test when `history-editing-backup` config option is enabled:
+Test when `backup-bundle` config option is enabled:
   $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
   > pick 36b4bdd91f5b 0 one
   > pick 6153eb23e623 1 two
@@ -49,11 +49,11 @@  Test when `history-editing-backup` confi
   saved backup bundle to $TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
   saved backup bundle to $TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
 
-Test when `history-editing-backup` config option is not enabled
+Test when `backup-bundle` config option is not enabled
 Enable config option:
   $ cat >>$HGRCPATH <<EOF
-  > [ui]
-  > history-editing-backup=False
+  > [rewrite]
+  > backup-bundle = False
   > EOF
 
   $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
diff --git a/tests/test-rebase-backup.t b/tests/test-rebase-backup.t
--- a/tests/test-rebase-backup.t
+++ b/tests/test-rebase-backup.t
@@ -3,9 +3,9 @@ 
   > rebase=
   > EOF
 
-==========================================
-Test history-editing-backup config option |
-==========================================
+==================================
+Test backup-bundle config option |
+==================================
 Test with Pre-obsmarker rebase:
 1) When config option is not set:
   $ hg init repo1
@@ -50,8 +50,8 @@  1) When config option is not set:
 
 2) When config option is set:
   $ cat << EOF >> $HGRCPATH
-  > [ui]
-  > history-editing-backup = False
+  > [rewrite]
+  > backup-bundle = False
   > EOF
 
   $ echo f>f
@@ -116,10 +116,10 @@  Test when rebased revisions are stripped
   |
   o  0: a
   
-When history-editing-backup = True:
+When backup-bundle = True:
   $ cat << EOF >> $HGRCPATH
-  > [ui]
-  > history-editing-backup = True
+  > [rewrite]
+  > backup-bundle = True
   > EOF
   $ hg rebase -s 5 -d .
   rebasing 5:1f8148a544ee "b"
@@ -132,10 +132,10 @@  When history-editing-backup = True:
   saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/818c1a43c916-2b644d96-backup.hg
   rebase aborted
 
-When history-editing-backup = False:
+When backup-bundle = False:
   $ cat << EOF >> $HGRCPATH
-  > [ui]
-  > history-editing-backup = False
+  > [rewrite]
+  > backup-bundle = False
   > EOF
   $ hg rebase -s 5 -d .
   rebasing 5:1f8148a544ee "b"