@@ -158,6 +158,7 @@ pub fn command_main(ctx: CommandContext, args: SubmitArgs) -> EyreExitOr<()> {
158158 resolve_revset_options,
159159 forge,
160160 message,
161+ dry_run,
161162 } = args;
162163 submit (
163164 & effects,
@@ -169,6 +170,7 @@ pub fn command_main(ctx: CommandContext, args: SubmitArgs) -> EyreExitOr<()> {
169170 strategy,
170171 forge,
171172 message,
173+ dry_run,
172174 )
173175}
174176
@@ -182,6 +184,7 @@ fn submit(
182184 execution_strategy : Option < TestExecutionStrategy > ,
183185 forge_kind : Option < ForgeKind > ,
184186 message : Option < String > ,
187+ dry_run : bool ,
185188) -> EyreExitOr < ( ) > {
186189 let repo = Repo :: from_current_dir ( ) ?;
187190 let conn = repo. get_db_conn ( ) ?;
@@ -329,6 +332,8 @@ fn submit(
329332 . collect ( ) ;
330333 if unsubmitted_commits. is_empty ( ) {
331334 Default :: default ( )
335+ } else if create && dry_run {
336+ ( unsubmitted_branches, Default :: default ( ) )
332337 } else if create {
333338 let create_statuses =
334339 try_exit_code ! ( forge. create( unsubmitted_commits, & submit_options) ?) ;
@@ -371,14 +376,17 @@ fn submit(
371376 . flat_map ( |( _commit_oid, commit_status) | commit_status. local_branch_name . clone ( ) )
372377 . collect ( ) ;
373378
374- try_exit_code ! ( forge. update( commits_to_update, & submit_options) ?) ;
379+ if !dry_run {
380+ try_exit_code ! ( forge. update( commits_to_update, & submit_options) ?) ;
381+ }
375382 ( updated_branch_names, skipped_branch_names)
376383 } ;
377384
378385 if !created_branches. is_empty ( ) {
379386 writeln ! (
380387 effects. get_output_stream( ) ,
381- "Created {}: {}" ,
388+ "{} {}: {}" ,
389+ if dry_run { "Would create" } else { "Created" } ,
382390 Pluralize {
383391 determiner: None ,
384392 amount: created_branches. len( ) ,
@@ -400,7 +408,8 @@ fn submit(
400408 if !updated_branch_names. is_empty ( ) {
401409 writeln ! (
402410 effects. get_output_stream( ) ,
403- "Pushed {}: {}" ,
411+ "{} {}: {}" ,
412+ if dry_run { "Would push" } else { "Pushed" } ,
404413 Pluralize {
405414 determiner: None ,
406415 amount: updated_branch_names. len( ) ,
@@ -422,7 +431,8 @@ fn submit(
422431 if !skipped_branch_names. is_empty ( ) {
423432 writeln ! (
424433 effects. get_output_stream( ) ,
425- "Skipped {} (already up-to-date): {}" ,
434+ "{} {} (already up-to-date): {}" ,
435+ if dry_run { "Would skip" } else { "Skipped" } ,
426436 Pluralize {
427437 determiner: None ,
428438 amount: skipped_branch_names. len( ) ,
@@ -444,7 +454,8 @@ fn submit(
444454 if !uncreated_branches. is_empty ( ) {
445455 writeln ! (
446456 effects. get_output_stream( ) ,
447- "Skipped {} (not yet on remote): {}" ,
457+ "{} {} (not yet on remote): {}" ,
458+ if dry_run { "Would skip" } else { "Skipped" } ,
448459 Pluralize {
449460 determiner: None ,
450461 amount: uncreated_branches. len( ) ,
@@ -465,8 +476,10 @@ fn submit(
465476 writeln ! (
466477 effects. get_output_stream( ) ,
467478 "\
468- These branches were skipped because they were not already associated with a remote repository. To
469- create and push them, retry this operation with the --create option."
479+ These branches {} skipped because they {} not already associated with a remote repository. To
480+ create and push them, retry this operation with the --create option." ,
481+ if dry_run { "would be" } else { "were" } ,
482+ if dry_run { "are" } else { "were" } ,
470483 ) ?;
471484 }
472485
0 commit comments