[Updated] [+ ] D8611: rhg: add Command trait for subcommands implemented by rhg

acezar (Antoine Cezar) phabricator at mercurial-scm.org
Wed Jun 17 08:26:17 UTC 2020


acezar updated this revision to Diff 21656.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8611?vs=21652&id=21656

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8611/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8611

AFFECTED FILES
  rust/rhg/src/commands.rs
  rust/rhg/src/error.rs
  rust/rhg/src/main.rs

CHANGE DETAILS

diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs
--- a/rust/rhg/src/main.rs
+++ b/rust/rhg/src/main.rs
@@ -1,3 +1,5 @@
+mod commands;
+mod error;
 mod exitcode;
 
 fn main() {
diff --git a/rust/rhg/src/error.rs b/rust/rhg/src/error.rs
new file mode 100644
--- /dev/null
+++ b/rust/rhg/src/error.rs
@@ -0,0 +1,4 @@
+
+/// The error type for the Command trait
+#[derive(Debug, PartialEq)]
+pub struct CommandError {}
diff --git a/rust/rhg/src/commands.rs b/rust/rhg/src/commands.rs
new file mode 100644
--- /dev/null
+++ b/rust/rhg/src/commands.rs
@@ -0,0 +1,8 @@
+use crate::error::CommandError;
+
+/// The common trait for rhg commands
+///
+/// Normalize the interface of the commands provided by rhg
+pub trait Command {
+    fn run(&self) -> Result<(), CommandError>;
+}



To: acezar, #hg-reviewers, marmoute, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200617/79e90a62/attachment-0002.html>


More information about the Mercurial-patches mailing list