diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -235,6 +235,9 @@ configitem('histedit', 'singletransaction', default=False, ) +configitem('edithistory', 'nobackup', + default=False, +) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should @@ -1111,7 +1114,7 @@ fm.startitem() goal = _getgoal(opts) revs = opts.get('rev', []) - nobackup = opts.get('no_backup') + nobackup = opts.get('no_backup') or ui.configbool('edithistory', 'nobackup') rules = opts.get('commands', '') state.keep = opts.get('keep', False) 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 nobackup config option| +=========================== +Test when `nobackup` 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 `nobackup` config option is enabled +Enable config option: + $ cat >>$HGRCPATH < [edithistory] + > nobackup=True + > 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