partition the change files diffs on whether they have content

[?]
Apr 23, 2025, 7:22 AM
UMO6U2ZTJ6LTWJXAKQMEJO2MCMFSJZJZ6UZ2SPY2FPU4OPVKPIMAC

Dependencies

  • [2] YBJRDOTC make all repo actions async
  • [3] 4WO3ZJM2 show untracked files' contents
  • [4] W4LFX7IH group diffs by file name
  • [5] AMPZ2BXK show changed files diffs (only Edit atm)
  • [6] V55EAIWQ add src file LRU cache
  • [7] NRCUG4R2 load changed files src when selected
  • [8] Y5ATDI2H convert changed file diffs and load src only if any needs it
  • [9] YBLPPHZN show contents for move, del and undel
  • [10] RPCIGCNS add replacement diff details
  • [11] IQDCHWCP load a pijul repo
  • [12] KT5UYXGK fix selection after adding file, add changed file diffs
  • [*] SWWE2R6M display basic repo stuff
  • [*] 6YZAVBWU Initial commit

Change contents

  • edit in crates/libflowers_client/src/repo.rs at line 24
    [2.97]
    [2.97]
    pub const ROOT_FILE: &str = ".";
    pub const MAX_LEN_BASE64_DISPLAY: usize = 4096;
  • edit in crates/libflowers_client/src/repo.rs at line 47
    [4.188][4.188:221](),[4.221][5.120:168]()
    pub const ROOT_FILE: &str = ".";
    pub const MAX_LEN_BASE64_DISPLAY: usize = 4096;
  • edit in crates/libflowers_client/src/repo.rs at line 58
    [3.206]
    [3.206]
    /// Is the content deleted
  • edit in crates/flowers_ui/src/main.rs at line 167
    [6.1792][7.22:75](),[7.75][8.209:259]()
    /// The order of the vec matches `repo::ChangedFile`
    type ChangedFileContents = Vec<ChangedFileDiff>;
  • replacement in crates/flowers_ui/src/main.rs at line 168
    [8.276][8.276:399]()
    enum ChangedFileDiff {
    WithContents(ChangedFileDiffWithContents),
    WithoutContents(ChangedFileDiffWithoutContents),
    [8.276]
    [8.399]
    struct ChangedFileContents {
    with_contents: Vec<ChangedFileDiffWithContents>,
    without_contents: Vec<ChangedFileDiffWithoutContents>,
  • replacement in crates/flowers_ui/src/main.rs at line 871
    [5.3059][5.3059:3090](),[5.3090][8.3018:3118](),[8.3118][5.4229:4266](),[5.4229][5.4229:4266]()
    .map(|(file, diffs)| {
    let contents =
    diffs.iter().map(changed_file_diff_from_repo).collect();
    (file.clone(), contents)
    [5.3059]
    [5.4266]
    .map(|(path, diffs)| {
    let contents = changed_file_contents(diffs);
    (path.clone(), contents)
  • replacement in crates/flowers_ui/src/main.rs at line 878
    [5.4299][8.3119:3227](),[8.3227][9.53:437](),[9.437][8.3629:4772](),[8.3629][8.3629:4772]()
    fn changed_file_diff_from_repo(
    value: &repo::ChangedFileDiff,
    ) -> ChangedFileDiff {
    match value {
    repo::ChangedFileDiff::Move => {
    ChangedFileDiff::WithContents(ChangedFileDiffWithContents::Move)
    }
    repo::ChangedFileDiff::Del => {
    ChangedFileDiff::WithContents(ChangedFileDiffWithContents::Del)
    }
    repo::ChangedFileDiff::Undel => {
    ChangedFileDiff::WithContents(ChangedFileDiffWithContents::Undel)
    }
    repo::ChangedFileDiff::Add => {
    ChangedFileDiff::WithContents(ChangedFileDiffWithContents::Add)
    }
    repo::ChangedFileDiff::SolveNameConflict => {
    ChangedFileDiff::WithoutContents(
    ChangedFileDiffWithoutContents::SolveNameConflict,
    )
    }
    repo::ChangedFileDiff::UnsolveNameConflict => {
    ChangedFileDiff::WithoutContents(
    ChangedFileDiffWithoutContents::UnsolveNameConflict,
    )
    }
    repo::ChangedFileDiff::Edit {
    line,
    deleted,
    contents,
    } => ChangedFileDiff::WithContents(ChangedFileDiffWithContents::Edit {
    line: *line,
    deleted: *deleted,
    contents: contents_to_file_editor_content(contents),
    }),
    repo::ChangedFileDiff::Replacement {
    line,
    change_contents,
    replacement_contents,
    } => ChangedFileDiff::WithContents(
    ChangedFileDiffWithContents::Replacement {
    line: *line,
    change_contents: contents_to_file_editor_content(
    [5.4299]
    [8.4772]
    fn changed_file_contents(diffs: &repo::ChangedFile) -> ChangedFileContents {
    let (with_contents, without_contents) = diffs.iter().fold(
    (vec![], vec![]),
    |(mut acc_with, mut acc_without), diff| {
    match diff {
    repo::ChangedFileDiff::Move => {
    acc_with.push(ChangedFileDiffWithContents::Move)
    }
    repo::ChangedFileDiff::Del => {
    acc_with.push(ChangedFileDiffWithContents::Del)
    }
    repo::ChangedFileDiff::Undel => {
    acc_with.push(ChangedFileDiffWithContents::Undel)
    }
    repo::ChangedFileDiff::Add => {
    acc_with.push(ChangedFileDiffWithContents::Add)
    }
    repo::ChangedFileDiff::SolveNameConflict => acc_without
    .push(ChangedFileDiffWithoutContents::SolveNameConflict),
    repo::ChangedFileDiff::UnsolveNameConflict => acc_without
    .push(ChangedFileDiffWithoutContents::UnsolveNameConflict),
    repo::ChangedFileDiff::Edit {
    line,
    deleted,
    contents,
    } => acc_with.push(ChangedFileDiffWithContents::Edit {
    line: *line,
    deleted: *deleted,
    contents: contents_to_file_editor_content(contents),
    }),
    repo::ChangedFileDiff::Replacement {
    line,
  • edit in crates/flowers_ui/src/main.rs at line 911
    [8.4809][8.4809:4899]()
    ),
    replacement_contents: contents_to_file_editor_content(
  • replacement in crates/flowers_ui/src/main.rs at line 912
    [8.4941][8.4941:5847]()
    ),
    },
    ),
    repo::ChangedFileDiff::SolveOrderConflict => {
    ChangedFileDiff::WithoutContents(
    ChangedFileDiffWithoutContents::SolveOrderConflict,
    )
    }
    repo::ChangedFileDiff::UnsolveOrderConflict => {
    ChangedFileDiff::WithoutContents(
    ChangedFileDiffWithoutContents::UnsolveOrderConflict,
    )
    }
    repo::ChangedFileDiff::ResurrectZombines => {
    ChangedFileDiff::WithoutContents(
    ChangedFileDiffWithoutContents::ResurrectZombines,
    )
    }
    repo::ChangedFileDiff::AddRoot => ChangedFileDiff::WithoutContents(
    ChangedFileDiffWithoutContents::AddRoot,
    ),
    repo::ChangedFileDiff::DelRoot => ChangedFileDiff::WithoutContents(
    ChangedFileDiffWithoutContents::DelRoot,
    ),
    [8.4941]
    [8.5847]
    } => acc_with.push(ChangedFileDiffWithContents::Replacement {
    line: *line,
    change_contents: contents_to_file_editor_content(
    change_contents,
    ),
    replacement_contents: contents_to_file_editor_content(
    replacement_contents,
    ),
    }),
    repo::ChangedFileDiff::SolveOrderConflict => acc_without
    .push(ChangedFileDiffWithoutContents::SolveOrderConflict),
    repo::ChangedFileDiff::UnsolveOrderConflict => acc_without
    .push(ChangedFileDiffWithoutContents::UnsolveOrderConflict),
    repo::ChangedFileDiff::ResurrectZombines => acc_without
    .push(ChangedFileDiffWithoutContents::ResurrectZombines),
    repo::ChangedFileDiff::AddRoot => {
    acc_without.push(ChangedFileDiffWithoutContents::AddRoot)
    }
    repo::ChangedFileDiff::DelRoot => {
    acc_without.push(ChangedFileDiffWithoutContents::DelRoot)
    }
    };
    (acc_with, acc_without)
    },
    );
    ChangedFileContents {
    with_contents,
    without_contents,
  • replacement in crates/flowers_ui/src/main.rs at line 1037
    [8.5993][8.5993:6096]()
    changed_file
    .iter()
    .any(|diff| matches!(diff, ChangedFileDiff::WithContents(_)))
    [8.5993]
    [8.6096]
    !changed_file.with_contents.is_empty()