Command to delete a tag
Dependencies
- [2]
ZDK3GNDBTag transactions (including a massive refactoring of errors) - [3]
QL6K2ZM3Tags - [4]
3FTEGCMRadd timestamp_validator to tag --timestamp option - [5]
L3RCAPPKAdd --repository to tag commands
Change contents
- replacement in pijul/src/commands/tag.rs at line 38
/// Record the change in this channel instead of the current channel/// Tag the current state of this channel instead of the/// current channel. - edit in pijul/src/commands/tag.rs at line 62
/// Set the repository where this command should run. Defaults to/// the first ancestor of the current directory that contains a/// `.pijul` directory.#[clap(long = "repository")]repo_path: Option<PathBuf>,tag: String,},/// Delete a tag from a channel. If the same state isn't tagged in/// other channels, delete the tag file.#[clap(name = "delete")]Delete { - edit in pijul/src/commands/tag.rs at line 78
/// Delete the tag in this channel instead of the current channel#[clap(long = "channel")]channel: Option<String>, - edit in pijul/src/commands/tag.rs at line 200
}Some(SubCommand::Delete {repo_path,channel,tag,}) => {let repo = Repository::find_root(repo_path)?;let mut tag_path = repo.changes_dir.clone();let h = if let Some(h) = libpijul::Merkle::from_base32(tag.as_bytes()) {libpijul::changestore::filesystem::push_tag_filename(&mut tag_path, &h);h} else {super::find_hash(&mut tag_path, &tag)?};let mut txn = repo.pristine.mut_txn_begin()?;let channel_name = channel.unwrap_or_else(|| {txn.current_channel().unwrap_or(crate::DEFAULT_CHANNEL).to_string()});let channel = if let Some(c) = txn.load_channel(&channel_name)? {c} else {bail!("Channel {:?} not found", channel_name)};{let mut ch = channel.write();if let Some(n) = txn.channel_has_state(txn.states(&*ch), &h.into())? {let tags = txn.tags_mut(&mut *ch);txn.del_tags(tags, n.into())?;}}txn.commit()?;writeln!(stdout, "Deleted tag {}", h.to_base32())?;