Changeset View
Changeset View
Standalone View
Standalone View
rust/hg-core/src/dirstate_tree/dispatch.rs
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Line(s) | fn pack_v1( | ||||
now: Timestamp, | now: Timestamp, | ||||
) -> Result<Vec<u8>, DirstateError>; | ) -> Result<Vec<u8>, DirstateError>; | ||||
/// Clear mtimes that are ambigous with `now` (similar to | /// Clear mtimes that are ambigous with `now` (similar to | ||||
/// `clear_ambiguous_times` but for all files in the dirstate map), and | /// `clear_ambiguous_times` but for all files in the dirstate map), and | ||||
/// serialize bytes to write a dirstate data file to disk in dirstate-v2 | /// serialize bytes to write a dirstate data file to disk in dirstate-v2 | ||||
/// format. | /// format. | ||||
/// | /// | ||||
/// Returns new data together with whether that data should be appended to | /// Returns new data and metadata together with whether that data should be | ||||
/// the existing data file whose content is at `self.on_disk` (true), | /// appended to the existing data file whose content is at | ||||
/// instead of written to a new data file (false). | /// `self.on_disk` (true), instead of written to a new data file | ||||
/// (false). | |||||
/// | /// | ||||
/// Note: this is only supported by the tree dirstate map. | /// Note: this is only supported by the tree dirstate map. | ||||
fn pack_v2( | fn pack_v2( | ||||
&mut self, | &mut self, | ||||
now: Timestamp, | now: Timestamp, | ||||
can_append: bool, | can_append: bool, | ||||
) -> Result<(Vec<u8>, bool), DirstateError>; | ) -> Result<(Vec<u8>, Vec<u8>, bool), DirstateError>; | ||||
/// Run the status algorithm. | /// Run the status algorithm. | ||||
/// | /// | ||||
/// This is not sematically a method of the dirstate map, but a different | /// This is not sematically a method of the dirstate map, but a different | ||||
/// algorithm is used for the flat v.s. tree dirstate map so having it in | /// algorithm is used for the flat v.s. tree dirstate map so having it in | ||||
/// this trait enables the same dynamic dispatch as with other methods. | /// this trait enables the same dynamic dispatch as with other methods. | ||||
fn status<'a>( | fn status<'a>( | ||||
&'a mut self, | &'a mut self, | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Line(s) | impl DirstateMapMethods for DirstateMap { | ||||
) -> Result<Vec<u8>, DirstateError> { | ) -> Result<Vec<u8>, DirstateError> { | ||||
self.pack(parents, now) | self.pack(parents, now) | ||||
} | } | ||||
fn pack_v2( | fn pack_v2( | ||||
&mut self, | &mut self, | ||||
_now: Timestamp, | _now: Timestamp, | ||||
_can_append: bool, | _can_append: bool, | ||||
) -> Result<(Vec<u8>, bool), DirstateError> { | ) -> Result<(Vec<u8>, Vec<u8>, bool), DirstateError> { | ||||
panic!( | panic!( | ||||
"should have used dirstate_tree::DirstateMap to use the v2 format" | "should have used dirstate_tree::DirstateMap to use the v2 format" | ||||
) | ) | ||||
} | } | ||||
fn status<'a>( | fn status<'a>( | ||||
&'a mut self, | &'a mut self, | ||||
matcher: &'a (dyn Matcher + Sync), | matcher: &'a (dyn Matcher + Sync), | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |