show record log

[?]
May 5, 2025, 10:24 AM
OQ6HSAWHIRTAIIWMDGCTIOK47JDY7QVVAHLRDA2R5TTJKNSBFCWQC

Dependencies

  • [2] 6YZAVBWU Initial commit
  • [3] SWWE2R6M display basic repo stuff
  • [4] WT3GA27P add cursor with selection
  • [5] UB2ITZJS refresh changed files on FS changes
  • [6] EC3TVL4X add untracked files
  • [7] KT5UYXGK fix selection after adding file, add changed file diffs
  • [8] YBJRDOTC make all repo actions async
  • [9] A5YBC77V record!
  • [10] D7A7MSIH allow to defer or abandon record, add buttons
  • [11] 4WO3ZJM2 show untracked files' contents
  • [12] W4LFX7IH group diffs by file name
  • [13] PTFDJ567 add untracked files encoding
  • [14] AMPZ2BXK show changed files diffs (only Edit atm)
  • [15] NRCUG4R2 load changed files src when selected
  • [16] UMO6U2ZT partition the change files diffs on whether they have content
  • [17] 6SW7UVSH update iced version
  • [18] HOJZI52Y rename flowers_ui to inflorescence
  • [19] ZVI4AWER woot contents_diff
  • [20] QMAUTRB6 refactor diff
  • [21] IQDCHWCP load a pijul repo
  • [22] DVKSPF7R track selected file path together with an index
  • [23] KLR5FRIB add fs state read/write of repos
  • [24] S2NVIFXR allow to enter record msg

