| 
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,15 @@ 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::UpdateToolchain => sync::update_toolchain(),  | 
 | 80 | +            SyncSubcommand::Pull { hash } => sync::rustc_pull(hash),  | 
 | 81 | +            SyncSubcommand::Push { repo_path, user } => sync::rustc_push(repo_path, &user),  | 
 | 82 | +        },  | 
 | 83 | +        DevCommand::Release(ReleaseCommand { subcommand }) => match subcommand {  | 
 | 84 | +            ReleaseSubcommand::UpdateVersion => release::update_version(),  | 
 | 85 | +            ReleaseSubcommand::Commit { branch } => release::rustc_clippy_commit(branch),  | 
 | 86 | +        },  | 
78 | 87 |     }  | 
79 | 88 | }  | 
80 | 89 | 
 
  | 
@@ -225,6 +234,10 @@ enum DevCommand {  | 
225 | 234 |         /// The reason for deprecation  | 
226 | 235 |         reason: Option<String>,  | 
227 | 236 |     },  | 
 | 237 | +    /// Sync between the rust repo and the Clippy repo  | 
 | 238 | +    Sync(SyncCommand),  | 
 | 239 | +    /// Manage Clippy releases  | 
 | 240 | +    Release(ReleaseCommand),  | 
228 | 241 | }  | 
229 | 242 | 
 
  | 
230 | 243 | #[derive(Args)]  | 
@@ -291,3 +304,51 @@ enum RemoveSubcommand {  | 
291 | 304 |     /// Remove the tasks added with 'cargo dev setup vscode-tasks'  | 
292 | 305 |     VscodeTasks,  | 
293 | 306 | }  | 
 | 307 | + | 
 | 308 | +#[derive(Args)]  | 
 | 309 | +struct SyncCommand {  | 
 | 310 | +    #[command(subcommand)]  | 
 | 311 | +    subcommand: SyncSubcommand,  | 
 | 312 | +}  | 
 | 313 | + | 
 | 314 | +#[derive(Subcommand)]  | 
 | 315 | +enum SyncSubcommand {  | 
 | 316 | +    #[command(name = "update_toolchain")]  | 
 | 317 | +    /// Update nightly toolchain in rust-toolchain file  | 
 | 318 | +    UpdateToolchain,  | 
 | 319 | +    /// Pull changes from rustc  | 
 | 320 | +    Pull {  | 
 | 321 | +        #[arg(long)]  | 
 | 322 | +        /// The Rust hash of the commit to pull from  | 
 | 323 | +        ///  | 
 | 324 | +        /// This should only be necessary, if there were breaking changes to `clippy_dev` itself,  | 
 | 325 | +        /// i.e. breaking changes to `rustc_lexer`.  | 
 | 326 | +        hash: Option<String>,  | 
 | 327 | +    },  | 
 | 328 | +    /// Push changes to rustc  | 
 | 329 | +    Push {  | 
 | 330 | +        /// The path to a rustc repo that will be used for pushing changes  | 
 | 331 | +        repo_path: String,  | 
 | 332 | +        #[arg(long)]  | 
 | 333 | +        /// The GitHub username to use for pushing changes  | 
 | 334 | +        user: String,  | 
 | 335 | +    },  | 
 | 336 | +}  | 
 | 337 | + | 
 | 338 | +#[derive(Args)]  | 
 | 339 | +struct ReleaseCommand {  | 
 | 340 | +    #[command(subcommand)]  | 
 | 341 | +    subcommand: ReleaseSubcommand,  | 
 | 342 | +}  | 
 | 343 | + | 
 | 344 | +#[derive(Subcommand)]  | 
 | 345 | +enum ReleaseSubcommand {  | 
 | 346 | +    #[command(name = "update_version")]  | 
 | 347 | +    /// Update the version in the Cargo.toml files  | 
 | 348 | +    UpdateVersion,  | 
 | 349 | +    /// Print the Clippy commit in the rustc repo for the specified branch  | 
 | 350 | +    Commit {  | 
 | 351 | +        /// For which branch to print the commit  | 
 | 352 | +        branch: release::Branch,  | 
 | 353 | +    },  | 
 | 354 | +}  | 
0 commit comments