sum_tree: Store context on cursor (#34904)
This gets rid of the need to pass context to all cursor functions. In practice context is always immutable when interacting with cursors. A nicety of this is in the follow-up PR we will be able to implement Iterator for all Cursors/filter cursors (hell, we may be able to get rid of filter cursor altogether, as it is just a custom `filter` impl on iterator trait). Release Notes: - N/A
This commit is contained in:
parent
fa3e1ccc37
commit
64d0fec699
23 changed files with 749 additions and 876 deletions
|
@ -72,14 +72,13 @@ impl<'a> GitTraversal<'a> {
|
|||
|
||||
if entry.is_dir() {
|
||||
let mut statuses = statuses.clone();
|
||||
statuses.seek_forward(&PathTarget::Path(repo_path.as_ref()), Bias::Left, &());
|
||||
let summary =
|
||||
statuses.summary(&PathTarget::Successor(repo_path.as_ref()), Bias::Left, &());
|
||||
statuses.seek_forward(&PathTarget::Path(repo_path.as_ref()), Bias::Left);
|
||||
let summary = statuses.summary(&PathTarget::Successor(repo_path.as_ref()), Bias::Left);
|
||||
|
||||
self.current_entry_summary = Some(summary);
|
||||
} else if entry.is_file() {
|
||||
// For a file entry, park the cursor on the corresponding status
|
||||
if statuses.seek_forward(&PathTarget::Path(repo_path.as_ref()), Bias::Left, &()) {
|
||||
if statuses.seek_forward(&PathTarget::Path(repo_path.as_ref()), Bias::Left) {
|
||||
// TODO: Investigate statuses.item() being None here.
|
||||
self.current_entry_summary = statuses.item().map(|item| item.status.into());
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue