From ea257cae8d61ffcf2a5bb15c61806f4ac08fb5b3 Mon Sep 17 00:00:00 2001 From: Dan Sully Date: Wed, 10 Jul 2024 05:05:42 -0700 Subject: [PATCH] Update to the 2021 edition of Rust & fix issues * Update to the 2021 edition * Fix some typos * Remove some unnecessary referencing * Update version to 0.7.0 --- Cargo.lock | 411 +++++++++++++------------ Cargo.toml | 32 +- examples/create_demo_repo.rs | 2 +- src/lib.rs | 24 +- src/main.rs | 2 +- tests/tests/all_branches.rs | 6 +- tests/tests/basic.rs | 10 +- tests/tests/basic_conflict.rs | 6 +- tests/tests/checked_out.rs | 18 +- tests/tests/conflict_resume.rs | 20 +- tests/tests/from_another_worktree.rs | 8 +- tests/tests/multiple_branches.rs | 6 +- tests/tests/multiple_refs_on_branch.rs | 6 +- tests/tests/random.rs | 4 +- tests/utils/mod.rs | 24 +- 15 files changed, 295 insertions(+), 284 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a135bab..6636c9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,17 +11,66 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" -version = "1.0.40" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "argh" -version = "0.1.4" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91792f088f87cdc7a2cfb1d617fa5ea18d7f1dc22ef0e1b5f82f3157cdc522be" +checksum = "7af5ba06967ff7214ce4c7419c7d185be7ecd6cc4965a8f6e1d8ce0398aad219" dependencies = [ "argh_derive", "argh_shared", @@ -29,37 +78,28 @@ dependencies = [ [[package]] name = "argh_derive" -version = "0.1.4" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4eb0c0c120ad477412dc95a4ce31e38f2113e46bd13511253f79196ca68b067" +checksum = "56df0aeedf6b7a2fc67d06db35b09684c3e8da0c95f8f27685cb17e08413d87a" dependencies = [ "argh_shared", - "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.70", ] [[package]] name = "argh_shared" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781f336cc9826dbaddb9754cb5db61e64cab4f69668bd19dcc4a0394a86f4cb1" - -[[package]] -name = "atty" -version = "0.2.14" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531" dependencies = [ - "hermit-abi 0.1.18", - "libc", - "winapi", + "serde", ] [[package]] name = "autorebase" -version = "0.6.0" +version = "0.7.0" dependencies = [ "anyhow", "argh", @@ -74,42 +114,32 @@ dependencies = [ "toml", ] -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - [[package]] name = "bitflags" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" -[[package]] -name = "cc" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" -dependencies = [ - "libc", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + [[package]] name = "colored" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "atty", "lazy_static", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -118,17 +148,27 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + [[package]] name = "env_logger" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" dependencies = [ + "anstream", + "anstyle", + "env_filter", "humantime", - "is-terminal", "log", - "regex", - "termcolor", ] [[package]] @@ -139,24 +179,19 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.2" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "errno-dragonfly", "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "fastrand" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "getrandom" @@ -184,30 +219,6 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" -[[package]] -name = "heck" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - [[package]] name = "humantime" version = "2.1.0" @@ -225,21 +236,16 @@ dependencies = [ ] [[package]] -name = "is-terminal" -version = "0.4.9" +name = "is_terminal_polyfill" +version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi 0.3.2", - "rustix", - "windows-sys", -] +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "itertools" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -252,24 +258,21 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "log" -version = "0.4.14" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" @@ -285,32 +288,31 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "rand" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", "rand_core", - "rand_hc", ] [[package]] @@ -332,24 +334,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8270314b5ccceb518e7e578952f0b72b88222d02e8f77f5ecf7abbb673539041" -dependencies = [ - "bitflags 1.2.1", -] - [[package]] name = "regex" version = "1.5.4" @@ -367,26 +351,17 @@ version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.0", + "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -406,14 +381,14 @@ checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] @@ -430,33 +405,33 @@ dependencies = [ ] [[package]] -name = "tempfile" -version = "3.2.0" +name = "syn" +version = "2.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" dependencies = [ - "cfg-if", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "termcolor" -version = "1.1.2" +name = "tempfile" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "winapi-util", + "cfg-if", + "fastrand", + "rustix", + "windows-sys 0.52.0", ] [[package]] name = "toml" -version = "0.7.6" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" dependencies = [ "serde", "serde_spanned", @@ -466,18 +441,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.22.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" dependencies = [ "indexmap", "serde", @@ -493,10 +468,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] -name = "unicode-segmentation" -version = "1.7.1" +name = "utf8parse" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "wasi" @@ -505,58 +480,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] -name = "winapi" -version = "0.3.9" +name = "windows-sys" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "windows-targets 0.48.2", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" +name = "windows-sys" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "winapi", + "windows-targets 0.52.6", ] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.48.0" +name = "windows-targets" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "d1eeca1c172a285ee6c2c84c341ccea837e7c01b12fbb2d0fe3c9e550ce49ec8" dependencies = [ - "windows-targets", + "windows_aarch64_gnullvm 0.48.2", + "windows_aarch64_msvc 0.48.2", + "windows_i686_gnu 0.48.2", + "windows_i686_msvc 0.48.2", + "windows_x86_64_gnu 0.48.2", + "windows_x86_64_gnullvm 0.48.2", + "windows_x86_64_msvc 0.48.2", ] [[package]] name = "windows-targets" -version = "0.48.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1eeca1c172a285ee6c2c84c341ccea837e7c01b12fbb2d0fe3c9e550ce49ec8" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -565,47 +534,95 @@ version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b10d0c968ba7f6166195e13d593af609ec2e3d24f916f081690695cf5eaffb2f" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[package]] name = "windows_aarch64_msvc" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "571d8d4e62f26d4932099a9efe89660e8bd5087775a2ab5cdd8b747b811f1058" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[package]] name = "windows_i686_gnu" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2229ad223e178db5fbbc8bd8d3835e51e566b8474bfca58d2e6150c48bb723cd" +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[package]] name = "windows_i686_msvc" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "600956e2d840c194eedfc5d18f8242bc2e17c7775b6684488af3a9fff6fe3287" +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[package]] name = "windows_x86_64_gnu" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea99ff3f8b49fb7a8e0d305e5aec485bd068c2ba691b6e277d29eaeac945868a" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1a05a1ece9a7a0d5a7ccf30ba2c33e3a61a30e042ffd247567d1de1d94120d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[package]] name = "windows_x86_64_msvc" version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d419259aba16b663966e29e6d7c6ecfa0bb8425818bb96f6f1f3c3eb71a6e7b9" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "winnow" -version = "0.5.12" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83817bbecf72c73bad717ee86820ebf286203d2e04c3951f3cd538869c897364" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index d4f1b50..827cdde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,25 +1,25 @@ [package] -name = "autorebase" -version = "0.6.0" -authors = ["Tim Hutt "] -edition = "2018" -license = "MIT" +authors = [ "Tim Hutt " ] description = "Automatically rebase feature branches onto master" -keywords = ["git", "rebase"] +edition = "2021" +keywords = [ "git", "rebase" ] +license = "MIT" +name = "autorebase" repository = "https://github.com/Timmmm/autorebase" +version = "0.7.0" [dependencies] -anyhow = "1.0.40" -argh = "0.1.4" -colored = "2.0.0" -env_logger = "0.10.0" +anyhow = "1.0.86" +argh = "0.1.12" +colored = "2.1.0" +env_logger = "0.11.3" git_commands = { path = "git_commands", version = "0.2.0" } -itertools = "0.11.0" -log = "0.4.14" -serde = { version = "1.0", features = ["derive"] } -toml = "0.7.6" +itertools = "0.13.0" +log = "0.4.22" +serde = { version = "1.0", features = [ "derive" ] } +toml = "0.8.14" [dev-dependencies] # For tests -tempfile = "3.1.0" -rand = "0.8.3" +rand = "0.8.5" +tempfile = "3.10.1" diff --git a/examples/create_demo_repo.rs b/examples/create_demo_repo.rs index 9c467ac..ca8d431 100644 --- a/examples/create_demo_repo.rs +++ b/examples/create_demo_repo.rs @@ -16,7 +16,7 @@ fn main() { .write("a.txt", "hello") .child( commit("Write specification") - .write("spec.txt", "Specifcation: Do nothing") + .write("spec.txt", "Specification: Do nothing") .child( commit("Implement specification") .write("code.c", "int main() { return 1; }") diff --git a/src/lib.rs b/src/lib.rs index f52e3cb..88933e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,9 +64,9 @@ pub fn autorebase( None => default_branch_name(path)?, }; - // The first thing we do is set the commiter date to now. If we don't do this + // The first thing we do is set the committer date to now. If we don't do this // then when we have two branch labels on the same commit, when they get - // rebased they will be given different commiter dates which will mean they + // rebased they will be given different committer dates which will mean they // get different hashes and end up as separate commits. set_committer_date_to_now(); @@ -243,7 +243,7 @@ fn rebase_branch( } conflicts.branches.remove(&branch.branch); - conflicts.write_to_file(&conflicts_path)?; + conflicts.write_to_file(conflicts_path)?; let merge_base = get_merge_base(worktree_path, &branch.branch, onto_branch)?; @@ -261,7 +261,7 @@ fn rebase_branch( &worktree.path } else { // It isn't checked out anywhere; switch to it in our temporary worktree. - switch_to_branch(&branch.branch, &worktree_path)?; + switch_to_branch(&branch.branch, worktree_path)?; worktree_path }; @@ -322,7 +322,7 @@ fn rebase_branch( let result = attempt_rebase( git_common_dir, rebase_worktree_path, - &last_nonconflicting_commit, + last_nonconflicting_commit, )?; match result { RebaseResult::Success => { @@ -339,7 +339,7 @@ fn rebase_branch( // Switch to the branch so that we don't leave references to unneeded commits // around, and detach otherwise we may prevent people checking it out. - git(&["switch", "--detach", &branch.branch], &worktree_path)?; + git(&["switch", "--detach", &branch.branch], worktree_path)?; if stopped_by_conflicts { eprintln!( @@ -353,7 +353,7 @@ fn rebase_branch( conflicts .branches .insert(branch.branch.clone(), new_branch_commit); - conflicts.write_to_file(&conflicts_path)?; + conflicts.write_to_file(conflicts_path)?; } Ok(()) @@ -531,7 +531,7 @@ fn attempt_rebase(git_common_dir: &Path, worktree_path: &Path, onto: &str) -> Re Ok(RebaseResult::Conflict) } -const TEMPORARY_BRANCH_NAME: &'static str = "autorebase_tmp_safe_to_delete"; +const TEMPORARY_BRANCH_NAME: &str = "autorebase_tmp_safe_to_delete"; /// Create a temporary branch at master (`onto`), then try to rebase it ont /// `branch`. Count how many commits were rebased successfully, and @@ -639,7 +639,7 @@ enum BranchOrCommit { fn get_current_branch(working_dir: &Path) -> Result> { let output = Command::new("git") .current_dir(working_dir) - .args(&["symbolic-ref", "--quiet", "--short", "HEAD"]) + .args(["symbolic-ref", "--quiet", "--short", "HEAD"]) .output()?; if output.status.success() { @@ -654,7 +654,7 @@ fn get_current_branch(working_dir: &Path) -> Result> { /// return an error if we are on an unborn branch. That's an error for us though /// so we don't have to treat that case specially. fn get_commit_hash(working_dir: &Path, branch: &str) -> Result { - let commit = git(&["rev-parse", &branch], working_dir)?.stdout; + let commit = git(&["rev-parse", branch], working_dir)?.stdout; let commit = std::str::from_utf8(commit.trim_ascii_whitespace())?; Ok(commit.to_owned()) } @@ -671,10 +671,10 @@ fn get_current_branch_or_commit(working_dir: &Path) -> Result { fn switch_to_branch_or_commit(working_dir: &Path, branch_or_commit: &BranchOrCommit) -> Result<()> { match branch_or_commit { BranchOrCommit::Branch(ref branch) => { - git(&["switch", &branch], working_dir)?; + git(&["switch", branch], working_dir)?; } BranchOrCommit::Commit(ref commit) => { - git(&["switch", "--detach", &commit], working_dir)?; + git(&["switch", "--detach", commit], working_dir)?; } } Ok(()) diff --git a/src/main.rs b/src/main.rs index c60823f..4b87dbf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ struct CliOptions { onto: Option, /// if there are conflicts, try rebasing commit by commit backwards from the - /// target, instead of trying to determind the conflicting commit on the + /// target, instead of trying to determined the conflicting commit on the /// target branch directly #[argh(switch)] slow: bool, diff --git a/tests/tests/all_branches.rs b/tests/tests/all_branches.rs index f87a40f..4cb2aa1 100644 --- a/tests/tests/all_branches.rs +++ b/tests/tests/all_branches.rs @@ -21,14 +21,14 @@ fn with_include(include_all_branches: bool) -> BTreeMap let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase(repo_dir, Some("master"), false, include_all_branches, None) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - get_repo_graph(&repo_dir).expect("error getting repo graph") + get_repo_graph(repo_dir).expect("error getting repo graph") } #[test] diff --git a/tests/tests/basic.rs b/tests/tests/basic.rs index 8e5aab7..a13c1c1 100644 --- a/tests/tests/basic.rs +++ b/tests/tests/basic.rs @@ -14,9 +14,9 @@ fn test_build_repo() { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "baf6cf8e026e065d369b3dd103c4cc73ffba52dd": CommitGraphNode { @@ -61,7 +61,7 @@ fn basic_autorebase(slow_conflict_detection: bool) { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -72,9 +72,9 @@ fn basic_autorebase(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "a6de41485a5af44adc18b599a63840c367043e39": CommitGraphNode { diff --git a/tests/tests/basic_conflict.rs b/tests/tests/basic_conflict.rs index 9478768..3bbb224 100644 --- a/tests/tests/basic_conflict.rs +++ b/tests/tests/basic_conflict.rs @@ -32,7 +32,7 @@ fn conflict(slow_conflict_detection: bool) { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -43,9 +43,9 @@ fn conflict(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "386e8eec713b111eca536adc310dfccf22323ad7": CommitGraphNode { diff --git a/tests/tests/checked_out.rs b/tests/tests/checked_out.rs index 075c1be..c771b88 100644 --- a/tests/tests/checked_out.rs +++ b/tests/tests/checked_out.rs @@ -25,7 +25,7 @@ fn checkedout_clean(slow_conflict_detection: bool) { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -36,9 +36,9 @@ fn checkedout_clean(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "a6de41485a5af44adc18b599a63840c367043e39": CommitGraphNode { @@ -93,7 +93,7 @@ fn checkedout_dirty(slow_conflict_detection: bool) { // Make it dirty. fs::write(repo_dir.join("b.txt"), "baz").expect("error writing file"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -104,9 +104,9 @@ fn checkedout_dirty(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "a6de41485a5af44adc18b599a63840c367043e39": CommitGraphNode { @@ -168,7 +168,7 @@ fn checked_out_conflict(slow_conflict_detection: bool) { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -179,9 +179,9 @@ fn checked_out_conflict(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "386e8eec713b111eca536adc310dfccf22323ad7": CommitGraphNode { diff --git a/tests/tests/conflict_resume.rs b/tests/tests/conflict_resume.rs index 542f9f9..e4313be 100644 --- a/tests/tests/conflict_resume.rs +++ b/tests/tests/conflict_resume.rs @@ -38,7 +38,7 @@ fn conflict_resume(slow_conflict_detection: bool) { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -49,9 +49,9 @@ fn conflict_resume(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "386e8eec713b111eca536adc310dfccf22323ad7": CommitGraphNode { @@ -103,13 +103,13 @@ fn conflict_resume(slow_conflict_detection: bool) { // Ok if we run `autorebase` again we should expect it not to change anything. - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase(repo_dir, Some("master"), true, false, None).expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "211ae909a7bf0a2052009b8c21bebc6947591277": CommitGraphNode { @@ -170,15 +170,15 @@ fn conflict_resume(slow_conflict_detection: bool) { // Check out master again so `wip` can be autorebased. git(&["checkout", "master"], repo_dir).expect("error checking out master"); - // Ok if we run `autorebase` is should succesfully rebase to master. + // Ok if we run `autorebase` is should successfully rebase to master. - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase(repo_dir, Some("master"), true, false, None).expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "20b78857d9e5095469d9f91a5de77d0c36813b46": CommitGraphNode { diff --git a/tests/tests/from_another_worktree.rs b/tests/tests/from_another_worktree.rs index 290d8dc..9c44270 100644 --- a/tests/tests/from_another_worktree.rs +++ b/tests/tests/from_another_worktree.rs @@ -33,7 +33,7 @@ fn from_another_worktree(slow_conflict_detection: bool) { &[ "worktree", "add", - &another_worktree_repo_dir + another_worktree_repo_dir .to_str() .expect("non-unicode test path"), ], @@ -41,7 +41,7 @@ fn from_another_worktree(slow_conflict_detection: bool) { ) .expect("Couldn't create another worktree"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); // Now autorebase from the other worktree dir. autorebase( @@ -53,9 +53,9 @@ fn from_another_worktree(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "a6de41485a5af44adc18b599a63840c367043e39": CommitGraphNode { diff --git a/tests/tests/multiple_branches.rs b/tests/tests/multiple_branches.rs index d413800..af22b9d 100644 --- a/tests/tests/multiple_branches.rs +++ b/tests/tests/multiple_branches.rs @@ -25,7 +25,7 @@ fn multiple_branches(slow_conflict_detection: bool) { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -36,9 +36,9 @@ fn multiple_branches(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "540f822d14ae077991e2a722996825e4e7f9d667": CommitGraphNode { diff --git a/tests/tests/multiple_refs_on_branch.rs b/tests/tests/multiple_refs_on_branch.rs index 220a33a..52a2b0c 100644 --- a/tests/tests/multiple_refs_on_branch.rs +++ b/tests/tests/multiple_refs_on_branch.rs @@ -29,7 +29,7 @@ fn multiple_branches(slow_conflict_detection: bool) { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -40,9 +40,9 @@ fn multiple_branches(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); - let graph = get_repo_graph(&repo_dir).expect("error getting repo graph"); + let graph = get_repo_graph(repo_dir).expect("error getting repo graph"); let expected_graph = commit_graph!( "540f822d14ae077991e2a722996825e4e7f9d667": CommitGraphNode { diff --git a/tests/tests/random.rs b/tests/tests/random.rs index 3383be5..f1010f4 100644 --- a/tests/tests/random.rs +++ b/tests/tests/random.rs @@ -21,7 +21,7 @@ fn random_test(slow_conflict_detection: bool) { let repo_dir = repo.path(); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); autorebase( repo_dir, @@ -32,7 +32,7 @@ fn random_test(slow_conflict_detection: bool) { ) .expect("error autorebasing"); - print_git_log_graph(&repo_dir); + print_git_log_graph(repo_dir); // This doesn't really test anything yet; just makes sure the code doesn't panic. } diff --git a/tests/utils/mod.rs b/tests/utils/mod.rs index ee64819..b9610e5 100644 --- a/tests/utils/mod.rs +++ b/tests/utils/mod.rs @@ -18,21 +18,15 @@ pub fn git_fixed_dates() { /// Create a temporary directory and initialise it as a Git repo. pub fn create_temporary_git_repo() -> TempDir { let repo_dir = tempdir().expect("Couldn't create temporary directory"); - git(&["init", "--initial-branch=master"], &repo_dir.path()) + git(&["init", "--initial-branch=master"], repo_dir.path()) .expect("error initialising git repo"); // You have to set these otherwise Git can't do commits. - git( - &["config", "user.email", "me@example.com"], - &repo_dir.path(), - ) - .expect("error setting config"); - git(&["config", "user.name", "Me"], &repo_dir.path()).expect("error setting config"); + git(&["config", "user.email", "me@example.com"], repo_dir.path()) + .expect("error setting config"); + git(&["config", "user.name", "Me"], repo_dir.path()).expect("error setting config"); // Hide detached head warnings. - git( - &["config", "advice.detachedHead", "false"], - &repo_dir.path(), - ) - .expect("error setting config"); + git(&["config", "advice.detachedHead", "false"], repo_dir.path()) + .expect("error setting config"); repo_dir } @@ -174,7 +168,7 @@ pub fn build_repo(root: &CommitDescription, checkout_when_done: Option<&str>) -> args.push(parent); } - args.push(&tree_object); + args.push(tree_object); // Commit. let this_commit = git(&args, repo_path).expect("error committing").stdout; @@ -203,8 +197,8 @@ pub fn build_repo(root: &CommitDescription, checkout_when_done: Option<&str>) -> // Process the children. for child in c.children.iter() { // Checkout this commit. - git(&["checkout", &this_commit], repo_path).expect("error checking out commit"); - process_commit(child, repo_path, Some(&this_commit), hash_by_id); + git(&["checkout", this_commit], repo_path).expect("error checking out commit"); + process_commit(child, repo_path, Some(this_commit), hash_by_id); } }