diff --git a/src/base.rs b/src/base.rs index 2638790..070037d 100644 --- a/src/base.rs +++ b/src/base.rs @@ -259,6 +259,8 @@ pub fn reset(oid: String) { ) } +pub fn merge(_oid: String) {} + fn is_ignored(path: &String) -> bool { if path.contains(".rgit") { true diff --git a/src/main.rs b/src/main.rs index 6e90e52..7eef1fb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,6 +81,11 @@ fn main() { .about("Compare the working tree with the given commit") .arg(Arg::with_name("commit").index(1).default_value("@")), ) + .subcommand( + SubCommand::with_name("merge") + .about("Merge changes of a different commit/branch") + .arg(Arg::with_name("commit").index(1).required(true)), + ) .get_matches(); match matches.subcommand_name() { @@ -99,6 +104,7 @@ fn main() { Some("reset") => reset(matches), Some("show") => show(matches), Some("diff") => difference(matches), + Some("merge") => merge(matches), _ => println!("unknown sub command"), } } @@ -308,6 +314,13 @@ fn difference(matches: ArgMatches) { } } +fn merge(matches: ArgMatches) { + if let Some(cmd_matches) = matches.subcommand_matches("reset") { + let oid = base::get_oid(cmd_matches.value_of("commit").unwrap().to_owned()); + base::merge(oid); + } +} + fn print_commit(oid: String, commit: &base::Commit, mut refs: HashMap>) { let ref_str = if refs.contains_key(&oid) { refs.get_mut(&oid).unwrap().join(", ")