diff rust/hg-core/src/repo.rs @ 47407:6e49769b7f97

rhg: add exit code to HgError::Abort() My previous attempts to have rhg end with correct exit code was more of bug hunting. I found cases which were failing and fixed them. But as one might expect, more tests started failing. Let's add exit code `HgError::Abort()` and make it users explicitly tell what exit code they want. Differential Revision: https://phab.mercurial-scm.org/D10838
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 07 Jun 2021 17:27:49 +0530
parents 88119fffecc8
children ff97e793ed36
line wrap: on
line diff
--- a/rust/hg-core/src/repo.rs	Mon Jun 07 17:19:46 2021 +0530
+++ b/rust/hg-core/src/repo.rs	Mon Jun 07 17:27:49 2021 +0530
@@ -1,5 +1,6 @@
 use crate::config::{Config, ConfigError, ConfigParseError};
 use crate::errors::{HgError, IoErrorContext, IoResultExt};
+use crate::exit_codes;
 use crate::requirements;
 use crate::utils::files::get_path_from_bytes;
 use crate::utils::SliceExt;
@@ -150,6 +151,7 @@
                     Some(b"abort") | None => HgError::abort(
                         "abort: share source does not support share-safe requirement\n\
                         (see `hg help config.format.use-share-safe` for more information)",
+                        exit_codes::ABORT,
                     ),
                     _ => HgError::unsupported("share-safe downgrade"),
                 }
@@ -161,6 +163,7 @@
                             "abort: version mismatch: source uses share-safe \
                             functionality while the current share does not\n\
                             (see `hg help config.format.use-share-safe` for more information)",
+                        exit_codes::ABORT,
                         ),
                         _ => HgError::unsupported("share-safe upgrade"),
                     }