Patchwork D3901: histedit: add history-editing-backup config option

login
register
mail settings
Submitter phabricator
Date July 18, 2018, 5:29 p.m.
Message ID <f03444d409ca3a1ab7f789a50c7769a6@localhost.localdomain>
Download mbox | patch
Permalink /patch/32904/
State Not Applicable
Headers show

Comments

phabricator - July 18, 2018, 5:29 p.m.
khanchi97 updated this revision to Diff 9625.
khanchi97 edited the summary of this revision.
khanchi97 retitled this revision from "histedit: add nobackup config option" to "histedit: add history-editing-backup config option".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3901?vs=9531&id=9625

REVISION DETAIL
  https://phab.mercurial-scm.org/D3901

AFFECTED FILES
  hgext/histedit.py
  mercurial/configitems.py
  tests/test-histedit-no-backup.t

CHANGE DETAILS




To: khanchi97, durin42, #hg-reviewers
Cc: pulkit, yuja, mercurial-devel

Patch

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
@@ -93,3 +93,41 @@ 
   o  0   36b4bdd91f5b   1970-01-01 00:00 +0000   test
        one
   
+======================================
+Test histediting_backup config option|
+======================================
+Test when `histediting_backup` config option is not enabled:
+  $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
+  > pick 36b4bdd91f5b 0 one
+  > pick 6153eb23e623 1 two
+  > roll 80d23dfa866d 2 three
+  > edit 7d5187087c79 3 four
+  > EOF
+  merging file
+  Editing (7d5187087c79), you may commit or record as needed now.
+  (hg histedit --continue to resume)
+  [1]
+  $ hg histedit --abort
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  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 `histediting_backup` config option is enabled
+Enable config option:
+  $ cat >>$HGRCPATH <<EOF
+  > [ui]
+  > history-editing-backup=False
+  > EOF
+
+  $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
+  > pick 36b4bdd91f5b 0 one
+  > pick 6153eb23e623 1 two
+  > roll 80d23dfa866d 2 three
+  > edit 7d5187087c79 3 four
+  > EOF
+  merging file
+  Editing (7d5187087c79), you may commit or record as needed now.
+  (hg histedit --continue to resume)
+  [1]
+  $ hg histedit --abort
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1084,6 +1084,9 @@ 
 coreconfigitem('ui', 'graphnodetemplate',
     default=None,
 )
+coreconfigitem('ui', 'history-editing-backup',
+    default=True,
+)
 coreconfigitem('ui', 'interactive',
     default=None,
 )
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1111,7 +1111,9 @@ 
     fm.startitem()
     goal = _getgoal(opts)
     revs = opts.get('rev', [])
-    nobackup = opts.get('no_backup')
+    nobackup = (opts.get('no_backup') or
+                not ui.configbool('ui', 'history-editing-backup'))
+    # experimental config: ui.history-editing-backup
     rules = opts.get('commands', '')
     state.keep = opts.get('keep', False)