changeset 6195:9e0aa8929206

fixup: use compat.StateError for missing state file
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 06 Mar 2022 18:15:54 +0300
parents 1e7190adffca
children 4a837da84f5f
files hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py tests/test-fixup.t
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Sun Mar 06 17:46:33 2022 +0300
+++ b/hgext3rd/evolve/cmdrewrite.py	Sun Mar 06 18:15:54 2022 +0300
@@ -1492,12 +1492,12 @@
     fixup_state = state.cmdstate(repo, b'fixup-state')
     if contopt:
         if not fixup_state.exists():
-            raise error.Abort(_(b'no interrupted fixup to continue'))
+            raise compat.StateError(_(b'no interrupted fixup to continue'))
         fixup_state.load()
         return continuefixup(ui, repo, fixup_state)
     if abortopt:
         if not fixup_state.exists():
-            raise error.Abort(_(b'no interrupted fixup to abort'))
+            raise compat.StateError(_(b'no interrupted fixup to abort'))
         fixup_state.load()
         return abortfixup(ui, repo, fixup_state)
 
--- a/hgext3rd/evolve/compat.py	Sun Mar 06 17:46:33 2022 +0300
+++ b/hgext3rd/evolve/compat.py	Sun Mar 06 18:15:54 2022 +0300
@@ -571,3 +571,9 @@
 else:
     # hg <= 5.6 (8d72e29ad1e0)
     InputError = error.Abort
+
+if util.safehasattr(error, 'StateError'):
+    StateError = error.StateError
+else:
+    # hg <= 5.6 (527ce85c2e60)
+    StateError = error.Abort
--- a/tests/test-fixup.t	Sun Mar 06 17:46:33 2022 +0300
+++ b/tests/test-fixup.t	Sun Mar 06 18:15:54 2022 +0300
@@ -297,11 +297,11 @@
 
   $ hg fixup --continue
   abort: no interrupted fixup to continue
-  [255]
+  [20]
 
   $ hg fixup --abort
   abort: no interrupted fixup to abort
-  [255]
+  [20]
 
 testing error cases