upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/sub_commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/sub_commands')
-rw-r--r--src/sub_commands/push.rs24
-rw-r--r--src/sub_commands/send.rs2
2 files changed, 19 insertions, 7 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 )
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs
index 6b9dd58..9733cfe 100644
--- a/src/sub_commands/send.rs
+++ b/src/sub_commands/send.rs
@@ -1042,7 +1042,7 @@ pub async fn generate_patch_event(
1042/** 1042/**
1043 * returns `(from_branch,to_branch,ahead,behind)` 1043 * returns `(from_branch,to_branch,ahead,behind)`
1044 */ 1044 */
1045fn identify_ahead_behind( 1045pub fn identify_ahead_behind(
1046 git_repo: &Repo, 1046 git_repo: &Repo,
1047 from_branch: &Option<String>, 1047 from_branch: &Option<String>,
1048 to_branch: &Option<String>, 1048 to_branch: &Option<String>,