From 3aec9eaa99e5124b5991d72f2398a8b305e9da98 Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Mon, 25 Dec 2023 13:16:25 -0700 Subject: [PATCH] wip: upgrade version of scm-record To get the fix at https://github.com/arxanas/git-branchless/pull/1013 "fix(record): don't add new files with no selected contents". --- Cargo.lock | 88 +++++++++++++++++++++++++--------- Cargo.toml | 2 +- cli/src/merge_tools/builtin.rs | 8 +++- 3 files changed, 73 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db43801f14..ef78430129 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -584,9 +584,9 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.25.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" +checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" dependencies = [ "bitflags 1.3.2", "crossterm_winapi", @@ -600,11 +600,11 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.26.1" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" +checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "crossterm_winapi", "libc", "mio", @@ -1521,6 +1521,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "indoc" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" + [[package]] name = "insta" version = "1.34.0" @@ -2003,6 +2009,12 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "pathdiff" version = "0.2.1" @@ -2314,6 +2326,23 @@ dependencies = [ "getrandom", ] +[[package]] +name = "ratatui" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad" +dependencies = [ + "bitflags 2.4.0", + "cassowary", + "crossterm 0.27.0", + "indoc", + "itertools 0.11.0", + "paste", + "strum", + "unicode-segmentation", + "unicode-width", +] + [[package]] name = "rayon" version = "1.8.0" @@ -2488,6 +2517,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.15" @@ -2505,18 +2540,18 @@ dependencies = [ [[package]] name = "scm-record" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de5add99102ba58391e9c1e0c2ee5410654d8ffe7605a393db863a403cb5a2d" +checksum = "e45342a3f095f3b895b4958332c25e7cc2e0ad20caca84c0f22df8f39d279a24" dependencies = [ "cassowary", - "crossterm 0.26.1", + "crossterm 0.27.0", "num-traits", + "ratatui", "serde", "serde_json", "thiserror", "tracing", - "tui", "unicode-width", ] @@ -2687,6 +2722,28 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.37", +] + [[package]] name = "subtle" version = "2.5.0" @@ -3045,19 +3102,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "tui" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1" -dependencies = [ - "bitflags 1.3.2", - "cassowary", - "crossterm 0.25.0", - "unicode-segmentation", - "unicode-width", -] - [[package]] name = "typenum" version = "1.17.0" diff --git a/Cargo.toml b/Cargo.toml index edbb2e4da7..8f9180f909 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ ref-cast = "1.0.21" regex = "1.10.2" rpassword = "7.3.1" rustix = { version = "0.38.28", features = ["fs"] } -scm-record = "0.1.0" +scm-record = "0.2.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.108" slab = "0.4.9" diff --git a/cli/src/merge_tools/builtin.rs b/cli/src/merge_tools/builtin.rs index 42ac4acb0d..6f444ec0a8 100644 --- a/cli/src/merge_tools/builtin.rs +++ b/cli/src/merge_tools/builtin.rs @@ -416,12 +416,14 @@ pub fn edit_diff_builtin( .try_collect() .block_on()?; let files = make_diff_files(&store, left_tree, right_tree, &changed_files)?; + let mut input = scm_record::helpers::CrosstermInput; let recorder = scm_record::Recorder::new( scm_record::RecordState { is_read_only: false, files, + commits: Default::default(), }, - scm_record::EventSource::Crossterm, + &mut input, ); let result = recorder.run().map_err(BuiltinToolError::Record)?; let tree_id = apply_diff_builtin(store, left_tree, right_tree, changed_files, &result.files) @@ -518,6 +520,7 @@ pub fn edit_merge_builtin( let slices = content.map(|ContentHunk(v)| v.as_slice()); let merge_result = files::merge(&slices); let sections = make_merge_sections(merge_result)?; + let mut input = scm_record::helpers::CrosstermInput; let recorder = scm_record::Recorder::new( scm_record::RecordState { is_read_only: false, @@ -527,8 +530,9 @@ pub fn edit_merge_builtin( file_mode: None, sections, }], + commits: Default::default(), }, - scm_record::EventSource::Crossterm, + &mut input, ); let state = recorder.run()?;