test channel name
[?]
Jun 3, 2025, 4:17 PM
SWDPAGF6BGUA2L6KFP6LAVCA3SX4QA5FOZRLLOAWLNZ6RNCIV4RQCDependencies
- [2]
SWWE2R6Mdisplay basic repo stuff - [3]
KT5UYXGKfix selection after adding file, add changed file diffs - [4]
W7IUT3ZVstart recording impl - [5]
YBJRDOTCmake all repo actions async - [6]
A5YBC77Vrecord! - [7]
VCNKFNUFapp init test - [8]
I56UGW7Umake record test, fix log update - [9]
KMB6FND3test view update fn rather than direct fn calls - [10]
YYKXNBFLtest: add untracked file - [11]
TSFQFCB2test got repo change - [12]
UF5NJKAStest load repo - [13]
VOFP2YNQprettify - [14]
ONRCENKTrm unnecessary state from repo's internal state - [15]
EC3TVL4Xadd untracked files - [16]
ESMM3FELtest selection reindexing - [17]
4WO3ZJM2show untracked files' contents
Change contents
- edit in libflorescence/src/testing.rs at line 1
use crate::prelude::pijul;use crate::repo; - edit in libflorescence/src/testing.rs at line 12
use std::sync::Arc; - replacement in libflorescence/src/testing.rs at line 14
/// Get the path to the repopub fn repo_path(repo: &PijulRepo) -> PathBuf {let PijulRepo {/// Get the path to the test repopub fn repo_path(repo: &TestRepo) -> PathBuf {let TestRepo { - replacement in libflorescence/src/testing.rs at line 27
/// Setup a Pijul ID in a temp dir. Sets `PIJUL_CONFIG_DIR` env var, which is/// used by pijul when loading IDpub fn setup_pijul_id() -> PijulId {/// Setup a Pijul user ID in a temp dir. Sets `PIJUL_CONFIG_DIR` env var, which/// is used by pijul when loading IDpub fn setup_test_user_id() -> TestUserId { - replacement in libflorescence/src/testing.rs at line 57
PijulId { dir, skey }TestUserId { dir, skey } - replacement in libflorescence/src/testing.rs at line 61
pub fn setup_pijul_repo() -> PijulRepo {setup_pijul_repo_in_subdir("")pub fn setup_test_repo() -> TestRepo {setup_test_repo_in_subdir("") - replacement in libflorescence/src/testing.rs at line 66
pub fn setup_pijul_repo_in_subdir<P: AsRef<Path>>(subdir: P) -> PijulRepo {pub fn setup_test_repo_in_subdir<P: AsRef<Path>>(subdir: P) -> TestRepo { - edit in libflorescence/src/testing.rs at line 68
let repo_dir = rootdir.path().join(&subdir);let mut repo = empty_pijul_repo(repo_dir.clone()); - replacement in libflorescence/src/testing.rs at line 71
let repo = Repository::init(Some(rootdir.path().join(&subdir)), None, None).unwrap();let mut txn = repo.pristine.mut_txn_begin().unwrap();let channel_name = libpijul::DEFAULT_CHANNEL.to_string();libpijul::MutTxnT::open_or_create_channel(&mut txn, &channel_name).unwrap();libpijul::MutTxnT::set_current_channel(&mut txn, &channel_name).unwrap();libpijul::MutTxnT::commit(txn).unwrap();// Select and record the default ".ignore" filelet file_to_record = ".ignore";repo::add(&mut repo, file_to_record);let (internal, _state) = repo::load(repo_dir).unwrap();let skey = Arc::new(SKey::generate(None));repo::record(&internal, "Initialized".to_string(), skey); - replacement in libflorescence/src/testing.rs at line 79
PijulRepo {TestRepo { - edit in libflorescence/src/testing.rs at line 87
}pub fn empty_pijul_repo(dir: PathBuf) -> pijul::Repository {let repo = Repository::init(Some(dir), None, None).unwrap();let mut txn = repo.pristine.mut_txn_begin().unwrap();let channel_name = libpijul::DEFAULT_CHANNEL.to_string();libpijul::MutTxnT::open_or_create_channel(&mut txn, &channel_name).unwrap();libpijul::MutTxnT::set_current_channel(&mut txn, &channel_name).unwrap();libpijul::MutTxnT::commit(txn).unwrap();repo - replacement in libflorescence/src/testing.rs at line 102
pub struct PijulId {pub struct TestUserId { - replacement in libflorescence/src/testing.rs at line 109
pub struct PijulRepo {pub struct TestRepo { - replacement in libflorescence/src/repo.rs at line 276
fn load(path: PathBuf) -> Result<(InternalState, State), LoadError> {pub(crate) fn load(path: PathBuf) -> Result<(InternalState, State), LoadError> { - replacement in libflorescence/src/repo.rs at line 322
fn record(state: &InternalState, message: String, sk: Arc<SKey>) {#[derive(Debug)]pub enum NewChannelError {AlreadyExists(String),}#[allow(dead_code)] // TODO rm once usedfn new_channel(repo: &mut pijul::Repository,name: String,) -> Result<(), NewChannelError> {use libpijul::{GraphTxnT, MutTxnTExt};// pijul's command `Channel::New`let mut txn = repo.pristine.mut_txn_begin().unwrap();if txn.load_channel(&name).unwrap().is_some() {return Err(NewChannelError::AlreadyExists(name));}let new = txn.open_or_create_channel(&name).unwrap();// Safeguard: apply the root patch if we're creating a new channel.let current = txn.current_channel().unwrap();let channel = txn.load_channel(current).unwrap().unwrap();let ch = channel.read();let h = if let Some(Ok((k, v))) =libpijul::pristine::changeid_log(&txn, &ch, 0u64.into()).unwrap().next(){Some(txn.get_external(&v.a).unwrap().unwrap().into())} else {None};if let Some(h) = h {let mut new = new.write();txn.apply_change(&repo.changes, &mut new, &h).unwrap();}// txn.commit().unwrap();// Parts of pijul's command `Channel::Switch`txn.set_current_channel(&name).unwrap();txn.commit().unwrap();Ok(())}pub(crate) fn record(state: &InternalState, message: String, sk: Arc<SKey>) { - replacement in libflorescence/src/repo.rs at line 550
fn add(repo: &mut pijul::Repository, file_path_str: &str) {pub fn add(repo: &mut pijul::Repository, file_path_str: &str) { - replacement in libflorescence/src/repo/test.rs at line 1
use crate::repo;use crate::testing::{repo_path, setup_pijul_repo, setup_pijul_repo_in_subdir};use crate::repo::{self, pijul};use crate::testing::{repo_path, setup_test_repo, setup_test_repo_in_subdir}; - replacement in libflorescence/src/repo/test.rs at line 32
let repo = setup_pijul_repo_in_subdir(subdir);let repo = setup_test_repo_in_subdir(subdir); - replacement in libflorescence/src/repo/test.rs at line 46
let repo = setup_pijul_repo();let repo = setup_test_repo(); - replacement in libflorescence/src/repo/test.rs at line 66
assert_eq!(untracked_files.len(), 1);assert!(untracked_files.contains(".ignore"));assert!(untracked_files.is_empty()); - replacement in libflorescence/src/repo/test.rs at line 68
assert!(log.is_empty());assert_eq!(log.len(), 2); - edit in libflorescence/src/repo/test.rs at line 70[12.4040]
#[test]fn test_current_channel() {let repo = setup_test_repo();let repo_path = repo_path(&repo);let mut repo = pijul::Repository::find_root(Some(repo_path)).unwrap();assert_eq!(repo::current_channel(&repo), libpijul::DEFAULT_CHANNEL);let new_channel_name = "NEW CHANNEL!".to_string();repo::new_channel(&mut repo, new_channel_name.clone()).unwrap();assert_eq!(repo::current_channel(&repo), new_channel_name);} - replacement in inflorescence/src/test.rs at line 10
repo_path, setup_pijul_id, setup_pijul_repo, PijulId, PijulRepo,repo_path, setup_test_repo, setup_test_user_id, TestRepo, TestUserId, - replacement in inflorescence/src/test.rs at line 25
let _id = setup_pijul_id();let repo = setup_pijul_repo();let _id = setup_test_user_id();let repo = setup_test_repo(); - replacement in inflorescence/src/test.rs at line 719
let id = setup_pijul_id();let repo = setup_pijul_repo();let id = setup_test_user_id();let repo = setup_test_repo(); - edit in inflorescence/src/test.rs at line 740[8.5488]→[8.5488:5576](∅→∅),[8.5576]→[9.1361:1698](∅→∅),[9.1698]→[8.5710:6088](∅→∅),[8.5710]→[8.5710:6088](∅→∅),[8.6088]→[9.1699:1753](∅→∅),[9.1753]→[8.6130:6235](∅→∅),[8.6130]→[8.6130:6235](∅→∅),[8.6235]→[9.1754:1779](∅→∅),[9.1779]→[8.6256:6276](∅→∅),[8.6256]→[8.6256:6276](∅→∅),[8.6276]→[9.1780:1921](∅→∅),[9.1921]→[8.6381:6713](∅→∅),[8.6381]→[8.6381:6713](∅→∅),[8.6713]→[9.1922:1991](∅→∅),[9.1991]→[8.6754:6919](∅→∅),[8.6754]→[8.6754:6919](∅→∅)
// Select and record the default ".ignore" filelet file_to_record = ".ignore";update(&mut state,Msg::View(app::Msg::Cursor(cursor::Msg::Select(cursor::Select::UntrackedFile {ix: 0,path: file_to_record.to_string(),},))),);// Selection triggers `LoadedSrcFile`let _msg = task::await_next_msg(&mut tasks).await;// Add it to tracked fileslet _task = update(&mut state, Msg::AddUntrackedFile);// Wait for it to be addedlet msg = task::await_next_msg(&mut tasks).await;assert_matches!(&msg,Msg::FromRepo(repo::MsgOut::AddedUntrackedFile { path }) if path == file_to_record);// Make the initial record to add project root: Start a recordlet _task = update(&mut state, Msg::StartRecord);assert!(state.record_msg.is_some());// Edit the record msglet record_msg = "Initialized";let _task = update(&mut state,Msg::View(app::Msg::EditRecordMsg(text_editor::Action::Edit(text_editor::Edit::Paste(Arc::new(record_msg.to_string())),))),);assert!(state.record_msg.is_some());assert_matches!(state.record_msg.as_ref().unwrap(),app::RecordMsg::Typing(_));if let app::RecordMsg::Typing(content) = state.record_msg.as_ref().unwrap(){assert_eq!(&content.text(), record_msg);}// Save the recordlet _task = update(&mut state, Msg::View(app::Msg::SaveRecord));let msg = task::await_next_msg(&mut tasks).await;assert_matches!(&msg, Msg::FromRepo(repo::MsgOut::Recorded(_)));let _task = update(&mut state, msg); - replacement in inflorescence/src/test.rs at line 745
assert_eq!(log[0].file_paths, [file_to_record]);assert_eq!(log[0].file_paths, [".ignore"]); - replacement in inflorescence/src/test.rs at line 765
pub id: PijulId,pub repo: PijulRepo,pub id: TestUserId,pub repo: TestRepo,