comparison rust/hg-core/src/utils/files.rs @ 52781:6183949219b2

rhg: implement rhg annotate This initial implementation produces the same output as Python for all the files I've tried, and is usually 1.5-9x faster. The algorithm is mostly the same, but one key difference is that the Rust implementation only converts filelog revisions to changelog revisions if they will actually appear in the output. This does not support all the command line flags yet. In particular, --template, --include, --exclude, --skip, and whitespace-related flags will cause fallback to Python. Also, --rev 'wdir()' (often used by editor plugins) is not supported. There is also no pager.
author Mitchell Kember <mkember@janestreet.com>
date Fri, 24 Jan 2025 12:01:12 -0500
parents 94e2547e6f3d
children
comparison
equal deleted inserted replaced
52780:549b58b1ce72 52781:6183949219b2
331 .into_file() 331 .into_file()
332 .metadata()? 332 .metadata()?
333 .modified() 333 .modified()
334 } 334 }
335 335
336 /// Returns true if file content is considered to be binary (not text).
337 pub fn is_binary(content: &[u8]) -> bool {
338 // Matches binary() in utils/stringutil.py.
339 !content.is_empty() && memchr::memchr(b'\0', content).is_some()
340 }
341
336 #[cfg(test)] 342 #[cfg(test)]
337 mod tests { 343 mod tests {
338 use super::*; 344 use super::*;
339 use pretty_assertions::assert_eq; 345 use pretty_assertions::assert_eq;
340 346