forked from mirrors/jj
commands: move merge code to merge.rs
This commit is contained in:
parent
92739ebf11
commit
19a658e757
2 changed files with 35 additions and 15 deletions
33
cli/src/commands/merge.rs
Normal file
33
cli/src/commands/merge.rs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// Copyright 2020 The Jujutsu Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
use tracing::instrument;
|
||||||
|
|
||||||
|
use super::new;
|
||||||
|
use crate::cli_util::{CommandError, CommandHelper};
|
||||||
|
use crate::ui::Ui;
|
||||||
|
|
||||||
|
#[instrument(skip_all)]
|
||||||
|
pub(crate) fn cmd_merge(
|
||||||
|
ui: &mut Ui,
|
||||||
|
command: &CommandHelper,
|
||||||
|
args: &new::NewArgs,
|
||||||
|
) -> Result<(), CommandError> {
|
||||||
|
if args.revisions.len() < 2 {
|
||||||
|
return Err(CommandError::CliError(String::from(
|
||||||
|
"Merge requires at least two revisions",
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
new::cmd_new(ui, command, args)
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ mod git;
|
||||||
mod init;
|
mod init;
|
||||||
mod interdiff;
|
mod interdiff;
|
||||||
mod log;
|
mod log;
|
||||||
|
mod merge;
|
||||||
mod r#move;
|
mod r#move;
|
||||||
mod new;
|
mod new;
|
||||||
mod operation;
|
mod operation;
|
||||||
|
@ -1898,20 +1899,6 @@ don't make any changes, then the operation will be aborted.
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip_all)]
|
|
||||||
fn cmd_merge(
|
|
||||||
ui: &mut Ui,
|
|
||||||
command: &CommandHelper,
|
|
||||||
args: &new::NewArgs,
|
|
||||||
) -> Result<(), CommandError> {
|
|
||||||
if args.revisions.len() < 2 {
|
|
||||||
return Err(CommandError::CliError(String::from(
|
|
||||||
"Merge requires at least two revisions",
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
new::cmd_new(ui, command, args)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Move to run.rs
|
// TODO: Move to run.rs
|
||||||
fn cmd_run(_ui: &mut Ui, _command: &CommandHelper, _args: &RunArgs) -> Result<(), CommandError> {
|
fn cmd_run(_ui: &mut Ui, _command: &CommandHelper, _args: &RunArgs) -> Result<(), CommandError> {
|
||||||
Err(user_error("This is a stub, do not use"))
|
Err(user_error("This is a stub, do not use"))
|
||||||
|
@ -2517,7 +2504,7 @@ pub fn run_command(ui: &mut Ui, command_helper: &CommandHelper) -> Result<(), Co
|
||||||
Commands::Run(sub_args) => cmd_run(ui, command_helper, sub_args),
|
Commands::Run(sub_args) => cmd_run(ui, command_helper, sub_args),
|
||||||
Commands::Diffedit(sub_args) => diffedit::cmd_diffedit(ui, command_helper, sub_args),
|
Commands::Diffedit(sub_args) => diffedit::cmd_diffedit(ui, command_helper, sub_args),
|
||||||
Commands::Split(sub_args) => cmd_split(ui, command_helper, sub_args),
|
Commands::Split(sub_args) => cmd_split(ui, command_helper, sub_args),
|
||||||
Commands::Merge(sub_args) => cmd_merge(ui, command_helper, sub_args),
|
Commands::Merge(sub_args) => merge::cmd_merge(ui, command_helper, sub_args),
|
||||||
Commands::Rebase(sub_args) => cmd_rebase(ui, command_helper, sub_args),
|
Commands::Rebase(sub_args) => cmd_rebase(ui, command_helper, sub_args),
|
||||||
Commands::Backout(sub_args) => backout::cmd_backout(ui, command_helper, sub_args),
|
Commands::Backout(sub_args) => backout::cmd_backout(ui, command_helper, sub_args),
|
||||||
Commands::Resolve(sub_args) => cmd_resolve(ui, command_helper, sub_args),
|
Commands::Resolve(sub_args) => cmd_resolve(ui, command_helper, sub_args),
|
||||||
|
|
Loading…
Reference in a new issue