Comments
Patch
@@ -1294,11 +1294,11 @@ def commit(ui, repo, *pats, **opts):
raise util.Abort(_('cannot amend public changesets'))
if len(old.parents()) > 1:
raise util.Abort(_('cannot amend merge changesets'))
if len(repo[None].parents()) > 1:
raise util.Abort(_('cannot amend while merging'))
- if old.children():
+ if obsolete.preventunstable(ui) and old.children():
raise util.Abort(_('cannot amend changeset with children'))
e = cmdutil.commiteditor
if opts.get('force_editor'):
e = cmdutil.commitforceeditor
@@ -456,5 +456,28 @@ Test that amend does not make it easy to
$ hg revert -ar 14
reverting a
$ hg commit --amend
$ hg id
b99e5df575f7 (a) tip
+
+Test ui.prevent-unstable
+---------------------------------------------------------------------
+
+ $ hg up '.^'
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo 'b' >> a
+ $ hg commit --amend
+ abort: cannot amend changeset with children
+ [255]
+ $ cat >> $HGRCPATH << EOF
+ > [ui]
+ > prevent-unstable=False
+ > EOF
+ $ hg commit --amend
+ $ hg log -r 'unstable()'
+ changeset: 18:b99e5df575f7
+ branch: a
+ parent: 11:3334b7925910
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: babar
+