(f774a33) Record a campaign move in the history log, and bump to 0.30.0
assign was the only field writer without an entry: a ticket could leave one campaign for another with nothing recording it. Kind gains Campaign, assign gains the --actor flag the other four writers carry, and the entry is written after the save and behind the no-change return, the rule every writer follows. The entry records Campaign::name, the codename or failing that the title, settled when the entry is written so a rename cannot change what an old entry means. The uuid the field holds says nothing in a log line, and a before-uuid the board no longer has reads _missing_, the way the Campaign field itself renders a dangling one. campaign is the longest mechanical label, so LABEL_WIDTH widens from 6 to 8 and every mechanical row moves two columns right, a deliberate output change that makes this a minor alongside the new flag. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
9d17f55860
commit
c03f47c52d
+26
-1
@@ -1509,7 +1509,12 @@ pub fn cmd_campaign_show(search: &str, worklane_dir: &Path) -> Result<()> {
|
||||
///
|
||||
/// No-op detection compares the whole file, the way `set` and `chown` do, so assigning
|
||||
/// a ticket to the campaign it already names writes nothing.
|
||||
pub fn cmd_assign(campaign_search: &str, ticket_id: &str, start: &Path) -> Result<()> {
|
||||
pub fn cmd_assign(
|
||||
campaign_search: &str,
|
||||
ticket_id: &str,
|
||||
actor: &Option<String>,
|
||||
start: &Path,
|
||||
) -> Result<()> {
|
||||
let worklane_dir = find_worklane_dir(start)?;
|
||||
let campaign = resolve_campaign(campaign_search, &worklane_dir)?;
|
||||
let (status, title, original) = resolve_ticket(ticket_id, &worklane_dir)?;
|
||||
@@ -1528,6 +1533,26 @@ pub fn cmd_assign(campaign_search: &str, ticket_id: &str, start: &Path) -> Resul
|
||||
|
||||
save_ticket(&worklane_dir, &status, &uuid, &title, None, &content)?;
|
||||
|
||||
// Behind the no-change return above and after the save, the rule every writer
|
||||
// follows. The entry records `Campaign::name`, not the uuid the field holds: what
|
||||
// the reader should see is settled here, when the entry is written. A campaign the
|
||||
// board no longer has reads `_missing_`, the way the Campaign field itself renders
|
||||
// a dangling uuid.
|
||||
let before = match parse_campaign(&original) {
|
||||
None => NOT_SET.to_string(),
|
||||
Some(old) => CampaignIndex::load(&worklane_dir)?
|
||||
.get(&old)
|
||||
.map(|was| was.name().to_string())
|
||||
.unwrap_or_else(|| "_missing_".to_string()),
|
||||
};
|
||||
write_entry(
|
||||
&worklane_dir,
|
||||
&uuid,
|
||||
Kind::Campaign,
|
||||
&change(&before, campaign.name()),
|
||||
&resolve_actor(actor.as_deref()),
|
||||
)?;
|
||||
|
||||
println!(
|
||||
"Assigned '{}' to campaign '{}'",
|
||||
color_text(&title, Color::Green),
|
||||
|
||||
Reference in New Issue
Block a user