rhg: propogate error coming from HgError::Abort to CommandError
authorPulkit Goyal <7895pulkit@gmail.com>
Mon, 07 Jun 2021 17:29:32 +0530
changeset 47408 7954ee2d7cf7
parent 47407 6e49769b7f97
child 47409 0ef8231e413f
rhg: propogate error coming from HgError::Abort to CommandError Differential Revision: https://phab.mercurial-scm.org/D10839
rust/rhg/src/error.rs
tests/test-globalopts.t
--- a/rust/rhg/src/error.rs	Mon Jun 07 17:27:49 2021 +0530
+++ b/rust/rhg/src/error.rs	Mon Jun 07 17:29:32 2021 +0530
@@ -69,6 +69,12 @@
             HgError::UnsupportedFeature(message) => {
                 CommandError::unsupported(message)
             }
+            HgError::Abort {
+                message,
+                detailed_exit_code,
+            } => {
+                CommandError::abort_with_exit_code(message, detailed_exit_code)
+            }
             _ => CommandError::abort(error.to_string()),
         }
     }
--- a/tests/test-globalopts.t	Mon Jun 07 17:27:49 2021 +0530
+++ b/tests/test-globalopts.t	Mon Jun 07 17:29:32 2021 +0530
@@ -220,7 +220,6 @@
   $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
   quuxfoo
 TODO: add rhg support for detailed exit codes
-#if no-rhg
   $ hg --cwd c --config '' tip -q
   abort: malformed --config option: '' (use --config section.name=value)
   [10]
@@ -236,7 +235,6 @@
   $ hg --cwd c --config .b= tip -q
   abort: malformed --config option: '.b=' (use --config section.name=value)
   [10]
-#endif
 
 Testing --debug: