changeset 6322:57f9cdbf6a99

topic: use compat.CanceledError for user quit situations
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 10 Oct 2022 20:03:20 +0400
parents 58b856416d2e
children 68c67d53bb14
files hgext3rd/topic/compat.py hgext3rd/topic/flow.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/compat.py	Mon Oct 10 20:02:14 2022 +0400
+++ b/hgext3rd/topic/compat.py	Mon Oct 10 20:03:20 2022 +0400
@@ -64,6 +64,12 @@
     # hg <= 5.6 (527ce85c2e60)
     StateError = error.Abort
 
+if util.safehasattr(error, 'CanceledError'):
+    CanceledError = error.CanceledError
+else:
+    # hg <= 5.6 (ac362d5a7893)
+    CanceledError = error.Abort
+
 if util.safehasattr(cmdutil, 'check_at_most_one_arg'):
     def check_at_most_one_arg(opts, *args):
         return cmdutil.check_at_most_one_arg(opts, *args)
--- a/hgext3rd/topic/flow.py	Mon Oct 10 20:02:14 2022 +0400
+++ b/hgext3rd/topic/flow.py	Mon Oct 10 20:03:20 2022 +0400
@@ -169,7 +169,7 @@
                 _(b'push and publish %i changesets (yn)?$$ &Yes $$ &No')
                 % len(published)
             ):
-                raise error.Abort(_(b'user quit'))
+                raise compat.CanceledError(_(b'user quit'))
         elif behavior == b'abort':
             msg = _(b'push would publish %i changesets') % len(published)
             hint = _(