| 
3 | 3 | #![warn(rust_2018_idioms, unused_lifetimes)]  | 
4 | 4 | 
 
  | 
5 | 5 | use clap::{Args, Parser, Subcommand};  | 
6 |  | -use clippy_dev::{dogfood, fmt, lint, new_lint, serve, setup, update_lints};  | 
 | 6 | +use clippy_dev::{dogfood, fmt, lint, new_lint, release, serve, setup, sync, update_lints};  | 
7 | 7 | use std::convert::Infallible;  | 
8 | 8 | 
 
  | 
9 | 9 | fn main() {  | 
@@ -75,6 +75,14 @@ fn main() {  | 
75 | 75 |             uplift,  | 
76 | 76 |         } => update_lints::rename(&old_name, new_name.as_ref().unwrap_or(&old_name), uplift),  | 
77 | 77 |         DevCommand::Deprecate { name, reason } => update_lints::deprecate(&name, reason.as_deref()),  | 
 | 78 | +        DevCommand::Sync(SyncCommand { subcommand }) => match subcommand {  | 
 | 79 | +            SyncSubcommand::Pull => sync::rustc_pull(),  | 
 | 80 | +            SyncSubcommand::Push { repo_path, user, force } => sync::rustc_push(repo_path, &user, force),  | 
 | 81 | +        },  | 
 | 82 | +        DevCommand::Release(ReleaseCommand { subcommand }) => match subcommand {  | 
 | 83 | +            ReleaseSubcommand::BumpVersion => release::bump_version(),  | 
 | 84 | +            ReleaseSubcommand::Commit { repo_path, branch } => release::rustc_clippy_commit(repo_path, branch),  | 
 | 85 | +        },  | 
78 | 86 |     }  | 
79 | 87 | }  | 
80 | 88 | 
 
  | 
@@ -225,6 +233,10 @@ enum DevCommand {  | 
225 | 233 |         /// The reason for deprecation  | 
226 | 234 |         reason: Option<String>,  | 
227 | 235 |     },  | 
 | 236 | +    /// Sync between the rust repo and the Clippy repo  | 
 | 237 | +    Sync(SyncCommand),  | 
 | 238 | +    /// Manage Clippy releases  | 
 | 239 | +    Release(ReleaseCommand),  | 
228 | 240 | }  | 
229 | 241 | 
 
  | 
230 | 242 | #[derive(Args)]  | 
@@ -291,3 +303,46 @@ enum RemoveSubcommand {  | 
291 | 303 |     /// Remove the tasks added with 'cargo dev setup vscode-tasks'  | 
292 | 304 |     VscodeTasks,  | 
293 | 305 | }  | 
 | 306 | + | 
 | 307 | +#[derive(Args)]  | 
 | 308 | +struct SyncCommand {  | 
 | 309 | +    #[command(subcommand)]  | 
 | 310 | +    subcommand: SyncSubcommand,  | 
 | 311 | +}  | 
 | 312 | + | 
 | 313 | +#[derive(Subcommand)]  | 
 | 314 | +enum SyncSubcommand {  | 
 | 315 | +    /// Pull changes from rustc and update the toolchain  | 
 | 316 | +    Pull,  | 
 | 317 | +    /// Push changes to rustc  | 
 | 318 | +    Push {  | 
 | 319 | +        /// The path to a rustc repo that will be used for pushing changes  | 
 | 320 | +        repo_path: String,  | 
 | 321 | +        #[arg(long)]  | 
 | 322 | +        /// The GitHub username to use for pushing changes  | 
 | 323 | +        user: String,  | 
 | 324 | +        #[arg(long, short)]  | 
 | 325 | +        /// Force push changes  | 
 | 326 | +        force: bool,  | 
 | 327 | +    },  | 
 | 328 | +}  | 
 | 329 | + | 
 | 330 | +#[derive(Args)]  | 
 | 331 | +struct ReleaseCommand {  | 
 | 332 | +    #[command(subcommand)]  | 
 | 333 | +    subcommand: ReleaseSubcommand,  | 
 | 334 | +}  | 
 | 335 | + | 
 | 336 | +#[derive(Subcommand)]  | 
 | 337 | +enum ReleaseSubcommand {  | 
 | 338 | +    #[command(name = "bump_version")]  | 
 | 339 | +    /// Bump the version in the Cargo.toml files  | 
 | 340 | +    BumpVersion,  | 
 | 341 | +    /// Print the Clippy commit in the rustc repo for the specified branch  | 
 | 342 | +    Commit {  | 
 | 343 | +        /// The path to a rustc repo to look for the commit  | 
 | 344 | +        repo_path: String,  | 
 | 345 | +        /// For which branch to print the commit  | 
 | 346 | +        branch: release::Branch,  | 
 | 347 | +    },  | 
 | 348 | +}  | 
0 commit comments