-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate backsyncer to mononoke_app and clap 4
Summary: # This Stack Migrate backsyncer CLI to use mononoke_app + clap 4, instead of old cmdlib + clap 2. I might also make some improvements to other cross-repo CLIs, e.g. forward syncer, bookmarks validator. ## This diff Similar to D68889082 for bookmarks_validator, this actually migrates backsyncer to use mononoke_app + clap 4. As I mentioned in D68889082, as much as I hate to publish a big diff, it's very, very hard to split this change, since all existing clap 4 APIs are tied to mononoke_app, so I have to make both changes together... As I work on these binaries, I'm seeing a lot of repetition between then, especially related to shard manager code, so I'll probably introduce a common setup to make it easier to maintain. test backsyncer after D68957325 Commit: bonsai=e1763dad7b35c98d0f82d8f1332e3c7025f7535423fb403489ecabf8ac577408 git=59ea4e2caca552b32a364f6d4e4fed35e214375c Date: 2025-01-17 14:04:22 +00:00 Committer Date: 2025-01-17 14:04:22 +00:00 Author: Gustavo Galvao Avena <gustavoavena@fb.com> test pushing to gustavo-test from large repo Commit: bonsai=f6f0cfebb7e5e35e16c4e182f6e3c61080d89b421d8f36bf6625bc5937dc4f76 git=c634d4ec2925375124fab874c9bba363eab2cd43 Date: 2025-01-17 13:59:32 +00:00 Committer Date: 2025-01-17 13:59:32 +00:00 Author: Gustavo Galvao Avena <gustavoavena@meta.com> Test locked bookmark hook ┬─[gustavoavena@devvm25564:~/bin]─[11:26:08] ``` TW tasks logs: P1725959703 Reviewed By: RajivTS Differential Revision: D68957325 fbshipit-source-id: 3cf42c0c1afa987f629379a8b258e38e6b184612
- Loading branch information
1 parent
06c6da6
commit 8faf0ef
Showing
6 changed files
with
290 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
eden/mononoke/commit_rewriting/backsyncer/backsyncer_cmd/cli.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This software may be used and distributed according to the terms of the | ||
* GNU General Public License version 2. | ||
*/ | ||
|
||
use clap::command; | ||
use clap::Args; | ||
use clap::Parser; | ||
use cmdlib_logging::ScribeLoggingArgs; | ||
use executor_lib::args::ShardedExecutorArgs; | ||
use mononoke_app::args::OptSourceAndTargetRepoArgs; | ||
|
||
pub(crate) const SCUBA_TABLE: &str = "mononoke_xrepo_backsync"; | ||
|
||
#[derive(Clone, Debug, Args)] | ||
#[clap(about = "Syncs all commits from the file")] | ||
pub struct CommitsCommandArgs { | ||
/// File containing the list of commits to sync | ||
#[clap(long)] | ||
pub input_file: String, | ||
|
||
/// How many commits to backsync at once | ||
#[clap(long)] | ||
pub batch_size: Option<usize>, | ||
} | ||
|
||
#[derive(Debug, clap::Subcommand)] | ||
pub enum BacksyncerCommand { | ||
/// Backsyncs all new bookmark moves once | ||
#[command(name = "backsync-all")] | ||
Once, | ||
/// Backsyncs all new bookmark moves | ||
#[command(name = "backsync-forever")] | ||
Forever, | ||
/// Syncs all commits from the file | ||
#[command(name = "backsync-commits")] | ||
Commits(CommitsCommandArgs), | ||
} | ||
|
||
#[derive(Debug, Parser)] | ||
#[clap(about = "CLI to sync commits from large repositories (i.e. mega repos) to small ones")] | ||
pub struct BacksyncerArgs { | ||
/// Identifiers or names for the source and target repos | ||
#[clap(flatten, next_help_heading = "CROSS REPO OPTIONS")] | ||
pub repo_args: OptSourceAndTargetRepoArgs, | ||
|
||
#[clap(flatten)] | ||
pub scribe_logging_args: ScribeLoggingArgs, | ||
|
||
#[clap(flatten)] | ||
pub sharded_executor_args: ShardedExecutorArgs, | ||
|
||
#[command(subcommand)] | ||
pub command: BacksyncerCommand, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.