Change contents

  • replacement in crates/libflowers_client/src/repo.rs at line 10
    [8.40][6.51:75](),[6.51][6.51:75]()
    use std::path::PathBuf;
    [8.40]
    [9.159]
    use std::path::{Path, PathBuf};
  • edit in crates/libflowers_client/src/repo.rs at line 28
    [16.89]
    [8.97]
    pub const STATUS_LOG_LIMIT: usize = 10;
  • edit in crates/libflowers_client/src/repo.rs at line 36
    [12.44]
    [8.281]
    pub log: Log,
  • edit in crates/libflowers_client/src/repo.rs at line 46
    [12.82]
    [7.123]
    pub log: Log,
  • edit in crates/libflowers_client/src/repo.rs at line 150
    [8.790]
    [3.468]
    pub type Log = Vec<LogEntry>;
  • edit in crates/libflowers_client/src/repo.rs at line 153
    [3.469]
    [8.791]
    #[derive(Debug, Clone)]
    pub struct LogEntry {
    pub hash: pijul::Hash,
    pub message: String,
    }
  • edit in crates/libflowers_client/src/repo.rs at line 173
    [8.1343]
    [3.529]
    let log = state.log.clone();
  • edit in crates/libflowers_client/src/repo.rs at line 180
    [8.1476]
    [8.1476]
    log,
  • edit in crates/libflowers_client/src/repo.rs at line 243
    [11.325]
    [8.3102]
    let (offset, limit) = (None, Some(STATUS_LOG_LIMIT));
    let log = log(&repo, offset, limit);
  • edit in crates/libflowers_client/src/repo.rs at line 249
    [3.893]
    [3.893]
    log,
  • edit in crates/libflowers_client/src/repo.rs at line 690
    [3.4447]
    [3.4447]
    fn log(
    repo: &pijul::Repository,
    offset: Option<usize>,
    limit: Option<usize>,
    ) -> Vec<LogEntry> {
    let mut offset = offset.unwrap_or(0);
    let mut limit = limit.unwrap_or(usize::MAX);
    let txn = repo.pristine.txn_begin().unwrap();
    let cur_channel = txn
    .current_channel()
    .unwrap_or(pijul::DEFAULT_CHANNEL)
    .to_string();
    let channel = txn.load_channel(&cur_channel).unwrap().unwrap();
    let inodes = get_inodes(&txn, &repo.path, &[]);
    let mut reverse_log =
    txn.reverse_log(&channel.read(), None).unwrap().peekable();
    if reverse_log.peek().is_none() {
    return vec![];
    }
  • edit in crates/libflowers_client/src/repo.rs at line 716
    [3.4448]
    [3.4448]
    let mut entries = vec![];
    for pr in reverse_log {
    let (_, (h, _mrk)) = pr.unwrap();
    let cid = pijul::GraphTxnT::get_internal(&txn, h).unwrap().unwrap();
    let mut is_in_filters = inodes.is_empty();
    for (_, position) in inodes.iter() {
    if let Some(position) = position {
    is_in_filters = pijul::DepsTxnT::get_touched_files(
    &txn,
    position,
    Some(cid),
    )
    .unwrap()
    == Some(cid);
    if is_in_filters {
    break;
    }
    }
    }
    if is_in_filters {
    if offset == 0 && limit > 0 {
    // If there were no path filters applied, OR is this was one of the hashes
    // marked by the file filters that were applied
    let entry = mk_log_entry(repo, pijul::Hash::from(h));
    entries.push(entry);
    limit -= 1
    } else if limit > 0 {
    offset -= 1
    } else {
    break;
    }
    }
    }
    entries
    }
    fn mk_log_entry(repo: &pijul::Repository, h: pijul::Hash) -> LogEntry {
    let header = repo.changes.get_header(&h.into()).unwrap();
    LogEntry {
    hash: h,
    message: header.message.clone(),
    }
    }
    // A lot of error-handling noise here, but since we're dealing with
    // a user-command and a bunch of file-IO/path manipulation it's
    // probably necessary for the feedback to be good.
    //
    // Borrowed and adjusted from Pijul `pijul/src/commands/log.rs`
    // - removed Error handling for now
    fn get_inodes(
    txn: &pijul::pristine::sanakirja::Txn,
    repo_path: &Path,
    pats: &[String],
    ) -> Vec<(
    pijul::Inode,
    Option<pijul::pristine::Position<pijul::ChangeId>>,
    )> {
    let mut inodes = Vec::new();
    for pat in pats {
    let canon_path = match Path::new(pat).canonicalize() {
    Err(e) if matches!(e.kind(), std::io::ErrorKind::NotFound) => {
    // return Err(Error::NotFound(pat.to_string()))
    todo!()
    }
    Err(e) =>
    // return Err(e.into()),
    {
    todo!()
    }
    Ok(p) => p,
    };
    match canon_path.strip_prefix(repo_path).map(|p| p.to_str()) {
    // strip_prefix error is if repo_path is not a prefix of canon_path,
    // which would only happen if they pased in a filter path that's not
    // in the repository.
    Err(_) => {
    // return Err(Error::FilterPath {
    // pat: pat.to_string(),
    // canon_path,
    // repo_path: repo_path.to_path_buf(),
    // })
    todo!()
    }
    // PathBuf.to_str() returns none iff the path contains invalid UTF-8.
    Ok(None) =>
    // return Err(Error::InvalidUtf8(pat.to_string())),
    {
    todo!()
    }
    Ok(Some(s)) => {
    let inode = pijul::fs::find_inode(txn, s).expect("TODO");
    let inode_position =
    pijul::TreeTxnT::get_inodes(txn, &inode, None)
    .expect("TODO");
    inodes.push((inode, inode_position.cloned()))
    }
    };
    }
    inodes
    }
  • replacement in crates/libflowers/src/prelude.rs at line 2
    [9.4181][9.4181:4202]()
    pub use chrono::Utc;
    [9.4181]
    [13.14]
    pub use chrono::{DateTime, Utc};
  • edit in crates/inflorescence/src/main.rs at line 23
    [5.351]
    [8.4709]
    use pijul::Base32;
  • replacement in crates/inflorescence/src/main.rs at line 53
    [2.2944][18.169:206]()
    .title("Inflorescence 🌻")
    [2.2944]
    [17.125]
    .title("Inflorescence")
  • edit in crates/inflorescence/src/main.rs at line 385
    [19.7623]
    [19.7623]
    Some(cursor::Selection::Change { hash }) => {
    todo!()
    }
  • edit in crates/inflorescence/src/main.rs at line 485
    [8.10629]
    [8.10629]
    }
    Some(cursor::Selection::Change { hash }) => {
    todo!()
  • edit in crates/inflorescence/src/main.rs at line 556
    [11.6175]
    [19.10915]
    cursor::Select::Change { hash } => todo!(),
  • edit in crates/inflorescence/src/main.rs at line 913
    [15.4576]
    [8.16407]
    cursor::Selection::Change { hash } => todo!(),
  • replacement in crates/inflorescence/src/main.rs at line 1055
    [4.4169][10.2729:2825]()
    let log =
    el(column(["todo: commits"].iter().map(|hash| el(text(*hash)))));
    [4.4169]
    [8.17203]
    let log = el(column(repo.log.iter().map(
    |repo::LogEntry { hash, message }| {
    let mut short_hash = hash.to_base32();
    short_hash.truncate(8);
    // TODO
    let is_selected = false;
    el(row([
    el(button(text(short_hash).font(Font::MONOSPACE))
    .on_press(Message::CursorSelect(
    cursor::Select::Change { hash: *hash },
    ))
    .style(selectable_button_style(is_selected))),
    el(text(message)),
    ])
    .spacing(SPACING))
    },
    )));
  • edit in crates/inflorescence/src/main.rs at line 1141
    [19.18856]
    [11.9691]
    }
    Some(cursor::Selection::Change { hash }) => {
    todo!()
  • replacement in crates/inflorescence/src/main.rs at line 1153
    [14.5481][10.3842:3863](),[10.3842][10.3842:3863]()
    log,
    [14.5481]
    [10.3863]
    el(column([el(text("Recent changes:")), log])),
  • edit in crates/inflorescence/src/cursor.rs at line 1
    [4.26]
    [20.8808]
    use libflowers::prelude::*;
  • edit in crates/inflorescence/src/cursor.rs at line 21
    [20.8883]
    [19.19105]
    },
    Change {
    hash: pijul::Hash,
  • edit in crates/inflorescence/src/cursor.rs at line 31
    [12.3191]
    [4.188]
    Change { hash: pijul::Hash },