Show More
@@ -16,6 +16,8 b' use crate::revlog::revlog::RevlogError;' | |||||
16 | use crate::revlog::Revision; |
|
16 | use crate::revlog::Revision; | |
17 | use crate::utils::hg_path::HgPathBuf; |
|
17 | use crate::utils::hg_path::HgPathBuf; | |
18 |
|
18 | |||
|
19 | const METADATA_DELIMITER: [u8; 2] = [b'\x01', b'\n']; | |||
|
20 | ||||
19 | /// Kind of error encountered by `CatRev` |
|
21 | /// Kind of error encountered by `CatRev` | |
20 | #[derive(Debug)] |
|
22 | #[derive(Debug)] | |
21 | pub enum CatRevErrorKind { |
|
23 | pub enum CatRevErrorKind { | |
@@ -132,7 +134,18 b" impl<'a> CatRev<'a> {" | |||||
132 | .map_err(|_| CatRevErrorKind::CorruptedRevlog)?; |
|
134 | .map_err(|_| CatRevErrorKind::CorruptedRevlog)?; | |
133 | let file_rev = file_log.get_node_rev(&file_node)?; |
|
135 | let file_rev = file_log.get_node_rev(&file_node)?; | |
134 | let data = file_log.get_rev_data(file_rev)?; |
|
136 | let data = file_log.get_rev_data(file_rev)?; | |
135 | bytes.extend(data); |
|
137 | if data.starts_with(&METADATA_DELIMITER) { | |
|
138 | let end_delimiter_position = data | |||
|
139 | [METADATA_DELIMITER.len()..] | |||
|
140 | .windows(METADATA_DELIMITER.len()) | |||
|
141 | .position(|bytes| bytes == METADATA_DELIMITER); | |||
|
142 | if let Some(position) = end_delimiter_position { | |||
|
143 | let offset = METADATA_DELIMITER.len() * 2; | |||
|
144 | bytes.extend(data[position + offset..].iter()); | |||
|
145 | } | |||
|
146 | } else { | |||
|
147 | bytes.extend(data); | |||
|
148 | } | |||
136 | } |
|
149 | } | |
137 | } |
|
150 | } | |
138 | } |
|
151 | } |
@@ -90,3 +90,19 b' Debuging data in inline index' | |||||
90 | file1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc) |
|
90 | file1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc) | |
91 | file2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc) |
|
91 | file2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc) | |
92 | file3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc) |
|
92 | file3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc) | |
|
93 | ||||
|
94 | Cat files | |||
|
95 | $ cd $TESTTMP | |||
|
96 | $ rm -rf repository | |||
|
97 | $ hg init repository | |||
|
98 | $ cd repository | |||
|
99 | $ echo "original content" > original | |||
|
100 | $ hg add original | |||
|
101 | $ hg commit -m "add original" original | |||
|
102 | $ rhg cat -r 0 original | |||
|
103 | original content | |||
|
104 | Cat copied file should not display copy metadata | |||
|
105 | $ hg copy original copy_of_original | |||
|
106 | $ hg commit -m "add copy of original" | |||
|
107 | $ rhg cat -r 1 copy_of_original | |||
|
108 | original content |
General Comments 0
You need to be logged in to leave comments.
Login now