This is an archive of the discontinued Mercurial Phabricator instance.

amend: support "history-editing-backup" config option
ClosedPublic

Authored by khanchi97 on Jul 20 2018, 4:04 PM.

Details

Summary

Now, amend is in the list of those history editing commands
which support history-editing-backup config option.
If you don't want to store any backup then just use this config.
[ui]
hisotry-editing-backup = False

Current status of list of history editing commands which support
this config:

  1. histedit
  2. rebase
  3. amend

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

khanchi97 created this revision.Jul 20 2018, 4:04 PM
yuja added a subscriber: yuja.Aug 2 2018, 9:49 AM
  • a/mercurial/cmdutil.py

+++ b/mercurial/cmdutil.py
@@ -2556,8 +2556,10 @@

obsmetadata = None
if opts.get('note'):
    obsmetadata = {'note': encoding.fromlocal(opts['note'])}

+ backup = opts.get('backup')

scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata,
  • fixphase=True, targetphase=commitphase)

+ fixphase=True, targetphase=commitphase,
+ backup=backup)

  1. Fixing the dirstate because localrepo.commitctx does not update
  2. it. This is rather convenient because we did not need to update

diff --git a/hgext/amend.py b/hgext/amend.py

  • a/hgext/amend.py

+++ b/hgext/amend.py
@@ -54,4 +54,6 @@

if not opts.get('logfile'):
    opts['message'] = opts.get('message') or repo['.'].description()
opts['amend'] = True

+ backup = ui.configbool('ui', 'history-editing-backup')
+ opts['backup'] = backup

return commands._docommit(ui, repo, *pats, **pycompat.strkwargs(opts))

No need to pass by opts since cmdutil.amend() can read ui.config.

khanchi97 updated this revision to Diff 9794.Aug 2 2018, 2:59 PM
This revision was automatically updated to reflect the committed changes.

@yuja Is there any command left which we can consider to add
'history-editing-backup' config option?