Mercurial > forks > helix
changeset 6825:b133610eca2f draft
feat: integrate hg-core as DiffProvider
author | zegervdv <zegervdv@me.com> |
---|---|
date | Fri, 05 Apr 2024 07:48:58 +0200 |
parents | 41a5d98e164b |
children | 01d5c96e4e85 |
files | Cargo.lock helix-term/Cargo.toml helix-vcs/Cargo.toml helix-vcs/src/hg.rs helix-vcs/src/lib.rs |
diffstat | 5 files changed, 950 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/Cargo.lock Sat Feb 22 17:36:04 2025 +0100 +++ b/Cargo.lock Fri Apr 05 07:48:58 2024 +0200 @@ -94,11 +94,38 @@ [[package]] name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] name = "block-buffer" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -137,6 +164,26 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] +name = "bytes-cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20de93b91d7703ca0e39e12930e310acec5ff4d715f4166e0ab026babb352e8" +dependencies = [ + "bytes-cast-derive", +] + +[[package]] +name = "bytes-cast-derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7470a6fcce58cde3d62cce758bf71007978b75247e6becd9255c9b884bcb4f71" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] name = "cassowary" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -148,6 +195,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f4ac86a9e5bc1e2b3449ab9d7d3a6a405e3d1bb28d7b9be8614f55846ae3766" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -158,6 +207,12 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] name = "chardetng" version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -176,11 +231,50 @@ dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", + "wasm-bindgen", "windows-link", ] [[package]] +name = "clap" +version = "4.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39" +dependencies = [ + "bitflags 1.3.2", + "clap_derive", + "clap_lex", + "is-terminal", + "once_cell", + "strsim", + "termcolor", +] + +[[package]] +name = "clap_derive" +version = "4.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "clap_lex" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646" +dependencies = [ + "os_str_bytes", +] + +[[package]] name = "clipboard-win" version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -196,6 +290,19 @@ checksum = "cbd0f76e066e64fdc5631e3bb46381254deab9ef1158292f27c8c57e3bf3fe59" [[package]] +name = "console" +version = "0.15.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +dependencies = [ + "encode_unicode", + "libc", + "once_cell", + "unicode-width 0.2.0", + "windows-sys 0.59.0", +] + +[[package]] name = "content_inspector" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -205,6 +312,12 @@ ] [[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -229,6 +342,15 @@ ] [[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] name = "crossbeam-deque" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -259,7 +381,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags", + "bitflags 2.9.1", "crossterm_winapi", "filedescriptor", "futures-core", @@ -292,6 +414,16 @@ ] [[package]] +name = "ctrlc" +version = "3.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73" +dependencies = [ + "nix", + "windows-sys 0.59.0", +] + +[[package]] name = "dashmap" version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -306,6 +438,25 @@ ] [[package]] +name = "derive_more" +version = "0.99.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.101", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -323,7 +474,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -333,12 +484,24 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] +name = "dyn-clone" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" + +[[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] name = "encoding_rs" version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -451,6 +614,7 @@ dependencies = [ "crc32fast", "libz-rs-sys", + "libz-sys", "miniz_oxide", ] @@ -476,6 +640,32 @@ ] [[package]] +name = "format-bytes" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48942366ef93975da38e175ac9e10068c6fc08ca9e85930d4f098f4d5b14c2fd" +dependencies = [ + "format-bytes-macros", +] + +[[package]] +name = "format-bytes-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "203aadebefcc73d12038296c228eabf830f99cba991b0032adf20e9fa6ce7e4f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] name = "futures-core" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -671,7 +861,7 @@ "bstr", "gix-chunk", "gix-hash", - "memmap2", + "memmap2 0.9.5", "thiserror 2.0.12", ] @@ -702,7 +892,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439d62e241dae2dffd55bfeeabe551275cf9d9f084c5ebc6b48bad49d03285b7" dependencies = [ - "bitflags", + "bitflags 2.9.1", "bstr", "gix-path", "libc", @@ -841,7 +1031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90181472925b587f6079698f79065ff64786e6d6c14089517a1972bca99fb6e9" dependencies = [ - "bitflags", + "bitflags 2.9.1", "bstr", "gix-features", "gix-path", @@ -889,7 +1079,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b38e919efd59cb8275d23ad2394b2ab9d002007b27620e145d866d546403b665" dependencies = [ - "bitflags", + "bitflags 2.9.1", "bstr", "filetime", "fnv", @@ -905,7 +1095,7 @@ "hashbrown 0.14.5", "itoa", "libc", - "memmap2", + "memmap2 0.9.5", "rustix 1.0.7", "smallvec", "thiserror 2.0.12", @@ -977,7 +1167,7 @@ "gix-hashtable", "gix-object", "gix-path", - "memmap2", + "memmap2 0.9.5", "smallvec", "thiserror 2.0.12", ] @@ -1026,7 +1216,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce061c50e5f8f7c830cacb3da3e999ae935e283ce8522249f0ce2256d110979d" dependencies = [ - "bitflags", + "bitflags 2.9.1", "bstr", "gix-attributes", "gix-config-value", @@ -1081,7 +1271,7 @@ "gix-tempfile", "gix-utils", "gix-validate", - "memmap2", + "memmap2 0.9.5", "thiserror 2.0.12", "winnow", ] @@ -1136,7 +1326,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0dabbc78c759ecc006b970339394951b2c8e1e38a37b072c105b80b84c308fd" dependencies = [ - "bitflags", + "bitflags 2.9.1", "gix-path", "libc", "windows-sys 0.59.0", @@ -1234,7 +1424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8648172f85aca3d6e919c06504b7ac26baef54e04c55eb0100fa588c102cc33" dependencies = [ - "bitflags", + "bitflags 2.9.1", "gix-commitgraph", "gix-date", "gix-hash", @@ -1346,7 +1536,7 @@ "grep-matcher", "log", "memchr", - "memmap2", + "memmap2 0.9.5", ] [[package]] @@ -1360,6 +1550,22 @@ [[package]] name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", + "rayon", +] + +[[package]] +name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" @@ -1390,12 +1596,18 @@ ] [[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] name = "helix-core" version = "25.1.1" dependencies = [ "anyhow", "arc-swap", - "bitflags", + "bitflags 2.9.1", "chrono", "encoding_rs", "foldhash", @@ -1419,7 +1631,7 @@ "smallvec", "smartstring", "textwrap", - "toml", + "toml 0.8.22", "tree-house", "unicode-general-category", "unicode-segmentation", @@ -1469,7 +1681,7 @@ "serde", "tempfile", "threadpool", - "toml", + "toml 0.8.22", "tree-house", ] @@ -1500,7 +1712,7 @@ name = "helix-lsp-types" version = "0.95.1" dependencies = [ - "bitflags", + "bitflags 2.9.1", "serde", "serde_json", "url", @@ -1514,7 +1726,7 @@ name = "helix-stdx" version = "25.1.1" dependencies = [ - "bitflags", + "bitflags 2.9.1", "dunce", "etcetera", "once_cell", @@ -1551,7 +1763,7 @@ "helix-vcs", "helix-view", "ignore", - "indexmap", + "indexmap 2.9.0", "indoc", "libc", "log", @@ -1570,7 +1782,7 @@ "thiserror 2.0.12", "tokio", "tokio-stream", - "toml", + "toml 0.8.22", "url", ] @@ -1578,7 +1790,7 @@ name = "helix-tui" version = "25.1.1" dependencies = [ - "bitflags", + "bitflags 2.9.1", "cassowary", "crossterm", "helix-core", @@ -1598,6 +1810,7 @@ "gix", "helix-core", "helix-event", + "hg-core", "imara-diff", "log", "parking_lot", @@ -1611,7 +1824,7 @@ dependencies = [ "anyhow", "arc-swap", - "bitflags", + "bitflags 2.9.1", "chardetng", "clipboard-win", "crossterm", @@ -1636,7 +1849,7 @@ "thiserror 2.0.12", "tokio", "tokio-stream", - "toml", + "toml 0.8.22", "url", ] @@ -1647,6 +1860,58 @@ checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] +name = "hermit-abi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" + +[[package]] +name = "hg-core" +version = "0.1.0" +dependencies = [ + "bitflags 1.3.2", + "bitvec", + "byteorder", + "bytes-cast", + "chrono", + "clap", + "crossbeam-channel", + "ctrlc", + "derive_more", + "dyn-clone", + "filetime", + "flate2", + "format-bytes", + "hashbrown 0.13.2", + "home", + "im-rc", + "indicatif", + "itertools", + "lazy_static", + "libc", + "log", + "logging_timer", + "memmap2 0.5.10", + "once_cell", + "pretty_assertions", + "rand", + "rand_distr", + "rand_pcg", + "rayon", + "regex", + "same-file", + "self_cell", + "serde", + "sha-1", + "tempfile", + "thread_local", + "toml 0.6.0", + "twox-hash", + "uuid", + "zstd", +] + +[[package]] name = "home" version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1803,6 +2068,20 @@ ] [[package]] +name = "im-rc" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" +dependencies = [ + "bitmaps", + "rand_core", + "rand_xoshiro", + "sized-chunks", + "typenum", + "version_check", +] + +[[package]] name = "imara-diff" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1813,6 +2092,16 @@ [[package]] name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" @@ -1822,6 +2111,19 @@ ] [[package]] +name = "indicatif" +version = "0.17.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width 0.2.0", + "web-time", +] + +[[package]] name = "indoc" version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1837,6 +2139,17 @@ ] [[package]] +name = "is-terminal" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +dependencies = [ + "hermit-abi 0.5.1", + "libc", + "windows-sys 0.59.0", +] + +[[package]] name = "is-wsl" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1847,6 +2160,15 @@ ] [[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] name = "itoa" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1875,7 +2197,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -1894,6 +2216,16 @@ ] [[package]] +name = "jobserver" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + +[[package]] name = "js-sys" version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1913,6 +2245,12 @@ ] [[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] name = "libc" version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1929,12 +2267,18 @@ ] [[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] name = "libredox" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags", + "bitflags 2.9.1", "libc", "redox_syscall", ] @@ -1949,6 +2293,17 @@ ] [[package]] +name = "libz-sys" +version = "1.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] name = "linux-raw-sys" version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1983,6 +2338,28 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] +name = "logging_timer" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5669c09dbcb4a0b5f6de8364154495574238e18d6736bbdaa7726307f3268471" +dependencies = [ + "log", + "logging_timer_proc_macros", +] + +[[package]] +name = "logging_timer_proc_macros" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27906ca51651609191eeb2d1fdc6b52b8024789ec188b07aad88b6dfbe392fbe" +dependencies = [ + "log", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] name = "maybe-async" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1990,7 +2367,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -2001,6 +2378,16 @@ [[package]] name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", + "stable_deref_trait", +] + +[[package]] +name = "memmap2" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" @@ -2030,6 +2417,27 @@ ] [[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + +[[package]] name = "nucleo" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2057,6 +2465,7 @@ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -2065,11 +2474,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] [[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] name = "object" version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2096,6 +2511,12 @@ ] [[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + +[[package]] name = "parking_lot" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2143,6 +2564,12 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] name = "portable-atomic" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2167,6 +2594,49 @@ ] [[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "pretty_assertions" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] name = "proc-macro2" version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2191,7 +2661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" dependencies = [ - "bitflags", + "bitflags 2.9.1", "memchr", "unicase", ] @@ -2221,11 +2691,29 @@ checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" [[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", "rand_core", ] @@ -2239,6 +2727,34 @@ ] [[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "rand_pcg" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core", +] + +[[package]] name = "rayon" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2264,7 +2780,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" dependencies = [ - "bitflags", + "bitflags 2.9.1", ] [[package]] @@ -2326,12 +2842,21 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] name = "rustix" version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags", + "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.4.15", @@ -2344,7 +2869,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ - "bitflags", + "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.9.4", @@ -2379,6 +2904,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] +name = "self_cell" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749" + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + +[[package]] name = "serde" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2395,7 +2932,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -2420,6 +2957,17 @@ ] [[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] name = "sha1" version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2495,6 +3043,16 @@ ] [[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + +[[package]] name = "slab" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2564,6 +3122,23 @@ checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" [[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] name = "syn" version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2582,8 +3157,14 @@ dependencies = [ "proc-macro2", "quote", - "syn", -] + "syn 2.0.101", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" @@ -2599,6 +3180,15 @@ ] [[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] name = "termini" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2644,7 +3234,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -2655,7 +3245,17 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", ] [[package]] @@ -2718,7 +3318,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -2734,14 +3334,35 @@ [[package]] name = "toml" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb9d890e4dc9298b70f740f615f2e05b9db37dce531f6b24fb77ac993f9f217" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.5.1", + "toml_edit 0.18.1", +] + +[[package]] +name = "toml" version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" dependencies = [ "serde", "serde_spanned", - "toml_datetime", - "toml_edit", + "toml_datetime 0.6.9", + "toml_edit 0.22.26", +] + +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" +dependencies = [ + "serde", ] [[package]] @@ -2755,14 +3376,27 @@ [[package]] name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +dependencies = [ + "indexmap 1.9.3", + "nom8", + "serde", + "serde_spanned", + "toml_datetime 0.5.1", +] + +[[package]] +name = "toml_edit" version = "0.22.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" dependencies = [ - "indexmap", + "indexmap 2.9.0", "serde", "serde_spanned", - "toml_datetime", + "toml_datetime 0.6.9", "toml_write", "winnow", ] @@ -2804,6 +3438,17 @@ ] [[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "rand", + "static_assertions", +] + +[[package]] name = "typenum" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2885,6 +3530,21 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] +name = "uuid" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2937,7 +3597,7 @@ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.101", "wasm-bindgen-shared", ] @@ -2959,7 +3619,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2974,6 +3634,16 @@ ] [[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] name = "which" version = "7.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3037,7 +3707,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -3048,7 +3718,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -3242,7 +3912,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags", + "bitflags 2.9.1", ] [[package]] @@ -3252,6 +3922,15 @@ checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] name = "xtask" version = "25.1.1" dependencies = [ @@ -3259,8 +3938,14 @@ "helix-loader", "helix-term", "helix-view", - "toml", -] + "toml 0.8.22", +] + +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "yoke" @@ -3282,7 +3967,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", "synstructure", ] @@ -3303,7 +3988,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -3323,7 +4008,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", "synstructure", ] @@ -3357,7 +4042,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -3365,3 +4050,32 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "868b928d7949e09af2f6086dfc1e01936064cc7a819253bce650d4e2a2d63ba8" + +[[package]] +name = "zstd" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "6.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.15+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" +dependencies = [ + "cc", + "pkg-config", +]
--- a/helix-term/Cargo.toml Sat Feb 22 17:36:04 2025 +0100 +++ b/helix-term/Cargo.toml Fri Apr 05 07:48:58 2024 +0200 @@ -31,10 +31,11 @@ ] [features] -default = ["git"] +default = ["git", "hg"] unicode-lines = ["helix-core/unicode-lines", "helix-view/unicode-lines"] integration = ["helix-event/integration_test"] git = ["helix-vcs/git"] +hg = ["helix-vcs/hg"] [[bin]] name = "hx"
--- a/helix-vcs/Cargo.toml Sat Feb 22 17:36:04 2025 +0100 +++ b/helix-vcs/Cargo.toml Fri Apr 05 07:48:58 2024 +0200 @@ -21,12 +21,14 @@ gix = { version = "0.72.1", features = ["attributes", "status"], default-features = false, optional = true } imara-diff = "0.1.8" +hg-core = { path = '../vendor/mercurial-devel/rust/hg-core' , optional = true } anyhow = "1" log = "0.4" [features] git = ["gix"] +hg = ["hg-core"] [dev-dependencies] tempfile.workspace = true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/helix-vcs/src/hg.rs Fri Apr 05 07:48:58 2024 +0200 @@ -0,0 +1,168 @@ +use anyhow::{anyhow, Context, Result}; +use arc_swap::ArcSwap; +use hg::matchers::AlwaysMatcher; +use hg::utils::hg_path::{hg_path_to_path_buf, HgPath}; +use std::path::{Path, PathBuf}; +use std::str; +use std::sync::Arc; + +use hg::config::Config; +use hg::dirstate::status::StatusPath; +use hg::operations::cat; +use hg::repo::Repo; +use hg::DirstateStatus; +use hg::PatternFileWarning; +use hg::StatusError; +use hg::StatusOptions; + +use crate::FileChange; + +#[derive(Clone, Copy)] +pub struct Hg; + +impl Hg { + fn find_repo_root(path: &Path) -> Result<PathBuf> { + for ancestor in path.ancestors() { + if ancestor.join(".hg").is_dir() { + return Ok(ancestor.to_path_buf()); + } + } + Err(anyhow!("cannot find root path")) + } + + fn open_repo(path: &Path, root: Option<&Path>) -> Result<Repo> { + let non_repo_config = Config::load_non_repo().unwrap(); + let repo_path = match root { + Some(root_path) => root_path.to_path_buf(), + None => Hg::find_repo_root(path).context("cannot find root path")?, + }; + + match Repo::find(&non_repo_config, Some(repo_path).to_owned()) { + Ok(repo) => Ok(repo), + Err(_) => Err(anyhow!("failed to open hg repo")), + } + } + + fn status(repo: &Repo, f: impl Fn(Result<FileChange>) -> bool) -> Result<()> { + let mut dmap = repo.dirstate_map_mut().map_err(|e| anyhow!("{:?}", e))?; + type StatusResult<'a> = Result<(DirstateStatus<'a>, Vec<PatternFileWarning>), StatusError>; + + let work_dir = repo.working_directory_path(); + + let after_status = |res: StatusResult| -> Result<_> { + let (ds_status, _) = res.map_err(|e| anyhow!("{:?}", e))?; + + let mut paths = Vec::new(); + + paths.extend(ds_status.modified); + paths.extend(ds_status.added); + + for StatusPath { path, copy_source } in paths { + let path = + work_dir.join(hg_path_to_path_buf(path).map_err(|e| anyhow!("{:?}", e))?); + let change = match copy_source { + Some(from) => FileChange::Renamed { + from_path: hg_path_to_path_buf(from).map_err(|e| anyhow!("{:?}", e))?, + to_path: path, + }, + None => FileChange::Modified { path }, + }; + if !f(Ok(change)) { + break; + } + } + + // Assume unsure means conflicted (might not always be true) + for StatusPath { path, copy_source } in ds_status.unsure { + let path = + work_dir.join(hg_path_to_path_buf(path).map_err(|e| anyhow!("{:?}", e))?); + if !f(Ok(FileChange::Conflict { path })) { + break; + } + } + + for StatusPath { path, copy_source } in ds_status.removed { + let path = + work_dir.join(hg_path_to_path_buf(path).map_err(|e| anyhow!("{:?}", e))?); + if !f(Ok(FileChange::Deleted { path })) { + break; + } + } + Ok(()) + }; + let options = StatusOptions { + check_exec: true, + list_clean: false, + list_unknown: false, + list_ignored: false, + list_copies: true, + collect_traversed_dirs: false, + }; + + dmap.with_status( + Box::new(AlwaysMatcher).as_ref(), + repo.working_directory_path().to_owned(), + Vec::new(), + options, + after_status, + ); + Ok(()) + } +} + +impl Hg { + pub fn get_diff_base(&self, file: &Path) -> Result<Vec<u8>> { + debug_assert!(!file.exists() || file.is_file()); + debug_assert!(file.is_absolute()); + + let repo_dir = file.parent().context("file has no parent directory")?; + let repo = Hg::open_repo(repo_dir, None).context("failed to open hg repo")?; + let working_dir = repo.working_directory_path(); + + let rev = "."; + let files = vec![HgPath::new( + file.strip_prefix(working_dir)?.to_str().unwrap(), + )]; + + match cat(&repo, &rev, files) { + Err(e) => Err(anyhow!("failed to get file contents: {:?}", e)), + Ok(result) => match result.results.get(0) { + Some((_file, contents)) => return Ok(contents.to_vec()), + None => Err(anyhow!("no such index")), + }, + } + } + + pub fn get_current_head_name(&self, file: &Path) -> Result<Arc<ArcSwap<Box<str>>>> { + let repo_dir = file.parent().context("file has no parent directory")?; + let repo = Hg::open_repo(repo_dir, None).context("failed to open hg repo")?; + + let rev = revset::resolve_single(".", &repo).map_err(|e| anyhow!("{:?}", e))?; + let changelog = repo.changelog().map_err(|e| anyhow!("{:?}", e))?; + let node = changelog.node_from_rev(rev.into()); + + match node { + Some(n) => { + let rev = format!("{:x}", n); + Ok(Arc::new(ArcSwap::from_pointee( + rev.to_owned().into_boxed_str(), + ))) + } + None => Err(anyhow!("could not find node")), + } + } + + pub fn for_each_changed_file( + &self, + cwd: &Path, + f: impl Fn(Result<FileChange>) -> bool, + ) -> Result<()> { + Self::status(&Self::open_repo(cwd, None)?, f) + } +} + +impl From<Hg> for DiffProvider { + fn from(value: Hg) -> Self { + DiffProvider::Hg(value) + } +}
--- a/helix-vcs/src/lib.rs Sat Feb 22 17:36:04 2025 +0100 +++ b/helix-vcs/src/lib.rs Fri Apr 05 07:48:58 2024 +0200 @@ -7,6 +7,8 @@ #[cfg(feature = "git")] mod git; +#[cfg(feature = "hg")] +mod hg; mod diff; @@ -75,6 +77,8 @@ let providers = vec![ #[cfg(feature = "git")] DiffProvider::Git, + #[cfg(feature = "hg")] + DiffProvider::Hg, ]; DiffProviderRegistry { providers } } @@ -88,6 +92,8 @@ pub enum DiffProvider { #[cfg(feature = "git")] Git, + #[cfg(feature = "hg")] + Hg, None, } @@ -96,6 +102,8 @@ match self { #[cfg(feature = "git")] Self::Git => git::get_diff_base(file), + #[cfg(feature = "hg")] + Self::Hg => hg::get_diff_base(file), Self::None => bail!("No diff support compiled in"), } } @@ -104,6 +112,8 @@ match self { #[cfg(feature = "git")] Self::Git => git::get_current_head_name(file), + #[cfg(feature = "hg")] + Self::Hg => hg::get_current_head_name(file), Self::None => bail!("No diff support compiled in"), } } @@ -116,6 +126,8 @@ match self { #[cfg(feature = "git")] Self::Git => git::for_each_changed_file(cwd, f), + #[cfg(feature = "hg")] + Self::Hg => hg::for_each_changed_file(cwd, f), Self::None => bail!("No diff support compiled in"), } }