@@ -51,9 +51,44 @@ pub fn make_command(command: Command) -> Command {
51
51
. required ( true ) ,
52
52
)
53
53
. 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." )
57
92
)
58
93
. arg (
59
94
Arg :: new ( "build_configuration" )
@@ -67,12 +102,21 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
67
102
. get_many :: < String > ( "paths" )
68
103
. expect ( "paths argument is required" ) ;
69
104
70
- let sha = matches
71
- . get_one ( "sha " )
105
+ let head_sha = matches
106
+ . get_one ( "head_sha " )
72
107
. map ( String :: as_str)
73
108
. map ( Cow :: Borrowed )
74
109
. or_else ( || vcs:: find_head ( ) . ok ( ) . map ( Cow :: Owned ) ) ;
75
110
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
+
76
120
let build_configuration = matches. get_one ( "build_configuration" ) . map ( String :: as_str) ;
77
121
78
122
let api = Api :: current ( ) ;
@@ -140,8 +184,15 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
140
184
& bytes,
141
185
& org,
142
186
& project,
143
- sha. as_deref ( ) ,
144
187
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,
145
196
) {
146
197
Ok ( _) => {
147
198
info ! ( "Successfully uploaded file: {}" , path. display( ) ) ;
@@ -342,17 +393,31 @@ fn upload_file(
342
393
bytes : & [ u8 ] ,
343
394
org : & str ,
344
395
project : & str ,
345
- sha : Option < & str > ,
346
396
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 > ,
347
405
) -> Result < ( ) > {
348
406
const SELF_HOSTED_ERROR_HINT : & str = "If you are using a self-hosted Sentry server, \
349
407
update to the latest version of Sentry to use the mobile-app upload command.";
350
408
351
409
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: {}" ,
353
411
org,
354
412
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" ) ,
356
421
build_configuration. unwrap_or( "unknown" )
357
422
) ;
358
423
@@ -386,8 +451,21 @@ fn upload_file(
386
451
387
452
pb. finish_with_duration ( "Finishing upload" ) ;
388
453
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
+ ) ?;
391
469
chunks. retain ( |Chunk ( ( digest, _) ) | response. missing_chunks . contains ( digest) ) ;
392
470
393
471
if !chunks. is_empty ( ) {
@@ -406,8 +484,15 @@ fn upload_file(
406
484
& checksums,
407
485
org,
408
486
project,
409
- sha,
410
487
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,
411
496
) ?;
412
497
Ok ( ( ) )
413
498
}
@@ -418,8 +503,15 @@ fn poll_assemble(
418
503
chunks : & [ Digest ] ,
419
504
org : & str ,
420
505
project : & str ,
421
- sha : Option < & str > ,
422
506
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 > ,
423
515
) -> Result < ( ) > {
424
516
debug ! ( "Polling assemble for checksum: {}" , checksum) ;
425
517
@@ -430,8 +522,21 @@ fn poll_assemble(
430
522
pb. set_style ( progress_style) ;
431
523
432
524
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
+ ) ?;
435
540
436
541
if response. state . is_finished ( ) {
437
542
break response;
0 commit comments