comparison rust/hg-cpython/src/revlog.rs @ 52158:f2eab4967bfc

rust-index: return an error on a bad index header This is more idiomatic and allows us to better handle the problem later.
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 10 Oct 2024 10:38:10 +0200
parents 3e135e79b7f7
children 7346f93be7a4
comparison
equal deleted inserted replaced
52157:46c68c0fe137 52158:f2eab4967bfc
630 Self::create_instance( 630 Self::create_instance(
631 py, 631 py,
632 hg::index::Index::new( 632 hg::index::Index::new(
633 bytes, 633 bytes,
634 IndexHeader::parse(&header.to_be_bytes()) 634 IndexHeader::parse(&header.to_be_bytes())
635 .expect("default header is broken") 635 .expect("default header is broken"),
636 .unwrap(),
637 ) 636 )
638 .map_err(|e| { 637 .map_err(|e| {
639 revlog_error_with_msg(py, e.to_string().as_bytes()) 638 revlog_error_with_msg(py, e.to_string().as_bytes())
640 })?, 639 })?,
641 RefCell::new(None), 640 RefCell::new(None),