diff rust/hg-core/src/errors.rs @ 50239:491f3dd080eb stable

dirstate: deal with read-race for pure rust code path (rhg) If we cannot read the dirstate data, this is probably because a writing process wrote it under our feet. So refresh the docket and try again a handful of time.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 28 Feb 2023 19:36:46 +0100
parents 9f14126cfc4c
children de317a87ea6a
line wrap: on
line diff
--- a/rust/hg-core/src/errors.rs	Tue Feb 28 23:35:52 2023 +0100
+++ b/rust/hg-core/src/errors.rs	Tue Feb 28 19:36:46 2023 +0100
@@ -46,6 +46,9 @@
 
     /// Censored revision data.
     CensoredNodeError,
+    /// A race condition has been detected. This *must* be handled locally
+    /// and not directly surface to the user.
+    RaceDetected(String),
 }
 
 /// Details about where an I/O error happened
@@ -111,6 +114,9 @@
                 write!(f, "encountered a censored node")
             }
             HgError::ConfigValueParseError(error) => error.fmt(f),
+            HgError::RaceDetected(context) => {
+                write!(f, "encountered a race condition {context}")
+            }
         }
     }
 }