Show More
@@ -32,6 +32,8 b' const REVIDX_KNOWN_FLAGS: u16 = REVISION' | |||||
32 | | REVISION_FLAG_EXTSTORED |
|
32 | | REVISION_FLAG_EXTSTORED | |
33 | | REVISION_FLAG_HASCOPIESINFO; |
|
33 | | REVISION_FLAG_HASCOPIESINFO; | |
34 |
|
34 | |||
|
35 | const NULL_REVLOG_ENTRY_FLAGS: u16 = 0; | |||
|
36 | ||||
35 | #[derive(derive_more::From)] |
|
37 | #[derive(derive_more::From)] | |
36 | pub enum RevlogError { |
|
38 | pub enum RevlogError { | |
37 | InvalidRevision, |
|
39 | InvalidRevision, | |
@@ -262,11 +264,29 b' impl Revlog {' | |||||
262 | } |
|
264 | } | |
263 | } |
|
265 | } | |
264 |
|
266 | |||
|
267 | pub fn make_null_entry(&self) -> RevlogEntry { | |||
|
268 | RevlogEntry { | |||
|
269 | revlog: self, | |||
|
270 | rev: NULL_REVISION, | |||
|
271 | bytes: b"", | |||
|
272 | compressed_len: 0, | |||
|
273 | uncompressed_len: 0, | |||
|
274 | base_rev_or_base_of_delta_chain: None, | |||
|
275 | p1: NULL_REVISION, | |||
|
276 | p2: NULL_REVISION, | |||
|
277 | flags: NULL_REVLOG_ENTRY_FLAGS, | |||
|
278 | hash: NULL_NODE, | |||
|
279 | } | |||
|
280 | } | |||
|
281 | ||||
265 | /// Get an entry of the revlog. |
|
282 | /// Get an entry of the revlog. | |
266 | pub fn get_entry( |
|
283 | pub fn get_entry( | |
267 | &self, |
|
284 | &self, | |
268 | rev: Revision, |
|
285 | rev: Revision, | |
269 | ) -> Result<RevlogEntry, RevlogError> { |
|
286 | ) -> Result<RevlogEntry, RevlogError> { | |
|
287 | if rev == NULL_REVISION { | |||
|
288 | return Ok(self.make_null_entry()); | |||
|
289 | } | |||
270 | let index_entry = self |
|
290 | let index_entry = self | |
271 | .index |
|
291 | .index | |
272 | .get_entry(rev) |
|
292 | .get_entry(rev) |
@@ -78,12 +78,6 b' This is what we did to produce the repo ' | |||||
78 | $ hg debugdeltachain a |
|
78 | $ hg debugdeltachain a | |
79 | rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks |
|
79 | rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks | |
80 | 0 1 2 -1 p1 15 3 15 5.00000 15 0 0.00000 15 15 1.00000 1 |
|
80 | 0 1 2 -1 p1 15 3 15 5.00000 15 0 0.00000 15 15 1.00000 1 | |
81 | #if rhg |
|
|||
82 | $ hg cat --config rhg.cat=true -r 0 a |
|
|||
83 | abort: corrupted revlog |
|
|||
84 | [255] |
|
|||
85 | #else |
|
|||
86 | $ hg cat --config rhg.cat=true -r 0 a |
|
81 | $ hg cat --config rhg.cat=true -r 0 a | |
87 | hi |
|
82 | hi | |
88 | #endif |
|
|||
89 | $ cd .. |
|
83 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now