diff rust/hg-core/src/lib.rs @ 43808:1fe2e574616e

rust-dirs: address failing tests for `dirs` impl with a temporary fix https://phab.mercurial-scm.org/D7252 (5d40317d42b7083b49467502549e25f144888cb3) introduced a regression in Rust tests. This is a temporary fix that replicates the behavior of the C and Python impl, pending the resolution of the discussion (in the phabricator link) about how we actually want to solve this problem. Differential Revision: https://phab.mercurial-scm.org/D7503
author Rapha?l Gom?s <rgomes@octobus.net>
date Fri, 22 Nov 2019 10:39:05 +0100
parents a77d4fe347a4
children 5ac243a92e37
line wrap: on
line diff
--- a/rust/hg-core/src/lib.rs	Sun Dec 01 18:46:10 2019 -0500
+++ b/rust/hg-core/src/lib.rs	Fri Nov 22 10:39:05 2019 +0100
@@ -101,6 +101,20 @@
 pub enum DirstateMapError {
     PathNotFound(HgPathBuf),
     EmptyPath,
+    ConsecutiveSlashes,
+}
+
+impl ToString for DirstateMapError {
+    fn to_string(&self) -> String {
+        use crate::DirstateMapError::*;
+        match self {
+            PathNotFound(_) => "expected a value, found none".to_string(),
+            EmptyPath => "Overflow in dirstate.".to_string(),
+            ConsecutiveSlashes => {
+                "found invalid consecutive slashes in path".to_string()
+            }
+        }
+    }
 }
 
 pub enum DirstateError {