rust/hg-core/src/operations/list_tracked_files.rs
changeset 45436 1b3197047f5c
parent 45359 0f5286ccf82c
child 45535 72b7d58d6e35
--- a/rust/hg-core/src/operations/list_tracked_files.rs	Tue Sep 08 19:36:40 2020 +0530
+++ b/rust/hg-core/src/operations/list_tracked_files.rs	Thu Jul 30 16:55:44 2020 +0200
@@ -14,7 +14,7 @@
 use std::fmt;
 use std::fs;
 use std::io;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
 
 /// Kind of error encoutered by ListTrackedFiles
 #[derive(Debug)]
@@ -60,6 +60,15 @@
         let content = fs::read(&dirstate)?;
         Ok(ListDirstateTrackedFiles { content })
     }
+
+    /// Returns the repository root directory
+    /// TODO I think this is a crutch that creates a dependency that should not
+    /// be there. Operations that need the root of the repository should get
+    /// it themselves, probably in a lazy fashion. But this would make the
+    /// current series even larger, so this is simplified for now.
+    pub fn get_root(&self) -> &Path {
+        &self.root
+    }
 }
 
 /// List files under Mercurial control in the working directory