diff options
Diffstat (limited to 'src/sub_commands/push.rs')
| -rw-r--r-- | src/sub_commands/push.rs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/sub_commands/push.rs b/src/sub_commands/push.rs index 9af8b40..acd91f0 100644 --- a/src/sub_commands/push.rs +++ b/src/sub_commands/push.rs | |||
| @@ -16,7 +16,10 @@ use crate::{ | |||
| 16 | get_most_recent_patch_with_ancestors, get_proposals_and_revisions_from_cache, | 16 | get_most_recent_patch_with_ancestors, get_proposals_and_revisions_from_cache, |
| 17 | tag_value, | 17 | tag_value, |
| 18 | }, | 18 | }, |
| 19 | send::{event_is_revision_root, event_to_cover_letter, generate_patch_event, send_events}, | 19 | send::{ |
| 20 | event_is_revision_root, event_to_cover_letter, generate_patch_event, | ||
| 21 | identify_ahead_behind, send_events, | ||
| 22 | }, | ||
| 20 | }, | 23 | }, |
| 21 | Cli, | 24 | Cli, |
| 22 | }; | 25 | }; |
| @@ -26,9 +29,6 @@ pub struct SubCommandArgs { | |||
| 26 | #[arg(long, action)] | 29 | #[arg(long, action)] |
| 27 | /// send proposal revision from checked out proposal branch | 30 | /// send proposal revision from checked out proposal branch |
| 28 | force: bool, | 31 | force: bool, |
| 29 | #[arg(long, action)] | ||
| 30 | /// dont prompt for cover letter when force pushing | ||
| 31 | no_cover_letter: bool, | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | #[allow(clippy::too_many_lines)] | 34 | #[allow(clippy::too_many_lines)] |
| @@ -116,11 +116,23 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 116 | sub_commands::send::launch( | 116 | sub_commands::send::launch( |
| 117 | cli_args, | 117 | cli_args, |
| 118 | &sub_commands::send::SubCommandArgs { | 118 | &sub_commands::send::SubCommandArgs { |
| 119 | since_or_range: String::new(), | 119 | // if not ahead of master prompt, otherwise assume proposal revision is all commits |
| 120 | // ahead | ||
| 121 | since_or_range: if let Ok((_, _, ahead, _)) = | ||
| 122 | identify_ahead_behind(&git_repo, &None, &None) | ||
| 123 | { | ||
| 124 | if ahead.is_empty() { | ||
| 125 | String::new() | ||
| 126 | } else { | ||
| 127 | format!("HEAD~{}", ahead.len()) | ||
| 128 | } | ||
| 129 | } else { | ||
| 130 | String::new() | ||
| 131 | }, | ||
| 120 | in_reply_to: vec![proposal_root_event.id.to_string()], | 132 | in_reply_to: vec![proposal_root_event.id.to_string()], |
| 121 | title: None, | 133 | title: None, |
| 122 | description: None, | 134 | description: None, |
| 123 | no_cover_letter: args.no_cover_letter, | 135 | no_cover_letter: true, |
| 124 | }, | 136 | }, |
| 125 | true, | 137 | true, |
| 126 | ) | 138 | ) |