Skip to content

Commit c95fe8e

Browse files
authored
feat(cli): add skip comment upload on package upload (#407)
1 parent 812a2ac commit c95fe8e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22
- Only ask for ai unit consumpion consent when unpacking CM packages
33
- Remap entity field type names on cm package upload
4+
- Add `--skip-comment-upload` when unpacking CM packages
45

56
# v0.38.7
67
- Add `--attachments` to get comment

cli/src/commands/package/upload.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ pub struct UploadPackageArgs {
7676
#[structopt(short = "y", long = "yes")]
7777
/// Consent to ai unit charge. Suppresses confirmation prompt.
7878
yes: bool,
79+
80+
#[structopt(long = "skip-comment-upload")]
81+
/// Don't upload comments for CM packages
82+
skip_comment_upload: bool,
7983
}
8084

8185
fn wait_for_dataset_to_exist(dataset: &Dataset, client: &Client, timeout_s: u64) -> Result<()> {
@@ -434,6 +438,7 @@ fn unpack_cm_source(
434438
no_charge: bool,
435439
statistics: &Arc<CmStatistics>,
436440
new_project_name: Option<DatasetOrOwnerName>,
441+
skip_comment_upload: bool,
437442
) -> Result<Source> {
438443
// Get existing source or create a new one if it doesn't exist
439444
if let Some(project_name) = new_project_name {
@@ -456,6 +461,11 @@ fn unpack_cm_source(
456461
},
457462
)?,
458463
};
464+
465+
if skip_comment_upload {
466+
return Ok(source);
467+
}
468+
459469
// Upload comment batches to the source
460470
let comment_batch_count = package.get_comment_batch_count();
461471
for idx in 0..comment_batch_count {
@@ -690,6 +700,7 @@ fn unpack_cm(
690700
resume_on_error: &bool,
691701
no_charge: bool,
692702
new_project_name: &Option<DatasetOrOwnerName>,
703+
skip_comment_upload: &bool,
693704
) -> Result<()> {
694705
let total_comment_batches = package.get_comment_batch_count();
695706
let total_email_batches = package.get_emails_batch_count();
@@ -749,6 +760,7 @@ fn unpack_cm(
749760
no_charge,
750761
&statistics,
751762
new_project_name.clone(),
763+
*skip_comment_upload,
752764
)?;
753765

754766
packaged_to_new_source_id.insert(packaged_source_info.id.clone(), source.id.clone());
@@ -869,6 +881,7 @@ pub fn run(args: &UploadPackageArgs, client: &Client, pool: &mut Pool) -> Result
869881
new_project_name,
870882
no_charge,
871883
yes,
884+
skip_comment_upload,
872885
} = args;
873886

874887
let mut has_consented_to_ai_unit_consumption = false;
@@ -908,6 +921,7 @@ pub fn run(args: &UploadPackageArgs, client: &Client, pool: &mut Pool) -> Result
908921
resume_on_error,
909922
*no_charge,
910923
new_project_name,
924+
skip_comment_upload,
911925
) {
912926
Ok(_) => break,
913927
Err(err) if is_project_not_found_error(&err) && new_project_name.is_some() => {

0 commit comments

Comments
 (0)