mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
mononoke/repo_import: removed callsign command argument for repo_import
Summary:
Related commits: D23214677 (dcb565409d
), D23213192
In the previous commits we added phabricator callsigns to the repo configs.
Since we can extract the callsigns from them, we don't need the callsign
flag for repo_import tool. This diff removes the flag and uses the config variable.
Reviewed By: StanislavGlebik
Differential Revision: D23240398
fbshipit-source-id: d8b853d37e21be97af42e9f50658b9f471f8fc48
This commit is contained in:
parent
b2ece412fd
commit
a31922f40d
@ -213,6 +213,7 @@ fn parse_repo_config(
|
||||
repo_client_use_warm_bookmarks_cache,
|
||||
warm_bookmark_cache_check_blobimport,
|
||||
repo_client_knobs,
|
||||
phabricator_callsign,
|
||||
..
|
||||
} = repo_config;
|
||||
|
||||
@ -375,6 +376,7 @@ fn parse_repo_config(
|
||||
segmented_changelog_config,
|
||||
warm_bookmark_cache_check_blobimport,
|
||||
repo_client_knobs,
|
||||
phabricator_callsign,
|
||||
})
|
||||
}
|
||||
|
||||
@ -882,6 +884,7 @@ mod test {
|
||||
hipster_acl="foo/test"
|
||||
repo_client_use_warm_bookmarks_cache=true
|
||||
warm_bookmark_cache_check_blobimport=true
|
||||
phabricator_callsign="FBS"
|
||||
|
||||
[wireproto_logging]
|
||||
scribe_category="category"
|
||||
@ -977,6 +980,7 @@ mod test {
|
||||
storage_config="files"
|
||||
hgsql_name = "www-foobar"
|
||||
hgsql_globalrevs_name = "www-barfoo"
|
||||
phabricator_callsign="WWW"
|
||||
|
||||
[storage.files.metadata.local]
|
||||
local_db_path = "/tmp/www"
|
||||
@ -1188,6 +1192,7 @@ mod test {
|
||||
repo_client_knobs: RepoClientKnobs {
|
||||
allow_short_getpack_history: true,
|
||||
},
|
||||
phabricator_callsign: Some("FBS".to_string()),
|
||||
},
|
||||
);
|
||||
|
||||
@ -1240,6 +1245,7 @@ mod test {
|
||||
segmented_changelog_config: SegmentedChangelogConfig { enabled: false },
|
||||
warm_bookmark_cache_check_blobimport: false,
|
||||
repo_client_knobs: RepoClientKnobs::default(),
|
||||
phabricator_callsign: Some("WWW".to_string()),
|
||||
},
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -188,6 +188,8 @@ pub struct RepoConfig {
|
||||
pub warm_bookmark_cache_check_blobimport: bool,
|
||||
/// Configuration for repo_client module
|
||||
pub repo_client_knobs: RepoClientKnobs,
|
||||
/// Callsign to check phabricator commits
|
||||
pub phabricator_callsign: Option<String>,
|
||||
}
|
||||
|
||||
/// Configuration for repo_client module
|
||||
|
@ -12,7 +12,6 @@ pub const ARG_GIT_REPOSITORY_PATH: &str = "git-repository-path";
|
||||
pub const ARG_DEST_PATH: &str = "dest-path";
|
||||
pub const ARG_BATCH_SIZE: &str = "batch-size";
|
||||
pub const ARG_BOOKMARK_SUFFIX: &str = "bookmark-suffix";
|
||||
pub const ARG_CALL_SIGN: &str = "call-sign";
|
||||
pub const ARG_PHAB_CHECK_DISABLED: &str = "disable-phabricator-check";
|
||||
pub const ARG_X_REPO_CHECK_DISABLED: &str = "disable-x-repo-check";
|
||||
pub const ARG_HG_SYNC_CHECK_DISABLED: &str = "disable-hg-sync-check";
|
||||
@ -56,12 +55,6 @@ pub fn setup_app<'a, 'b>() -> App<'a, 'b> {
|
||||
.takes_value(true)
|
||||
.help("Suffix of the bookmark (repo_import_<suffix>)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(ARG_CALL_SIGN)
|
||||
.long(ARG_CALL_SIGN)
|
||||
.takes_value(true)
|
||||
.help("Call sign to get commit info from Phabricator. e.g. FBS for fbsource"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(ARG_PHAB_CHECK_DISABLED)
|
||||
.long(ARG_PHAB_CHECK_DISABLED)
|
||||
|
@ -48,10 +48,10 @@ mod cli;
|
||||
mod tests;
|
||||
|
||||
use crate::cli::{
|
||||
setup_app, ARG_BACKUP_HASHES_FILE_PATH, ARG_BATCH_SIZE, ARG_BOOKMARK_SUFFIX, ARG_CALL_SIGN,
|
||||
ARG_COMMIT_AUTHOR, ARG_COMMIT_DATE_RFC3339, ARG_COMMIT_MESSAGE, ARG_DEST_BOOKMARK,
|
||||
ARG_DEST_PATH, ARG_GIT_REPOSITORY_PATH, ARG_HG_SYNC_CHECK_DISABLED, ARG_PHAB_CHECK_DISABLED,
|
||||
ARG_SLEEP_TIME, ARG_X_REPO_CHECK_DISABLED,
|
||||
setup_app, ARG_BACKUP_HASHES_FILE_PATH, ARG_BATCH_SIZE, ARG_BOOKMARK_SUFFIX, ARG_COMMIT_AUTHOR,
|
||||
ARG_COMMIT_DATE_RFC3339, ARG_COMMIT_MESSAGE, ARG_DEST_BOOKMARK, ARG_DEST_PATH,
|
||||
ARG_GIT_REPOSITORY_PATH, ARG_HG_SYNC_CHECK_DISABLED, ARG_PHAB_CHECK_DISABLED, ARG_SLEEP_TIME,
|
||||
ARG_X_REPO_CHECK_DISABLED,
|
||||
};
|
||||
|
||||
const LATEST_REPLAYED_REQUEST_KEY: &'static str = "latest-replayed-request";
|
||||
@ -77,11 +77,11 @@ struct GraphqlInputVariables {
|
||||
commit: String,
|
||||
}
|
||||
#[derive(Debug)]
|
||||
struct CheckerFlags<'a> {
|
||||
struct CheckerFlags {
|
||||
phab_check_disabled: bool,
|
||||
x_repo_check_disabled: bool,
|
||||
hg_sync_check_disabled: bool,
|
||||
call_sign: Option<&'a str>,
|
||||
call_sign: Option<String>,
|
||||
}
|
||||
#[derive(Clone, Debug)]
|
||||
struct ChangesetArgs {
|
||||
@ -185,7 +185,7 @@ async fn move_bookmark(
|
||||
shifted_bcs: &[BonsaiChangeset],
|
||||
batch_size: usize,
|
||||
bookmark_suffix: &str,
|
||||
checker_flags: &CheckerFlags<'_>,
|
||||
checker_flags: &CheckerFlags,
|
||||
sleep_time: u64,
|
||||
mutable_counters: &SqlMutableCounters,
|
||||
) -> Result<(), Error> {
|
||||
@ -389,7 +389,7 @@ async fn get_leaf_entries(
|
||||
async fn check_dependent_systems(
|
||||
ctx: &CoreContext,
|
||||
repo: &BlobRepo,
|
||||
checker_flags: &CheckerFlags<'_>,
|
||||
checker_flags: &CheckerFlags,
|
||||
hg_csid: HgChangesetId,
|
||||
sleep_time: u64,
|
||||
mutable_counters: &SqlMutableCounters,
|
||||
@ -594,16 +594,6 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
|
||||
let phab_check_disabled = matches.is_present(ARG_PHAB_CHECK_DISABLED);
|
||||
let x_repo_check_disabled = matches.is_present(ARG_X_REPO_CHECK_DISABLED);
|
||||
let hg_sync_check_disabled = matches.is_present(ARG_HG_SYNC_CHECK_DISABLED);
|
||||
let call_sign = matches.value_of(ARG_CALL_SIGN);
|
||||
if !phab_check_disabled && call_sign.is_none() {
|
||||
return Err(format_err!("Call sign was not specified"));
|
||||
}
|
||||
let checker_flags = CheckerFlags {
|
||||
phab_check_disabled,
|
||||
x_repo_check_disabled,
|
||||
hg_sync_check_disabled,
|
||||
call_sign,
|
||||
};
|
||||
let sleep_time = matches.value_of(ARG_SLEEP_TIME).unwrap();
|
||||
let sleep_time = sleep_time.parse::<u64>()?;
|
||||
let backup_hashes_path = matches.value_of(ARG_BACKUP_HASHES_FILE_PATH).unwrap();
|
||||
@ -627,13 +617,28 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
|
||||
block_execute(
|
||||
async {
|
||||
let repo = repo.compat().await?;
|
||||
let (_, repo_config) = args::get_config_by_repoid(ctx.fb, &matches, repo.get_repoid())?;
|
||||
let call_sign = repo_config.phabricator_callsign.clone();
|
||||
if !phab_check_disabled && call_sign.is_none() {
|
||||
return Err(format_err!(
|
||||
"The repo we import to doesn't have a callsign.
|
||||
Make sure the callsign for the repo is set in configerator:
|
||||
e.g CF/../source/scm/mononoke/repos/repos/hg.cinc"
|
||||
));
|
||||
}
|
||||
let checker_flags = CheckerFlags {
|
||||
phab_check_disabled,
|
||||
x_repo_check_disabled,
|
||||
hg_sync_check_disabled,
|
||||
call_sign,
|
||||
};
|
||||
let maybe_config_store = args::maybe_init_config_store(fb, &logger, &matches);
|
||||
let configs = args::load_repo_configs(fb, &matches)?;
|
||||
check_repo_not_pushredirected(&ctx, &repo, &maybe_config_store, &configs.repos).await?;
|
||||
|
||||
let mutable_counters = args::open_sql::<SqlMutableCounters>(ctx.fb, &matches)
|
||||
.compat()
|
||||
.await?;
|
||||
|
||||
check_repo_not_pushredirected(&ctx, &repo, &maybe_config_store, &configs.repos).await?;
|
||||
let mut shifted_bcs =
|
||||
rewrite_file_paths(&ctx, &repo, &path, &prefix, &backup_hashes_path).await?;
|
||||
shifted_bcs = sort_bcs(&shifted_bcs)?;
|
||||
@ -655,7 +660,6 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
|
||||
let merged_cs_id =
|
||||
merge_imported_commit(&ctx, &repo, &shifted_bcs, &dest_bookmark, changeset_args)
|
||||
.await?;
|
||||
let (_, repo_config) = args::get_config_by_repoid(ctx.fb, &matches, repo.get_repoid())?;
|
||||
push_merge_commit(&ctx, &repo, merged_cs_id, &dest_bookmark, &repo_config).await?;
|
||||
Ok(())
|
||||
},
|
||||
|
@ -49,7 +49,7 @@ mod tests {
|
||||
let ctx = CoreContext::test_mock(fb);
|
||||
let blob_repo = blobrepo_factory::new_memblob_empty(None)?;
|
||||
let batch_size: usize = 2;
|
||||
let call_sign = Some("FBS");
|
||||
let call_sign = Some("FBS".to_string());
|
||||
let checker_flags = CheckerFlags {
|
||||
phab_check_disabled: true,
|
||||
x_repo_check_disabled: true,
|
||||
|
Loading…
Reference in New Issue
Block a user