--- a/mercurial/commands.py Fri Nov 24 03:44:50 2017 +0530
+++ b/mercurial/commands.py Tue Nov 28 05:50:45 2017 +0530
@@ -49,6 +49,7 @@
rcutil,
registrar,
revsetlang,
+ rewriteutil,
scmutil,
server,
sshserver,
@@ -1541,13 +1542,7 @@
raise error.Abort(_('cannot amend with ui.commitsubrepos enabled'))
old = repo['.']
- if not old.mutable():
- raise error.Abort(_('cannot amend public changesets'))
- if len(repo[None].parents()) > 1:
- raise error.Abort(_('cannot amend while merging'))
- allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
- if not allowunstable and old.children():
- raise error.Abort(_('cannot amend changeset with children'))
+ rewriteutil.precheck(repo, [old.rev()], 'amend')
# Currently histedit gets confused if an amend happens while histedit
# is in progress. Since we have a checkunfinished command, we are