@@ -51,9 +51,44 @@ pub fn make_command(command: Command) -> Command {
5151 . required ( true ) ,
5252 )
5353 . arg (
54- Arg :: new ( "sha" )
55- . long ( "sha" )
56- . help ( "The git commit sha to use for the upload. If not provided, the current commit sha will be used." )
54+ Arg :: new ( "head_sha" )
55+ . long ( "head-sha" )
56+ . help ( "The VCS commit sha to use for the upload. If not provided, the current commit sha will be used." )
57+ )
58+ . arg (
59+ Arg :: new ( "base_sha" )
60+ . long ( "base-sha" )
61+ . help ( "The VCS commit's base sha to use for the upload. If not provided, the merge-base of the current and remote branch will be used." )
62+ )
63+ . arg (
64+ Arg :: new ( "vcs_provider" )
65+ . long ( "vcs-provider" )
66+ . help ( "The VCS provider to use for the upload. If not provided, the current provider will be used." )
67+ )
68+ . arg (
69+ Arg :: new ( "head_repo_name" )
70+ . long ( "head-repo-name" )
71+ . help ( "The name of the git repository to use for the upload (e.g. organization/repository). If not provided, the current repository will be used." )
72+ )
73+ . arg (
74+ Arg :: new ( "base_repo_name" )
75+ . long ( "base-repo-name" )
76+ . help ( "The name of the git repository to use for the upload (e.g. organization/repository). If not provided, the current repository will be used." )
77+ )
78+ . arg (
79+ Arg :: new ( "head_ref" )
80+ . long ( "head-ref" )
81+ . help ( "The reference (branch) to use for the upload. If not provided, the current reference will be used." )
82+ )
83+ . arg (
84+ Arg :: new ( "base_ref" )
85+ . long ( "base-ref" )
86+ . help ( "The reference (branch) to use for the upload. If not provided, the current reference will be used." )
87+ )
88+ . arg (
89+ Arg :: new ( "pr_number" )
90+ . long ( "pr-number" )
91+ . help ( "The pull request number to use for the upload. If not provided, the current pull request number will be used." )
5792 )
5893 . arg (
5994 Arg :: new ( "build_configuration" )
@@ -67,12 +102,21 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
67102 . get_many :: < String > ( "paths" )
68103 . expect ( "paths argument is required" ) ;
69104
70- let sha = matches
71- . get_one ( "sha " )
105+ let head_sha = matches
106+ . get_one ( "head_sha " )
72107 . map ( String :: as_str)
73108 . map ( Cow :: Borrowed )
74109 . or_else ( || vcs:: find_head ( ) . ok ( ) . map ( Cow :: Owned ) ) ;
75110
111+ // TODO: Implement default values
112+ let base_sha = matches. get_one ( "base_sha" ) . map ( String :: as_str) ;
113+ let vcs_provider = matches. get_one ( "vcs_provider" ) . map ( String :: as_str) ;
114+ let head_repo_name = matches. get_one ( "head_repo_name" ) . map ( String :: as_str) ;
115+ let base_repo_name = matches. get_one ( "base_repo_name" ) . map ( String :: as_str) ;
116+ let head_ref = matches. get_one ( "head_ref" ) . map ( String :: as_str) ;
117+ let base_ref = matches. get_one ( "base_ref" ) . map ( String :: as_str) ;
118+ let pr_number = matches. get_one ( "pr_number" ) . map ( String :: as_str) ;
119+
76120 let build_configuration = matches. get_one ( "build_configuration" ) . map ( String :: as_str) ;
77121
78122 let api = Api :: current ( ) ;
@@ -140,8 +184,15 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
140184 & bytes,
141185 & org,
142186 & project,
143- sha. as_deref ( ) ,
144187 build_configuration,
188+ head_sha. as_deref ( ) ,
189+ base_sha,
190+ vcs_provider,
191+ head_repo_name,
192+ base_repo_name,
193+ head_ref,
194+ base_ref,
195+ pr_number,
145196 ) {
146197 Ok ( _) => {
147198 info ! ( "Successfully uploaded file: {}" , path. display( ) ) ;
@@ -342,17 +393,31 @@ fn upload_file(
342393 bytes : & [ u8 ] ,
343394 org : & str ,
344395 project : & str ,
345- sha : Option < & str > ,
346396 build_configuration : Option < & str > ,
397+ head_sha : Option < & str > ,
398+ base_sha : Option < & str > ,
399+ vcs_provider : Option < & str > ,
400+ head_repo_name : Option < & str > ,
401+ base_repo_name : Option < & str > ,
402+ head_ref : Option < & str > ,
403+ base_ref : Option < & str > ,
404+ pr_number : Option < & str > ,
347405) -> Result < ( ) > {
348406 const SELF_HOSTED_ERROR_HINT : & str = "If you are using a self-hosted Sentry server, \
349407 update to the latest version of Sentry to use the mobile-app upload command.";
350408
351409 debug ! (
352- "Uploading file to organization: {}, project: {}, sha : {}, build_configuration: {}" ,
410+ "Uploading file to organization: {}, project: {}, head_sha: {}, base_sha: {}, vcs_provider: {}, head_repo_name: {}, base_repo_name: {}, head_ref: {}, base_ref: {}, pr_number : {}, build_configuration: {}" ,
353411 org,
354412 project,
355- sha. unwrap_or( "unknown" ) ,
413+ head_sha. unwrap_or( "unknown" ) ,
414+ base_sha. unwrap_or( "unknown" ) ,
415+ vcs_provider. unwrap_or( "unknown" ) ,
416+ head_repo_name. unwrap_or( "unknown" ) ,
417+ base_repo_name. unwrap_or( "unknown" ) ,
418+ head_ref. unwrap_or( "unknown" ) ,
419+ base_ref. unwrap_or( "unknown" ) ,
420+ pr_number. unwrap_or( "unknown" ) ,
356421 build_configuration. unwrap_or( "unknown" )
357422 ) ;
358423
@@ -386,8 +451,21 @@ fn upload_file(
386451
387452 pb. finish_with_duration ( "Finishing upload" ) ;
388453
389- let response =
390- api. assemble_mobile_app ( org, project, checksum, & checksums, sha, build_configuration) ?;
454+ let response = api. assemble_mobile_app (
455+ org,
456+ project,
457+ checksum,
458+ & checksums,
459+ build_configuration,
460+ head_sha,
461+ base_sha,
462+ vcs_provider,
463+ head_repo_name,
464+ base_repo_name,
465+ head_ref,
466+ base_ref,
467+ pr_number,
468+ ) ?;
391469 chunks. retain ( |Chunk ( ( digest, _) ) | response. missing_chunks . contains ( digest) ) ;
392470
393471 if !chunks. is_empty ( ) {
@@ -406,8 +484,15 @@ fn upload_file(
406484 & checksums,
407485 org,
408486 project,
409- sha,
410487 build_configuration,
488+ head_sha,
489+ base_sha,
490+ vcs_provider,
491+ head_repo_name,
492+ base_repo_name,
493+ head_ref,
494+ base_ref,
495+ pr_number,
411496 ) ?;
412497 Ok ( ( ) )
413498}
@@ -418,8 +503,15 @@ fn poll_assemble(
418503 chunks : & [ Digest ] ,
419504 org : & str ,
420505 project : & str ,
421- sha : Option < & str > ,
422506 build_configuration : Option < & str > ,
507+ head_sha : Option < & str > ,
508+ base_sha : Option < & str > ,
509+ vcs_provider : Option < & str > ,
510+ head_repo_name : Option < & str > ,
511+ base_repo_name : Option < & str > ,
512+ head_ref : Option < & str > ,
513+ base_ref : Option < & str > ,
514+ pr_number : Option < & str > ,
423515) -> Result < ( ) > {
424516 debug ! ( "Polling assemble for checksum: {}" , checksum) ;
425517
@@ -430,8 +522,21 @@ fn poll_assemble(
430522 pb. set_style ( progress_style) ;
431523
432524 let response = loop {
433- let response =
434- api. assemble_mobile_app ( org, project, checksum, chunks, sha, build_configuration) ?;
525+ let response = api. assemble_mobile_app (
526+ org,
527+ project,
528+ checksum,
529+ chunks,
530+ build_configuration,
531+ head_sha,
532+ base_sha,
533+ vcs_provider,
534+ head_repo_name,
535+ base_repo_name,
536+ head_ref,
537+ base_ref,
538+ pr_number,
539+ ) ?;
435540
436541 if response. state . is_finished ( ) {
437542 break response;
0 commit comments