comparison rust/hg-core/src/errors.rs @ 49697: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
comparison
equal deleted inserted replaced
49696:c9066fc609ef 49697:491f3dd080eb
44 #[from] 44 #[from]
45 ConfigValueParseError(ConfigValueParseError), 45 ConfigValueParseError(ConfigValueParseError),
46 46
47 /// Censored revision data. 47 /// Censored revision data.
48 CensoredNodeError, 48 CensoredNodeError,
49 /// A race condition has been detected. This *must* be handled locally
50 /// and not directly surface to the user.
51 RaceDetected(String),
49 } 52 }
50 53
51 /// Details about where an I/O error happened 54 /// Details about where an I/O error happened
52 #[derive(Debug)] 55 #[derive(Debug)]
53 pub enum IoErrorContext { 56 pub enum IoErrorContext {
109 } 112 }
110 HgError::CensoredNodeError => { 113 HgError::CensoredNodeError => {
111 write!(f, "encountered a censored node") 114 write!(f, "encountered a censored node")
112 } 115 }
113 HgError::ConfigValueParseError(error) => error.fmt(f), 116 HgError::ConfigValueParseError(error) => error.fmt(f),
117 HgError::RaceDetected(context) => {
118 write!(f, "encountered a race condition {context}")
119 }
114 } 120 }
115 } 121 }
116 } 122 }
117 123
118 // TODO: use `DisplayBytes` instead to show non-Unicode filenames losslessly? 124 // TODO: use `DisplayBytes` instead to show non-Unicode filenames losslessly?