(ca2a124) Add --actor-from-git beside every --actor, and bump to 0.32.8
This commit is contained in:
+20
-17
@@ -8,7 +8,7 @@ use std::path::Path;
|
||||
use crate::campaign::*;
|
||||
use crate::command::{
|
||||
AddArgs, AppendArgs, CampaignAddArgs, CampaignAppendArgs, CampaignSetArgs, CheckArgs,
|
||||
ChownArgs, LsArgs, RelateArgs, SetArgs, TagAddArgs, TagSetArgs,
|
||||
ChownArgs, LsArgs, MvArgs, RelateArgs, SetArgs, TagAddArgs, TagSetArgs,
|
||||
};
|
||||
use crate::history::{Kind, change, format_history, read_history, write_entry};
|
||||
use crate::install;
|
||||
@@ -598,14 +598,15 @@ fn check_dependents(worklane_dir: &Path, uuid: &str, title: &str) -> Result<()>
|
||||
/// A status is a [`Status`] rather than a string, so an unknown one is clap's to refuse
|
||||
/// and nothing here has to check. What is left is the order of the flow, which is
|
||||
/// `Status::ALL`.
|
||||
pub fn cmd_mv(
|
||||
ticket_id: &str,
|
||||
target: Status,
|
||||
force: bool,
|
||||
actor: &Option<String>,
|
||||
reason: &Option<String>,
|
||||
start: &Path,
|
||||
) -> Result<()> {
|
||||
pub fn cmd_mv(args: &MvArgs, start: &Path) -> Result<()> {
|
||||
let MvArgs {
|
||||
ticket: ticket_id,
|
||||
status: target,
|
||||
force,
|
||||
actor,
|
||||
actor_from_git,
|
||||
reason,
|
||||
} = args;
|
||||
let target_status = target.as_str();
|
||||
|
||||
// A reason is one fact on one line, which is how the renderer draws it, so a
|
||||
@@ -624,13 +625,13 @@ pub fn cmd_mv(
|
||||
.iter()
|
||||
.position(|status| status.as_str() == current_status)
|
||||
.unwrap();
|
||||
let target_idx = Status::ALL.iter().position(|status| *status == target).unwrap();
|
||||
let target_idx = Status::ALL.iter().position(|status| *status == *target).unwrap();
|
||||
|
||||
// Discarding is not a stage of work, so the walk rules below do not apply to
|
||||
// entering it: a ticket is abandoned from wherever it stands. They do apply to
|
||||
// leaving it, which with discarded last in `Status::ALL` is always a backward move,
|
||||
// so un-discarding needs `-f` with no rule of its own.
|
||||
let discarding = target == Status::Discarded;
|
||||
let discarding = *target == Status::Discarded;
|
||||
|
||||
if !force && !discarding && target_idx < current_idx {
|
||||
return Err(anyhow!(
|
||||
@@ -717,7 +718,7 @@ pub fn cmd_mv(
|
||||
// crash-safe write the Status field does.
|
||||
let content = set_status_stamp(
|
||||
&content,
|
||||
target,
|
||||
*target,
|
||||
&Local::now().format(TIMESTAMP_FORMAT).to_string(),
|
||||
&title,
|
||||
)?;
|
||||
@@ -742,7 +743,7 @@ pub fn cmd_mv(
|
||||
&parse_ticket_field(&resolved, "ID"),
|
||||
Kind::Status,
|
||||
&change(¤t_status, target_status),
|
||||
&resolve_actor(actor.as_deref()),
|
||||
&resolve_actor(actor.as_deref(), *actor_from_git),
|
||||
&reason,
|
||||
)?;
|
||||
|
||||
@@ -760,6 +761,7 @@ pub fn cmd_comment(
|
||||
ticket_id: &str,
|
||||
body: &str,
|
||||
actor: &Option<String>,
|
||||
actor_from_git: bool,
|
||||
start: &Path,
|
||||
) -> Result<()> {
|
||||
if body.is_empty() {
|
||||
@@ -779,7 +781,7 @@ pub fn cmd_comment(
|
||||
&ticket_uuid,
|
||||
Kind::Comment,
|
||||
body,
|
||||
&resolve_actor(actor.as_deref()),
|
||||
&resolve_actor(actor.as_deref(), actor_from_git),
|
||||
"",
|
||||
)?;
|
||||
|
||||
@@ -1028,7 +1030,7 @@ pub fn cmd_set(args: &SetArgs, start: &Path) -> Result<()> {
|
||||
&parse_ticket_field(&original, "Tags"),
|
||||
&parse_ticket_field(&content, "Tags"),
|
||||
),
|
||||
&resolve_actor(args.actor.as_deref()),
|
||||
&resolve_actor(args.actor.as_deref(), args.actor_from_git),
|
||||
"",
|
||||
)?;
|
||||
}
|
||||
@@ -1087,7 +1089,7 @@ pub fn cmd_chown(args: &ChownArgs, start: &Path) -> Result<()> {
|
||||
&parse_ticket_field(&original, "Owner"),
|
||||
&parse_ticket_field(&content, "Owner"),
|
||||
),
|
||||
&resolve_actor(args.actor.as_deref()),
|
||||
&resolve_actor(args.actor.as_deref(), args.actor_from_git),
|
||||
"",
|
||||
)?;
|
||||
|
||||
@@ -1772,6 +1774,7 @@ pub fn cmd_assign(
|
||||
campaign_search: &str,
|
||||
ticket_id: &str,
|
||||
actor: &Option<String>,
|
||||
actor_from_git: bool,
|
||||
start: &Path,
|
||||
) -> Result<()> {
|
||||
let worklane_dir = find_worklane_dir(start)?;
|
||||
@@ -1810,7 +1813,7 @@ pub fn cmd_assign(
|
||||
&uuid,
|
||||
Kind::Campaign,
|
||||
&change(&before, campaign.name()),
|
||||
&resolve_actor(actor.as_deref()),
|
||||
&resolve_actor(actor.as_deref(), actor_from_git),
|
||||
"",
|
||||
)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user