strip: use bailifchanged() instead of reimplementing it
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 17 Jun 2019 10:19:41 -0700
changeset 42491 1474f5d84662
parent 42490 3a1988e915f9
child 42492 4bcabb5ae9b6
strip: use bailifchanged() instead of reimplementing it This also means that we get the standard error messages (see changed test cases). Differential Revision: https://phab.mercurial-scm.org/D6535
hgext/strip.py
tests/test-mq.t
tests/test-strip.t
--- a/hgext/strip.py	Mon Jun 17 10:40:24 2019 -0700
+++ b/hgext/strip.py	Mon Jun 17 10:19:41 2019 -0700
@@ -50,15 +50,7 @@
     cmdutil.checkunfinished(repo)
     s = repo.status()
     if not force:
-        if len(repo[None].parents()) > 1:
-            _("outstanding uncommitted merge") #i18 tool detection
-            raise error.Abort(_("outstanding uncommitted merge"))
-        if s.modified or s.added or s.removed or s.deleted:
-            _("local changes found") # i18n tool detection
-            raise error.Abort(_("local changes found"))
-        if checksubstate(repo):
-            _("local changed subrepos found") # i18n tool detection
-            raise error.Abort(_("local changed subrepos found"))
+        cmdutil.bailifchanged(repo)
     return s
 
 def _findupdatetarget(repo, nodes):
--- a/tests/test-mq.t	Mon Jun 17 10:40:24 2019 -0700
+++ b/tests/test-mq.t	Mon Jun 17 10:19:41 2019 -0700
@@ -811,7 +811,7 @@
   $ echo y>y
   $ hg add y
   $ hg strip tip
-  abort: local changes found
+  abort: uncommitted changes
   [255]
 
 --force strip with local changes
--- a/tests/test-strip.t	Mon Jun 17 10:40:24 2019 -0700
+++ b/tests/test-strip.t	Mon Jun 17 10:19:41 2019 -0700
@@ -551,7 +551,7 @@
 
   $ echo c > b
   $ hg strip tip
-  abort: local changes found
+  abort: uncommitted changes
   [255]
   $ hg strip tip --keep
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
@@ -703,7 +703,7 @@
   $ echo a > a
   $ hg add a
   $ hg strip -B B
-  abort: local changes found
+  abort: uncommitted changes
   [255]
   $ hg bookmarks
    * B                         6:ff43616e5d0f