BF:BFD[
2.93386] → [
2.185964:185977]
BF:BFD[
2.185977] → [
2.185978:185978]
B:BD[
2.185978] → [
2.185979:186878]
use crate::repository::Repository;
use libpijul::pristine::{MutTxnT, TxnT};
use libpijul::MutTxnTExt;
use std::path::PathBuf;
#[derive(Clap, Debug)]
pub struct Checkout {
#[clap(long = "repository")]
repo_path: Option<PathBuf>,
channel: String,
}
impl Checkout {
pub fn run(self) -> Result<(), anyhow::Error> {
let mut repo = Repository::find_root(self.repo_path)?;
debug!("{:?}", repo.config);
let mut txn = repo.pristine.mut_txn_begin();
if let Some(mut channel) = txn.load_channel(&self.channel) {
txn.output_repository_no_pending(
&mut repo.working_copy,
&repo.changes,
&mut channel,
"",
true,
)?;
}
txn.commit()?;
repo.config.current_channel = Some(self.channel);
repo.save_config()?;
Ok(())
}
}