Patchwork D8773: hg-core: define a `ListTrackedFiles` `Operation`

login
register
mail settings
Submitter phabricator
Date July 21, 2020, 2:06 p.m.
Message ID <differential-rev-PHID-DREV-3b4stdarr6rzgj2x4ivv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46817/
State Superseded
Headers show

Comments

phabricator - July 21, 2020, 2:06 p.m.
acezar created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  List files under Mercurial control in the working directory
  by reading the dirstate at .hg/dirstate.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/operations/list_tracked_files.rs
  rust/hg-core/src/operations/mod.rs

CHANGE DETAILS




To: acezar, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/operations/mod.rs b/rust/hg-core/src/operations/mod.rs
--- a/rust/hg-core/src/operations/mod.rs
+++ b/rust/hg-core/src/operations/mod.rs
@@ -1,4 +1,5 @@ 
 mod find_root;
+mod list_tracked_files;
 pub use find_root::{FindRoot, FindRootError, FindRootErrorKind};
 
 /// An interface for high-level hg operations.
diff --git a/rust/hg-core/src/operations/list_tracked_files.rs b/rust/hg-core/src/operations/list_tracked_files.rs
new file mode 100644
--- /dev/null
+++ b/rust/hg-core/src/operations/list_tracked_files.rs
@@ -0,0 +1,34 @@ 
+use super::Operation;
+use crate::utils::hg_path::HgPathBuf;
+use std::fmt;
+
+/// Kind of error encoutered by ListTrackedFiles
+#[derive(Debug)]
+pub enum ListTrackedFilesErrorKind {}
+
+/// A ListTrackedFiles error
+#[derive(Debug)]
+pub struct ListTrackedFilesError {
+    /// Kind of error encoutered by ListTrackedFiles
+    pub kind: ListTrackedFilesErrorKind,
+}
+
+impl std::error::Error for ListTrackedFilesError {}
+
+impl fmt::Display for ListTrackedFilesError {
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
+    }
+}
+
+/// List files under Mercurial control in the working directory
+/// by reading the dirstate at .hg/dirstate
+pub struct ListTrackedFiles {}
+
+impl Operation<Vec<HgPathBuf>> for ListTrackedFiles {
+    type Error = ListTrackedFilesError;
+
+    fn run(&self) -> Result<Vec<HgPathBuf>, Self::Error> {
+        unimplemented!()
+    }
+}