Skip to content

Commit

Permalink
feat(difftool): add difftool subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
arxanas committed Jul 25, 2023
1 parent 5f37689 commit 8ce75e7
Show file tree
Hide file tree
Showing 9 changed files with 1,821 additions and 1,770 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions git-branchless-opts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ clap = { version = "4.3.19", features = ["derive"] }
clap_mangen = "0.2.12"
itertools = "0.11.0"
lib = { package = "git-branchless-lib", version = "0.7.0", path = "../git-branchless-lib" }
scm-record = { version = "0.1.0", path = "../scm-record", features = ["scm-diff-editor"] }
4 changes: 4 additions & 0 deletions git-branchless-opts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ pub enum Command {
/// report.
BugReport,

/// Use the partial commit selector UI as a Git-compatible difftool; see
/// git-difftool(1) for more information on Git difftools.
Difftool(scm_record::scm_diff_editor::Opts),

/// Run internal garbage collection.
Gc,

Expand Down
6 changes: 3 additions & 3 deletions git-branchless/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ path-slash = "0.2.1"
rayon = "1.7.0"
regex = "1.9.1"
rusqlite = { version = "0.29.0", features = ["bundled"] }
scm-record = { version = "0.1.0", path = "../scm-record", features = [
"scm-diff-editor",
] }
thiserror = "1.0.44"
tracing = "0.1.37"
tracing-chrome = "0.6.0"
Expand Down Expand Up @@ -117,6 +120,3 @@ name = "test_undo"

[[test]]
name = "test_wrap"



12 changes: 12 additions & 0 deletions git-branchless/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod wrap;
use git_branchless_invoke::CommandContext;
use lib::core::rewrite::MergeConflictRemediation;

use lib::util::ExitCode;
use lib::{core::gc, util::EyreExitOr};

use git_branchless_opts::{
Expand Down Expand Up @@ -43,6 +44,17 @@ fn command_main(ctx: CommandContext, opts: Opts) -> EyreExitOr<()> {

Command::BugReport => bug_report::bug_report(&effects, &git_run_info)?,

Command::Difftool(opts) => {
let result = scm_record::scm_diff_editor::scm_diff_editor_main(opts);
match result {
Ok(()) | Err(scm_record::scm_diff_editor::Error::Cancelled) => Ok(()),
Err(err) => {
eprintln!("Error: {err}");
Err(ExitCode(1))
}
}
}

Command::Switch { switch_options } => {
git_branchless_navigation::switch(&effects, &git_run_info, &switch_options)?
}
Expand Down
3 changes: 3 additions & 0 deletions git-branchless/tests/test_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ fn test_install_man_pages() -> eyre::Result<()> {
git\-branchless\-bug\-report(1)
Gather information about recent operations to upload as part of a bug report
.TP
git\-branchless\-difftool(1)
Use the partial commit selector UI as a Git\-compatible difftool; see git\-difftool(1) for more information on Git difftools
.TP
git\-branchless\-gc(1)
Run internal garbage collection
.TP
Expand Down
Loading

0 comments on commit 8ce75e7

Please sign in to comment.