Tag CLI cleanup

pmeunier
Jul 4, 2021, 3:35 PM
DX2FO4HZDTTBU436YRPQW3MIIVFB3ZFSZ3SI5GYLTIWCIGRTQ6DAC

Dependencies

  • [2] 5OGOE4VW Store the current channel in the pristine
  • [3] SMMBFECL Converting to the new patch format "online"
  • [4] A3RM526Y Integrating identity malleability
  • [5] AAXP2534 Tags: completing the subcommand
  • [6] EEBKW7VT Keys and identities
  • [7] QL6K2ZM3 Tags

Change contents

  • edit in pijul/src/commands/tag.rs at line 11
    [3.332]
    [3.332]
    use log::*;
  • replacement in pijul/src/commands/tag.rs at line 62
    [3.92][2.331:459]()
    let mut txn = repo.pristine.mut_txn_begin()?;
    let channel_name = if let Some(ref c) = channel {
    [3.92]
    [2.459]
    let txn = repo.pristine.mut_txn_begin()?;
    let channel_name = if let Some(c) = channel {
  • replacement in pijul/src/commands/tag.rs at line 66
    [2.506][2.506:582]()
    txn.current_channel().unwrap_or(crate::DEFAULT_CHANNEL)
    [2.506]
    [2.582]
    txn.current_channel()
    .unwrap_or(crate::DEFAULT_CHANNEL)
    .to_string()
  • replacement in pijul/src/commands/tag.rs at line 70
    [2.601][3.2018:2073](),[3.2018][3.2018:2073]()
    try_record(&mut repo, &channel_name)?;
    [2.601]
    [3.2135]
    debug!("channel_name = {:?}", channel_name);
    let txn = Arc::new(RwLock::new(txn));
    try_record(&mut repo, txn.clone(), &channel_name)?;
    let mut txn = if let Ok(txn) = Arc::try_unwrap(txn) {
    txn.into_inner().unwrap()
    } else {
    unreachable!()
    };
  • replacement in pijul/src/commands/tag.rs at line 200
    [3.5632][3.5632:6281]()
    fn try_record(repo: &mut Repository, channel: &str) -> Result<(), anyhow::Error> {
    let txn = repo.pristine.mut_txn_begin()?;
    if let Some(channel) = txn.load_channel(channel)? {
    let mut state = libpijul::RecordBuilder::new();
    state.record(
    Arc::new(RwLock::new(txn)),
    libpijul::Algorithm::default(),
    channel,
    repo.working_copy.clone(),
    &repo.changes,
    "",
    num_cpus::get(),
    )?;
    let rec = state.finish();
    if !rec.actions.is_empty() {
    bail!("Cannot change channel, as there are unrecorded changes.")
    }
    [3.5632]
    [3.6281]
    fn try_record<T: ChannelMutTxnT + TxnT + Send + Sync + 'static>(
    repo: &mut Repository,
    txn: Arc<RwLock<T>>,
    channel: &str,
    ) -> Result<(), anyhow::Error> {
    let channel = if let Some(channel) = txn.read().unwrap().load_channel(channel)? {
    channel
  • edit in pijul/src/commands/tag.rs at line 209
    [3.6342]
    [3.6342]
    };
    let mut state = libpijul::RecordBuilder::new();
    state.record(
    txn,
    libpijul::Algorithm::default(),
    channel,
    repo.working_copy.clone(),
    &repo.changes,
    "",
    num_cpus::get(),
    )?;
    let rec = state.finish();
    if !rec.actions.is_empty() {
    bail!("Cannot change channel, as there are unrecorded changes.")
  • replacement in libpijul/src/tag.rs at line 106
    [3.8945][3.8945:8976]()
    debug!("restoring graph");
    [3.8945]
    [3.8976]
    let mut vi = Vec::new();
    for i in ::sanakirja::btree::iter(&filetxn, &external, None).unwrap() {
    debug!("{:?}", i);
    vi.push(i.unwrap());
    }
    vi.sort();
    debug!("restoring graph {:?}", vi);