# HG changeset patch # User Antoine Cezar # Date 2020-06-05 06:46:35 # Node ID a46e36b824612be16b38a1c1cd11160c293d115b # Parent 26114bd6ec60cb48b5dc52946c2f51a5fb698c7a hg-core: add Operation interface for high-level hg operations A distinction is made between operations and commands. An operation is a high-level function of mercurial whereas a command is what is exposed by the cli. A single command can use several operations to achieve its goal. Differential Revision: https://phab.mercurial-scm.org/D8608 diff --git a/rust/hg-core/src/lib.rs b/rust/hg-core/src/lib.rs --- a/rust/hg-core/src/lib.rs +++ b/rust/hg-core/src/lib.rs @@ -23,6 +23,7 @@ mod filepatterns; pub mod matchers; pub mod revlog; pub use revlog::*; +pub mod operations; pub mod utils; // Remove this to see (potential) non-artificial compile failures. MacOS diff --git a/rust/hg-core/src/operations/mod.rs b/rust/hg-core/src/operations/mod.rs new file mode 100644 --- /dev/null +++ b/rust/hg-core/src/operations/mod.rs @@ -0,0 +1,9 @@ +/// An interface for high-level hg operations. +/// +/// A distinction is made between operation and commands. +/// An operation is what can be done whereas a command is what is exposed by +/// the cli. A single command can use several operations to achieve its goal. +pub trait Operation { + type Error; + fn run(&self) -> Result; +}