diff --git a/hgext/uncommit.py b/hgext/uncommit.py
index 490df753894d65f76cc638ad918712a6b24aeeb0_aGdleHQvdW5jb21taXQucHk=..98f97eb2059767ce1d659cd9c929ca69b21b7450_aGdleHQvdW5jb21taXQucHk= 100644
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -28,7 +28,6 @@
     copies,
     error,
     node,
-    obsolete,
     obsutil,
     pycompat,
     registrar,
@@ -32,6 +31,7 @@
     obsutil,
     pycompat,
     registrar,
+    rewriteutil,
     scmutil,
 )
 
@@ -155,8 +155,7 @@
     opts = pycompat.byteskwargs(opts)
 
     with repo.wlock(), repo.lock():
-        wctx = repo[None]
 
         if not pats and not repo.ui.configbool('experimental',
                                                 'uncommitondirtywdir'):
             cmdutil.bailifchanged(repo)
@@ -159,9 +158,5 @@
 
         if not pats and not repo.ui.configbool('experimental',
                                                 'uncommitondirtywdir'):
             cmdutil.bailifchanged(repo)
-        if wctx.parents()[0].node() == node.nullid:
-            raise error.Abort(_("cannot uncommit null changeset"))
-        if len(wctx.parents()) > 1:
-            raise error.Abort(_("cannot uncommit while merging"))
         old = repo['.']
@@ -167,5 +162,4 @@
         old = repo['.']
-        if not old.mutable():
-            raise error.Abort(_('cannot uncommit public changesets'))
+        rewriteutil.precheck(repo, [old.rev()], 'uncommit')
         if len(old.parents()) > 1:
             raise error.Abort(_("cannot uncommit merge changeset"))
@@ -170,8 +164,5 @@
         if len(old.parents()) > 1:
             raise error.Abort(_("cannot uncommit merge changeset"))
-        allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
-        if not allowunstable and old.children():
-            raise error.Abort(_('cannot uncommit changeset with children'))
 
         with repo.transaction('uncommit'):
             match = scmutil.match(old, pats, opts)
diff --git a/mercurial/commands.py b/mercurial/commands.py
index 490df753894d65f76cc638ad918712a6b24aeeb0_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..98f97eb2059767ce1d659cd9c929ca69b21b7450_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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
diff --git a/tests/test-amend.t b/tests/test-amend.t
index 490df753894d65f76cc638ad918712a6b24aeeb0_dGVzdHMvdGVzdC1hbWVuZC50..98f97eb2059767ce1d659cd9c929ca69b21b7450_dGVzdHMvdGVzdC1hbWVuZC50 100644
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -213,6 +213,7 @@
   $ hg update -C -q A
   $ hg amend -m AMEND
   abort: cannot amend public changesets
+  (see 'hg help phases' for details)
   [255]
 
 Amend a merge changeset
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
index 490df753894d65f76cc638ad918712a6b24aeeb0_dGVzdHMvdGVzdC1jb21taXQtYW1lbmQudA==..98f97eb2059767ce1d659cd9c929ca69b21b7450_dGVzdHMvdGVzdC1jb21taXQtYW1lbmQudA== 100644
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -16,6 +16,7 @@
   $ hg phase -r . -p
   $ hg ci --amend
   abort: cannot amend public changesets
+  (see 'hg help phases' for details)
   [255]
   $ hg phase -r . -f -d
 
diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
index 490df753894d65f76cc638ad918712a6b24aeeb0_dGVzdHMvdGVzdC11bmNvbW1pdC50..98f97eb2059767ce1d659cd9c929ca69b21b7450_dGVzdHMvdGVzdC11bmNvbW1pdC50 100644
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -41,6 +41,7 @@
 
   $ hg uncommit
   abort: cannot uncommit null changeset
+  (no changeset checked out)
   [255]
 
 Create some commits