Mercurial > public > mercurial-scm > hg-stable
comparison rust/rhg/src/commands/status.rs @ 48532:e293ff808a05
rhg: Use binary search in manifest lookup
? instead of linear scan, when looking for a single entry based on its path.
Manifest entries are sorted by path, but are variable-size so we can?t use
the standard library?s `[T]::binary_search`. We can still jump to a byte
index and then look around for entry boundaries.
Differential Revision: https://phab.mercurial-scm.org/D11932
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 16 Dec 2021 17:34:51 +0100 |
parents | b005d07ded7d |
children | 4afb9627dc77 |
comparison
equal
deleted
inserted
replaced
48531:d3ec82016104 | 48532:e293ff808a05 |
---|---|
471 } else { | 471 } else { |
472 None | 472 None |
473 }; | 473 }; |
474 | 474 |
475 let entry = manifest | 475 let entry = manifest |
476 .find_file(hg_path)? | 476 .find_by_path(hg_path)? |
477 .expect("ambgious file not in p1"); | 477 .expect("ambgious file not in p1"); |
478 if entry.flags != fs_flags { | 478 if entry.flags != fs_flags { |
479 return Ok(true); | 479 return Ok(true); |
480 } | 480 } |
481 let filelog = repo.filelog(hg_path)?; | 481 let filelog = repo.filelog(hg_path)?; |