From 077e7b7445d845026484e0a5264b5e6dd2ef2807 Mon Sep 17 00:00:00 2001 From: Amin Atabiev Date: Sun, 11 Oct 2026 14:06:44 +0300 Subject: [PATCH 1/5] feat: rewrite commit messages with libgit2 instead of git filter-branch - edit the full commit message, body and trailers are no longer dropped - rewrite only descendants of the target commit, preserving trees, authors and committers, with real progress - back up moved refs under refs/commit-rewriter/backup/: confirm deletes the backups, rollback restores refs and reports failures - refuse a new rewrite while a previous one is unconfirmed, and offer to confirm or roll it back when the repository is opened - update annotated and lightweight tags and detached HEAD, never touch remote-tracking refs - default to rewriting the current branch only - fix crash on Apply after the commit list was reloaded - fix "Load more" visibility and keep loaded pages on refresh - fix search highlighting panic on non-ASCII text and the Clear logs button - use log levels for background task messages, drop dead code - add integration tests on temporary repositories - upgrade eframe to 0.36, git2 to 0.21, rfd to 0.17 (no GTK on Linux) - set rust-version and commit Cargo.lock --- .gitignore | 1 - Cargo.lock | 4459 ++++++++++++++++++++++++++++++++++++ Cargo.toml | 12 +- src/app.rs | 543 ++--- src/background/messages.rs | 12 +- src/background/mod.rs | 4 +- src/background/tasks.rs | 395 ++-- src/git/commands.rs | 113 - src/git/mod.rs | 10 +- src/git/operations.rs | 74 - src/git/repository.rs | 114 +- src/git/rewrite.rs | 369 +++ src/lib.rs | 5 + src/main.rs | 8 +- src/models/commit.rs | 20 +- src/models/log.rs | 9 +- src/models/mod.rs | 2 +- src/models/preview.rs | 63 +- src/ui/commits_list.rs | 252 +- src/ui/editor_panel.rs | 8 +- src/ui/logs_panel.rs | 18 +- src/ui/main_window.rs | 44 +- src/ui/preview_modal.rs | 209 +- tests/integration_test.rs | 4 - tests/rewrite.rs | 437 ++++ 25 files changed, 6054 insertions(+), 1131 deletions(-) create mode 100644 Cargo.lock delete mode 100644 src/git/commands.rs delete mode 100644 src/git/operations.rs create mode 100644 src/git/rewrite.rs create mode 100644 src/lib.rs delete mode 100644 tests/integration_test.rs create mode 100644 tests/rewrite.rs diff --git a/.gitignore b/.gitignore index 7b6e21f..7063099 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # Rust /target/ -Cargo.lock # Releases and builds /releases/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..9c445c8 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4459 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + +[[package]] +name = "accesskit" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320" +dependencies = [ + "uuid", +] + +[[package]] +name = "accesskit_atspi_common" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e8c61bee90b42a772d39d06a740207dc71a4e780004ace1db8d99fb1baaa954" +dependencies = [ + "accesskit", + "accesskit_consumer 0.36.0", + "atspi-common", + "phf", + "serde", + "zvariant", +] + +[[package]] +name = "accesskit_consumer" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53cf47daed85312e763fbf85ceca136e0d7abc68e0a7e12abe11f48172bc3b10" +dependencies = [ + "accesskit", + "hashbrown 0.16.1", +] + +[[package]] +name = "accesskit_consumer" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e0d7e25d06f4dc21d1774d67146e9e80d6789216cbd4d1e88185b0095dba60" +dependencies = [ + "accesskit", + "hashbrown 0.16.1", +] + +[[package]] +name = "accesskit_consumer" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d10a236f96f87d70732e44520046785431ef01d5bcd6b041317bfadd2f88245" +dependencies = [ + "accesskit", + "hashbrown 0.16.1", +] + +[[package]] +name = "accesskit_macos" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce02dc63b43f0c9296af9ac946312a2dc8814427d7a64d2d600971dac55b6076" +dependencies = [ + "accesskit", + "accesskit_consumer 0.38.0", + "hashbrown 0.16.1", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "accesskit_unix" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b016ca8db0ea0ea2ceff29a9d6240391492d960716aa471967c00e8cc8cb197c" +dependencies = [ + "accesskit", + "accesskit_atspi_common", + "async-channel", + "async-executor", + "async-task", + "atspi", + "futures-lite", + "futures-util", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_windows" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff7009f1a532e917d66970a1e80c965140c6cfbbabbdde3d64e5431e6c78e21" +dependencies = [ + "accesskit", + "accesskit_consumer 0.35.0", + "hashbrown 0.16.1", + "static_assertions", + "windows", + "windows-core", +] + +[[package]] +name = "accesskit_winit" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fe9a94394896352cc4660ca2288bd4ef883d83238853c038b44070c8f134313" +dependencies = [ + "accesskit", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "raw-window-handle", + "winit", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arboard" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.60.2", + "x11rb", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.5", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.5", +] + +[[package]] +name = "async-recursion" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.5", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atspi" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d" +dependencies = [ + "atspi-common", + "atspi-proxies", +] + +[[package]] +name = "atspi-common" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d" +dependencies = [ + "enumflags2", + "serde", + "static_assertions", + "zbus", + "zbus-lockstep", + "zbus-lockstep-macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "atspi-proxies" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc" +dependencies = [ + "atspi-common", + "serde", + "zbus", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.3", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.5", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.5", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop 0.13.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.5", + "rustix 1.1.5", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "cc" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50a649af8a827553c29fb0cb4bd4a6f1a0dd695bd3232b9bc98bd9c8a3ffbb8b" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clipboard-win" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +dependencies = [ + "error-code", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + +[[package]] +name = "color" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "combine" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "commit-rewriter" +version = "2.0.0" +dependencies = [ + "anyhow", + "chrono", + "eframe", + "git2", + "rfd", + "tempfile", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "libc", + "objc2 0.6.5", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "ecolor" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0656a7530b9e2841ee7a5f983965bdd9840c32f4012f759cfd44b912cced6b34" +dependencies = [ + "bytemuck", + "emath", +] + +[[package]] +name = "eframe" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ad41fac6e3149abb4866e93df37dbd33baa95db525c3368c944584e95a5dc2" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "egui-wgpu", + "egui-winit", + "egui_glow", + "glutin", + "glutin-winit", + "image", + "js-sys", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "pollster 1.0.1", + "profiling", + "raw-window-handle", + "static_assertions", + "wasm-bindgen", + "web-sys", + "web-time", + "wgpu", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc938cc27cd911415e1e4d151bc56ff9df063d8db081374e87aeb805ea74b2ba" +dependencies = [ + "accesskit", + "ahash", + "bitflags 2.13.2", + "emath", + "epaint", + "itertools", + "log", + "nohash-hasher", + "profiling", + "smallvec", + "unicode-segmentation", + "web-sys", +] + +[[package]] +name = "egui-wgpu" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cef1f6d1bba40b09a4d0d62cb822b81030922cfbf65c5373398c3a3caafc5bd" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "epaint", + "log", + "profiling", + "thiserror 2.0.21", + "type-map", + "web-time", + "wgpu", + "winit", +] + +[[package]] +name = "egui-winit" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98466000559d66ba4db786a30448b01483946add4188e7f10f522a27b4fb89cc" +dependencies = [ + "accesskit_winit", + "arboard", + "bytemuck", + "egui", + "log", + "objc2 0.6.5", + "objc2-foundation 0.3.2", + "objc2-ui-kit 0.3.2", + "profiling", + "raw-window-handle", + "smithay-clipboard", + "web-time", + "webbrowser", + "winit", +] + +[[package]] +name = "egui_glow" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "606ed4167daf341e5753d703285c4c1d562324b2c07aa8f405cd7d066fe58f3b" +dependencies = [ + "bytemuck", + "egui", + "glow", + "log", + "profiling", + "winit", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "emath" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c8d4141cf0f60fb2f7aefaf352d3ffa5171ef0ab09731c64391801e95e48f1" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "epaint" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0ec0308dc23130fc1a7d4623a8534c2ed069c6dc84e258ee4f3de99615aa1a3" +dependencies = [ + "ahash", + "bytemuck", + "ecolor", + "emath", + "epaint_default_fonts", + "font-types", + "harfrust", + "log", + "nohash-hasher", + "parking_lot", + "profiling", + "self_cell", + "skrifa", + "smallvec", + "unicode-general-category", + "unicode-segmentation", + "vello_cpu", +] + +[[package]] +name = "epaint_default_fonts" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773fa9c96dd0dbef887e39d0ed6177f141cce4d68e6041df77570aa3702dfa13" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "fearless_simd" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" + +[[package]] +name = "find-msvc-tools" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c92d9081c7ab3bd83ef1eecdfad090f3d966e3ce74106779664114cfe1a6274" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.5", + "windows-link", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "git2" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddddbf932745a6be37109b6112d3ee09696106f848449069d3a57bba937ab82e" +dependencies = [ + "bitflags 2.13.2", + "libc", + "libgit2-sys", + "log", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glifo" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed4a1bb24121291d27230c1b1b44e07d6a9b28cefdb32fe1581dfb84e14f940a" +dependencies = [ + "bytemuck", + "foldhash", + "hashbrown 0.17.1", + "log", + "peniko", + "skrifa", + "smallvec", + "vello_common", +] + +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.13.2", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", +] + +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", + "windows", +] + +[[package]] +name = "guillotiere" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab" +dependencies = [ + "euclid", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "tiff", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + +[[package]] +name = "libc" +version = "0.2.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" + +[[package]] +name = "libgit2-sys" +version = "0.18.8+1.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7c568b25d7489bc3fb2988ed69ab111d2944d2f5fec3d5c987fe545ea97b50" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.4", +] + +[[package]] +name = "libz-sys" +version = "1.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bc9657773828b90eeb625adff10eeac83cc21bbfd8e23a03eaa8a33c9e28d9" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "libc", + "objc2 0.5.3", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.3", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core 0.2.2", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-float" +version = "5.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "peniko" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "linebender_resource_handle", + "smallvec", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "pollster" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336" + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "rfd" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20dafead71c16a34e1ff357ddefc8afc11e7d51d6d2b9fbd07eaa48e3e540220" +dependencies = [ + "block2 0.6.2", + "dispatch2", + "js-sys", + "libc", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "percent-encoding", + "pollster 0.4.0", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[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 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit 0.19.2", + "tiny-skia", +] + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.14.5", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.5", + "thiserror 2.0.21", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit 0.20.0", + "wayland-backend", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d62a2e0561533f2ca2561d0cf27fd9fedb640a1bf2616ff5d5c80d99017faadc" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.17+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + +[[package]] +name = "type-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" +dependencies = [ + "rustc-hash 2.1.3", +] + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + +[[package]] +name = "unicode-ident" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606" +dependencies = [ + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "vello_common" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e9aed918117e8152c9eddfd8362d73c465c23f26c44786aa331707b8a64fa2" +dependencies = [ + "bytemuck", + "fearless_simd", + "guillotiere", + "log", + "peniko", + "smallvec", + "thiserror 2.0.21", +] + +[[package]] +name = "vello_cpu" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac7349e1f55f6b801c7c277958df4ea53e7f20f21e8014910ad888b2ecda93ea" +dependencies = [ + "bytemuck", + "glifo", + "hashbrown 0.17.1", + "vello_common", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.7", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.5", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags 2.13.2", + "rustix 1.1.5", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.5", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[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 = "webbrowser" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94" +dependencies = [ + "jni", + "log", + "ndk-context", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "url", + "web-sys", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "naga", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-wasm", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d260ca2ca8adc654f513a869bf3cac0b47f5b8d3f87803d6942015f8de597aae" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.13.2", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "hashbrown 0.17.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "naga", + "naga-types", + "ndk-sys", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge", + "wgpu-types", + "windows", + "windows-core", + "windows-result", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "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]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[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_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[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_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2 0.5.1", + "bytemuck", + "calloop 0.13.0", + "cfg_aliases", + "concurrent-queue", + "core-foundation", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "sctk-adwaita", + "smithay-client-toolkit 0.19.2", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.5", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", + "synstructure", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.5", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus-lockstep" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" +dependencies = [ + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus-lockstep-macros" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "zbus-lockstep", + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.7", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" +dependencies = [ + "serde", + "winnow", + "zvariant", +] + +[[package]] +name = "zbus_xml" +version = "5.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" +dependencies = [ + "serde", + "winnow", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zcheapstr" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" +dependencies = [ + "serde", +] + +[[package]] +name = "zerocopy" +version = "0.8.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86502bf56ac7c77571a32e2647bb2a15894565e981fb2a48d7bde2d91c965a9d" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5457206954b06561e2608c7e19cf58b1926586d999c246eebe4502f7e2039d1a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.7", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "5.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow", + "zcheapstr", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.7", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.7", + "winnow", +] diff --git a/Cargo.toml b/Cargo.toml index 4f08ec9..ec665db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,18 +2,22 @@ name = "commit-rewriter" version = "2.0.0" edition = "2021" +rust-version = "1.95" authors = ["Amin Atabiev"] description = "Git commit message rewriter with GUI" +repository = "https://github.com/atabits/git-commit-rewriter" license = "MIT" [dependencies] -eframe = "0.28" -egui = "0.28" -git2 = { version = "0.19", default-features = false, features = ["vendored-libgit2"] } +eframe = "0.36" +git2 = { version = "0.21", default-features = false, features = ["vendored-libgit2"] } chrono = "0.4" -rfd = "0.14" +rfd = "0.17" anyhow = "1.0" +[dev-dependencies] +tempfile = "3" + [profile.release] opt-level = "z" # Optimize for size lto = true # Enable Link Time Optimization diff --git a/src/app.rs b/src/app.rs index f8ecd4e..9f7d94d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,12 +1,17 @@ use crate::background::{ - load_commits_task, rewrite_commit_task, rollback_changes_task, BackgroundMessage, + confirm_rewrite_task, load_commits_task, rewrite_commit_task, rollback_changes_task, + BackgroundMessage, }; -use crate::git::{get_current_branch, GitRepositoryImpl}; +use crate::git::{self, RewriteScope}; use crate::models::{CommitInfo, LogEntry, LogFilter, LogLevel, PreviewData}; use crate::ui::{commits_list, editor_panel, logs_panel, main_window, preview_modal}; use eframe::egui; use std::path::PathBuf; -use std::sync::mpsc; +use std::sync::mpsc::{self, Sender}; + +/// Number of commits fetched per page. +const PAGE_SIZE: usize = 50; +const MAX_LOG_ENTRIES: usize = 1000; pub struct CommitRewriterApp { pub repo_path: Option, @@ -15,8 +20,6 @@ pub struct CommitRewriterApp { pub commits: Vec, pub selected_index: Option, - pub commits_limit: usize, - pub commits_loaded: usize, pub loading_more: bool, pub has_more_commits: bool, @@ -30,29 +33,25 @@ pub struct CommitRewriterApp { pub is_processing: bool, pub message_receiver: Option>, + initialized: bool, pub show_help: bool, pub search_query: String, - pub filtered_count: usize, - pub show_preview_modal: bool, pub preview_data: Option, } impl Default for CommitRewriterApp { fn default() -> Self { - let current_dir = std::env::current_dir().ok(); let mut app = Self { repo_path: None, current_branch: None, - modify_all_branches: true, + modify_all_branches: false, commits: Vec::new(), selected_index: None, - commits_limit: 50, - commits_loaded: 0, loading_more: false, - has_more_commits: true, + has_more_commits: false, new_message: String::new(), @@ -64,23 +63,21 @@ impl Default for CommitRewriterApp { is_processing: false, message_receiver: None, + initialized: false, show_help: false, search_query: String::new(), - filtered_count: 0, - show_preview_modal: false, preview_data: None, }; // try to use current directory if it's a git repo - if let Some(dir) = current_dir { - if GitRepositoryImpl::is_valid_repo(&dir) { - app.repo_path = Some(dir.clone()); - app.add_log(&format!("Initialized with directory: {}", dir.display())); - } else { - app.add_log("Select a Git repository to get started"); + match std::env::current_dir() { + Ok(dir) if git::is_valid_repo(&dir) => { + app.add_log(&format!("Opened repository: {}", dir.display())); + app.set_repo(dir); } + _ => app.add_log("Select a Git repository to get started"), } app @@ -96,368 +93,322 @@ impl CommitRewriterApp { self.logs.push(LogEntry::now(message.to_string(), level)); // keep log size reasonable - if self.logs.len() > 1000 { + if self.logs.len() > MAX_LOG_ENTRIES { self.logs.drain(0..100); } } - pub fn load_commits_async(&mut self, ctx: egui::Context) { - self.load_commits_async_with_limit(ctx, self.commits_limit, 0, true); + fn set_repo(&mut self, path: PathBuf) { + self.current_branch = git::open(&path) + .ok() + .and_then(|repo| git::current_branch(&repo)); + self.repo_path = Some(path); + self.commits.clear(); + self.clear_selection(); } - pub fn load_more_commits_async(&mut self, ctx: egui::Context) { - if self.loading_more || self.is_processing { - return; - } - self.loading_more = true; - self.load_commits_async_with_limit(ctx, 50, self.commits_loaded, false); + fn clear_selection(&mut self) { + self.selected_index = None; + self.new_message.clear(); } - fn load_commits_async_with_limit( + /// Size of a full reload: keeps already loaded pages on refresh. + fn reload_limit(&self) -> usize { + self.commits.len().max(PAGE_SIZE) + } + + /// Runs `task` on a background thread and routes its messages to the UI. + fn spawn_task( &mut self, - ctx: egui::Context, - limit: usize, - offset: usize, - reset: bool, - ) { - let path = match self.repo_path.as_ref() { - Some(p) => p.clone(), - None => { - self.add_log("❌ Repository not selected"); - return; - } + ctx: &egui::Context, + task: impl FnOnce(PathBuf, Sender) + Send + 'static, + ) -> bool { + let Some(path) = self.repo_path.clone() else { + self.add_log_typed("Repository not selected", LogLevel::Error); + return false; }; - if reset { - self.add_log_typed("Requesting commits from repository...", LogLevel::Info); - self.is_processing = true; - } else { - self.add_log_typed("Loading more commits...", LogLevel::Info); - } - let (tx, rx) = mpsc::channel(); self.message_receiver = Some(rx); - let ctx_clone = ctx.clone(); + let ctx = ctx.clone(); std::thread::spawn(move || { - load_commits_task(path, limit, offset, reset, tx); - ctx_clone.request_repaint(); + task(path, tx); + ctx.request_repaint(); }); + true + } + + pub fn load_commits_async(&mut self, ctx: &egui::Context) { + let limit = self.reload_limit(); + if self.spawn_task(ctx, move |path, tx| { + load_commits_task(&path, limit, 0, true, tx) + }) { + self.is_processing = true; + } + } - ctx.request_repaint(); + pub fn load_more_commits_async(&mut self, ctx: &egui::Context) { + if self.loading_more || self.is_processing { + return; + } + let offset = self.commits.len(); + if self.spawn_task(ctx, move |path, tx| { + load_commits_task(&path, PAGE_SIZE, offset, false, tx) + }) { + self.loading_more = true; + } } pub fn rewrite_commit_async( &mut self, commit_hash: String, new_message: String, - ctx: egui::Context, + ctx: &egui::Context, ) { - let path = match self.repo_path.as_ref() { - Some(p) => p.clone(), - None => { - self.add_log("❌ Repository not selected"); - return; + let scope = if self.modify_all_branches { + self.add_log_typed( + "Changes will be applied to all branches and tags", + LogLevel::Warning, + ); + RewriteScope::AllBranches + } else { + match &self.current_branch { + Some(branch) => self.add_log(&format!( + "Changes will be applied only to branch {}", + branch + )), + None => self.add_log("Changes will be applied to detached HEAD"), } + RewriteScope::CurrentBranch }; - // figure out current branch if we don't know it yet - if self.current_branch.is_none() { - self.current_branch = get_current_branch(&path); + let limit = self.reload_limit(); + if self.spawn_task(ctx, move |path, tx| { + rewrite_commit_task(&path, &commit_hash, &new_message, scope, limit, tx) + }) { + self.start_operation(); } + } - let modify_all = self.modify_all_branches; - let branch_name = self.current_branch.clone(); - - self.add_log(&format!("Starting commit rewrite {}...", &commit_hash[..8])); - if modify_all { - self.add_log("⚠️ Changes will be applied to ALL branches"); - } else if let Some(ref branch) = branch_name { - self.add_log(&format!( - "πŸ“Œ Changes will be applied only to branch: {}", - branch - )); + pub fn confirm_changes_async(&mut self, ctx: &egui::Context) { + let limit = self.reload_limit(); + if self.spawn_task(ctx, move |path, tx| confirm_rewrite_task(&path, limit, tx)) { + self.is_processing = true; } - - self.progress = 0.2; - self.is_processing = true; - self.show_progress = true; - - let (tx, rx) = mpsc::channel(); - self.message_receiver = Some(rx); - - let ctx_clone = ctx.clone(); - std::thread::spawn(move || { - rewrite_commit_task(path, commit_hash, new_message, modify_all, branch_name, tx); - ctx_clone.request_repaint(); - }); - - ctx.request_repaint(); } - pub fn rollback_changes_async(&mut self, ctx: egui::Context) { - let path = match self.repo_path.as_ref() { - Some(p) => p.clone(), - None => { - self.add_log("❌ Repository not selected"); - return; - } - }; + pub fn rollback_changes_async(&mut self, ctx: &egui::Context) { + self.add_log("Rolling back changes..."); + let limit = self.reload_limit(); + if self.spawn_task(ctx, move |path, tx| rollback_changes_task(&path, limit, tx)) { + self.start_operation(); + } + } - self.add_log("πŸ”„ Rolling back changes..."); + fn start_operation(&mut self) { + self.progress = 0.0; self.is_processing = true; self.show_progress = true; - self.progress = 0.1; - - let (tx, rx) = mpsc::channel(); - self.message_receiver = Some(rx); - - let ctx_clone = ctx.clone(); - std::thread::spawn(move || { - rollback_changes_task(path, tx); - ctx_clone.request_repaint(); - }); - - ctx.request_repaint(); } - pub fn process_background_messages(&mut self, ctx: &egui::Context) -> bool { - let mut needs_repaint = false; - let mut commit_rewritten = false; - - if let Some(receiver) = self.message_receiver.take() { - let mut messages = Vec::new(); - loop { - match receiver.try_recv() { - Ok(msg) => messages.push(msg), - Err(_) => break, - } - } + fn finish_operation(&mut self) { + self.is_processing = false; + self.loading_more = false; + self.show_progress = false; + } - for msg in messages { - match msg { - BackgroundMessage::Log(log) => { - self.add_log(&log); - needs_repaint = true; - } - BackgroundMessage::LogTyped(log, level) => { - self.add_log_typed(&log, level); - needs_repaint = true; - } - BackgroundMessage::Progress(p) => { - self.progress = p; - needs_repaint = true; - } - BackgroundMessage::CommitsLoaded(commits) => { - let loaded_count = commits.len(); - if self.loading_more { - self.commits.extend(commits); - self.commits_loaded = self.commits.len(); - self.loading_more = false; - // If we loaded less than requested, there are no more commits - self.has_more_commits = loaded_count >= 50; - } else { - self.commits = commits; - self.commits_loaded = self.commits.len(); - self.commits_limit = self.commits_loaded; - // If we loaded less than the limit, there are no more commits - self.has_more_commits = self.commits_loaded >= self.commits_limit; - } - self.filtered_count = self.commits.len(); - needs_repaint = true; - } - BackgroundMessage::CommitRewritten => { - commit_rewritten = true; - } - BackgroundMessage::PreviewReady(data) => { - self.preview_data = Some(data); - self.show_preview_modal = true; - needs_repaint = true; - } - BackgroundMessage::Error(err) => { - self.add_log_typed(&format!("ERROR: {}", err), LogLevel::Error); - self.is_processing = false; - self.loading_more = false; - self.show_progress = false; - needs_repaint = true; - } - BackgroundMessage::Done => { - self.is_processing = false; - self.loading_more = false; - if self.progress >= 1.0 { - self.show_progress = false; - } - needs_repaint = true; + pub fn process_background_messages(&mut self) { + let Some(receiver) = self.message_receiver.as_ref() else { + return; + }; + let messages: Vec<_> = receiver.try_iter().collect(); + + for msg in messages { + match msg { + BackgroundMessage::Log(log, level) => self.add_log_typed(&log, level), + BackgroundMessage::Progress(p) => self.progress = p, + BackgroundMessage::CommitsLoaded { + commits, + has_more, + reset, + } => { + if reset { + self.commits = commits; + self.clear_selection(); + } else { + self.commits.extend(commits); } + self.has_more_commits = has_more; } + BackgroundMessage::PreviewReady(data) => self.preview_data = Some(data), + BackgroundMessage::Error(err) => { + self.add_log_typed(&err, LogLevel::Error); + self.finish_operation(); + } + BackgroundMessage::Done => self.finish_operation(), } + } + } - if !commit_rewritten { - self.message_receiver = Some(receiver); - } + fn pick_repository(&mut self, ctx: &egui::Context) { + let Some(path) = rfd::FileDialog::new().pick_folder() else { + return; + }; + if !git::is_valid_repo(&path) { + self.add_log_typed( + "Selected directory is not a Git repository", + LogLevel::Error, + ); + return; } - // reload commits after rewrite - if commit_rewritten { - self.load_commits_async(ctx.clone()); + self.set_repo(path.clone()); + match &self.current_branch { + Some(branch) => self.add_log(&format!( + "Loading commits from {} (branch {})", + path.display(), + branch + )), + None => self.add_log(&format!("Loading commits from {}", path.display())), } + self.load_commits_async(ctx); + } - needs_repaint + fn apply_change(&mut self, ctx: &egui::Context) { + let Some(commit) = self + .selected_index + .and_then(|i| self.commits.get(i)) + .cloned() + else { + self.add_log_typed("Select a commit first", LogLevel::Warning); + return; + }; + + self.add_log(&format!("Rewriting commit {}...", commit.short_hash)); + self.add_log(&format!("Old: {}", commit.summary)); + self.add_log(&format!( + "New: {}", + self.new_message.lines().next().unwrap_or("") + )); + + let new_message = self.new_message.clone(); + self.rewrite_commit_async(commit.hash, new_message, ctx); } } impl eframe::App for CommitRewriterApp { - fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { - // initial load on startup - static INIT: std::sync::Once = std::sync::Once::new(); - INIT.call_once(|| { - if self.repo_path.is_some() && self.commits.is_empty() && !self.is_processing { - self.load_commits_async(ctx.clone()); + fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + if !self.initialized { + self.initialized = true; + if self.repo_path.is_some() { + self.load_commits_async(ctx); } - }); - - let needs_repaint = self.process_background_messages(ctx); - - if self.show_preview_modal { - if let Some(preview) = self.preview_data.clone() { - let result = preview_modal::render_preview_modal(ctx, &preview, self.is_processing); - - if result.confirm_clicked { - if self.repo_path.is_some() { - let (tx, rx) = mpsc::channel(); - self.message_receiver = Some(rx); - - std::thread::spawn(move || { - tx.send(BackgroundMessage::Log( - "Cleaning up temporary refs...".to_string(), - )) - .ok(); - tx.send(BackgroundMessage::Log("βœ… Changes confirmed!".to_string())) - .ok(); - tx.send(BackgroundMessage::CommitRewritten).ok(); - tx.send(BackgroundMessage::Done).ok(); - }); - } + } - self.show_preview_modal = false; - self.preview_data = None; - } + self.process_background_messages(); - if result.cancel_clicked { - self.rollback_changes_async(ctx.clone()); - self.show_preview_modal = false; - self.preview_data = None; - } - } + if self.is_processing || self.loading_more { + ctx.request_repaint(); } + } - if needs_repaint { - ctx.request_repaint(); + fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) { + let ctx = ui.ctx().clone(); + + if let Some(preview) = &self.preview_data { + let result = preview_modal::render_preview_modal(&ctx, preview, self.is_processing); + + if result.confirm_clicked { + self.preview_data = None; + self.confirm_changes_async(&ctx); + } else if result.cancel_clicked { + self.preview_data = None; + self.rollback_changes_async(&ctx); + } } - egui::SidePanel::right("logs_panel") + egui::Panel::right("logs_panel") .resizable(true) - .default_width(450.0) - .min_width(300.0) - .max_width(600.0) - .show(ctx, |ui| { - logs_panel::render_logs_panel( + .default_size(450.0) + .min_size(300.0) + .max_size(600.0) + .show(ui, |ui| { + let clear_clicked = logs_panel::render_logs_panel( ui, &self.logs, &mut self.log_filter, self.show_progress, self.progress, - self.is_processing, ); + if clear_clicked { + self.logs.clear(); + } }); - egui::CentralPanel::default().show(ctx, |ui| { + egui::CentralPanel::default_margins().show(ui, |ui| { + // the modal must be answered before anything else can change + let busy = self.is_processing || self.preview_data.is_some(); + let main_result = main_window::render_main_window( ui, self.repo_path.as_ref(), - &self.commits, - self.is_processing, + self.commits.len(), + busy, &mut self.show_help, &mut self.modify_all_branches, - self.current_branch.as_ref(), + self.current_branch.as_deref(), ); if main_result.pick_folder_clicked { - if let Some(path) = rfd::FileDialog::new().pick_folder() { - if GitRepositoryImpl::is_valid_repo(&path) { - self.repo_path = Some(path.clone()); - self.current_branch = get_current_branch(&path); - if let Some(ref branch) = self.current_branch { - self.add_log(&format!( - "βœ… Loading commits from: {} (branch: {})", - path.display(), - branch - )); - } else { - self.add_log(&format!("βœ… Loading commits from: {}", path.display())); - } - self.load_commits_async(ctx.clone()); - } else { - self.add_log("❌ Selected directory is not a Git repository"); - } - } + self.pick_repository(&ctx); } if main_result.refresh_clicked { - self.add_log("πŸ”„ Refreshing commits list..."); - self.load_commits_async(ctx.clone()); + self.add_log("Refreshing commits list..."); + if let Some(path) = &self.repo_path { + self.current_branch = git::open(path) + .ok() + .and_then(|repo| git::current_branch(&repo)); + } + self.load_commits_async(&ctx); } - ui.vertical(|ui| { - let commits_result = commits_list::render_commits_list( - ui, - &self.commits, - self.selected_index, - &mut self.search_query, - self.is_processing, - self.loading_more, - self.has_more_commits, - ); + let commits_result = commits_list::render_commits_list( + ui, + &self.commits, + self.selected_index, + &mut self.search_query, + busy, + self.loading_more, + self.has_more_commits, + ); - if let Some((index, short_hash, message)) = commits_result.selected_commit { + if let Some(index) = commits_result.selected_index { + if let Some(commit) = self.commits.get(index) { self.selected_index = Some(index); - self.new_message = message.clone(); - self.add_log(&format!("πŸ“ Selected commit: {} - {}", short_hash, message)); + self.new_message = commit.message.trim_end().to_string(); + let log = format!("Selected commit {} - {}", commit.short_hash, commit.summary); + self.add_log(&log); } + } - if commits_result.load_more_clicked { - self.load_more_commits_async(ctx.clone()); - } - - if commits_result.search_changed { - self.filtered_count = self.commits.len(); - } - - ui.separator(); - - let editor_result = editor_panel::render_editor_panel( - ui, - &mut self.new_message, - self.selected_index, - self.is_processing, - ); + if commits_result.load_more_clicked { + self.load_more_commits_async(&ctx); + } - if editor_result.apply_clicked { - if let Some(index) = self.selected_index { - let commit = self.commits[index].clone(); - let new_msg = self.new_message.clone(); + ui.separator(); - self.add_log(&format!( - "πŸ”„ Preparing to rewrite commit {}...", - commit.short_hash - )); - self.add_log(&format!("πŸ“ Old: {}", commit.message)); - self.add_log(&format!("πŸ“ New: {}", new_msg)); + let editor_result = editor_panel::render_editor_panel( + ui, + &mut self.new_message, + self.selected_index.is_some(), + busy, + ); - self.rewrite_commit_async(commit.hash, new_msg, ctx.clone()); - } - } - }); + if editor_result.apply_clicked { + self.apply_change(&ctx); + } }); } } diff --git a/src/background/messages.rs b/src/background/messages.rs index b690770..fb0b5d3 100644 --- a/src/background/messages.rs +++ b/src/background/messages.rs @@ -1,12 +1,14 @@ use crate::models::{CommitInfo, LogLevel, PreviewData}; -#[derive(Clone)] pub enum BackgroundMessage { - Log(String), - LogTyped(String, LogLevel), + Log(String, LogLevel), Progress(f32), - CommitsLoaded(Vec), - CommitRewritten, + CommitsLoaded { + commits: Vec, + has_more: bool, + reset: bool, + }, + /// A rewrite is waiting to be confirmed or rolled back. PreviewReady(PreviewData), Error(String), Done, diff --git a/src/background/mod.rs b/src/background/mod.rs index 39b50e6..144e3ce 100644 --- a/src/background/mod.rs +++ b/src/background/mod.rs @@ -2,4 +2,6 @@ pub mod messages; pub mod tasks; pub use messages::BackgroundMessage; -pub use tasks::{load_commits_task, rewrite_commit_task, rollback_changes_task}; +pub use tasks::{ + confirm_rewrite_task, load_commits_task, rewrite_commit_task, rollback_changes_task, +}; diff --git a/src/background/tasks.rs b/src/background/tasks.rs index 3dce539..de187cc 100644 --- a/src/background/tasks.rs +++ b/src/background/tasks.rs @@ -1,271 +1,210 @@ use crate::background::BackgroundMessage; -use crate::git::{rollback_changes, GitRepository, GitRepositoryImpl}; -use std::io::{BufRead, BufReader}; -use std::path::PathBuf; +use crate::git::{self, RefUpdate, RewriteScope}; +use crate::models::{LogLevel, PreviewData, RefChange, RewriteDetails}; +use git2::{Oid, Repository}; +use std::path::Path; use std::sync::mpsc::Sender; +struct Reporter { + tx: Sender, +} + +impl Reporter { + fn log(&self, message: impl Into, level: LogLevel) { + self.tx + .send(BackgroundMessage::Log(message.into(), level)) + .ok(); + } + + fn info(&self, message: impl Into) { + self.log(message, LogLevel::Info); + } + + fn success(&self, message: impl Into) { + self.log(message, LogLevel::Success); + } + + fn progress(&self, value: f32) { + self.tx.send(BackgroundMessage::Progress(value)).ok(); + } + + fn send(&self, message: BackgroundMessage) { + self.tx.send(message).ok(); + } + + fn fail(&self, context: &str, error: anyhow::Error) { + self.send(BackgroundMessage::Error(format!( + "{}: {:#}", + context, error + ))); + } +} + pub fn load_commits_task( - path: PathBuf, + path: &Path, limit: usize, offset: usize, reset: bool, tx: Sender, ) { - if reset { - tx.send(BackgroundMessage::Log("Opening repository...".to_string())) - .ok(); - } + let reporter = Reporter { tx }; - let repo = match GitRepositoryImpl::open(&path) { - Ok(r) => r, - Err(e) => { - tx.send(BackgroundMessage::Error(format!( - "Failed to open repository: {}", - e - ))) - .ok(); - return; - } + let repo = match git::open(path) { + Ok(repo) => repo, + Err(e) => return reporter.fail("Failed to open repository", e), }; - if reset { - tx.send(BackgroundMessage::Log("Reading commits...".to_string())) - .ok(); - } - - match repo.load_commits(limit, offset) { - Ok(commits) => { - let count = commits.len(); - if reset { - tx.send(BackgroundMessage::Log(format!( - "βœ… Loaded {} commits", - count - ))) - .ok(); - } else { - tx.send(BackgroundMessage::Log(format!( - "βœ… Loaded {} more commits", - count - ))) - .ok(); - } - tx.send(BackgroundMessage::CommitsLoaded(commits)).ok(); - } - Err(e) => { - tx.send(BackgroundMessage::Error(format!( - "Error reading commits: {}", - e - ))) - .ok(); - } + if send_commits(&reporter, &repo, limit, offset, reset) && reset { + report_pending_rewrite(&reporter, &repo); } - - tx.send(BackgroundMessage::Done).ok(); + reporter.send(BackgroundMessage::Done); } pub fn rewrite_commit_task( - path: PathBuf, - commit_hash: String, - new_message: String, - modify_all_branches: bool, - branch_name: Option, + path: &Path, + commit_hash: &str, + new_message: &str, + scope: RewriteScope, + reload_limit: usize, tx: Sender, ) { - let send_log = |msg: &str| { - tx.send(BackgroundMessage::Log(msg.to_string())).ok(); + let reporter = Reporter { tx }; + + let result = (|| { + let repo = git::open(path)?; + let target = Oid::from_str(commit_hash)?; + let old_message = + String::from_utf8_lossy(repo.find_commit(target)?.message_bytes()).into_owned(); + + reporter.info("Rewriting history..."); + let result = git::rewrite_message(&repo, target, new_message, scope, |done, total| { + reporter.progress(done as f32 / total.max(1) as f32 * 0.9); + })?; + + let details = RewriteDetails { + old_hash: commit_hash.to_string(), + new_hash: result.new_target.to_string(), + old_message, + new_message: git::normalize_message(new_message)?, + rewritten_commits: result.rewritten_commits, + }; + Ok::<_, anyhow::Error>((repo, details, result.ref_updates)) + })(); + + let (repo, details, ref_updates) = match result { + Ok(r) => r, + Err(e) => return reporter.fail("Rewrite failed", e), }; - send_log("Searching for commit in repository..."); - tx.send(BackgroundMessage::Progress(0.3)).ok(); + reporter.success(format!( + "Rewrote {} commits, moved {} refs. Review and confirm the change", + details.rewritten_commits, + ref_updates.len() + )); + reporter.progress(1.0); + reporter.send(BackgroundMessage::PreviewReady(PreviewData { + details: Some(details), + ref_changes: to_ref_changes(&ref_updates), + })); + send_commits(&reporter, &repo, reload_limit, 0, true); + reporter.send(BackgroundMessage::Done); +} - send_log("Preparing to rewrite history..."); - send_log("βš™οΈ Using git filter-branch..."); - send_log("⏳ This may take a while..."); - tx.send(BackgroundMessage::Progress(0.5)).ok(); +pub fn confirm_rewrite_task(path: &Path, reload_limit: usize, tx: Sender) { + let reporter = Reporter { tx }; - let mut child = match crate::git::commands::run_git_filter_branch( - &path, - &commit_hash, - &new_message, - modify_all_branches, - branch_name.as_deref(), - ) { - Ok(c) => c, - Err(e) => { - tx.send(BackgroundMessage::Error(format!( - "Failed to start git filter-branch: {}", - e - ))) - .ok(); - return; - } + let repo = match git::open(path) { + Ok(repo) => repo, + Err(e) => return reporter.fail("Failed to open repository", e), }; - // read stdout/stderr in separate threads - let tx_stdout = tx.clone(); - let tx_stderr = tx.clone(); - - if let Some(stdout) = child.stdout.take() { - std::thread::spawn(move || { - let reader = BufReader::new(stdout); - for line in reader.lines() { - if let Ok(line) = line { - if !line.trim().is_empty() { - tx_stdout - .send(BackgroundMessage::Log(format!("πŸ“ {}", line))) - .ok(); - } - } - } - }); + match git::confirm(&repo) { + Ok(removed) => { + reporter.success(format!("Changes confirmed, {} backups removed", removed)); + reporter.log( + "Push rewritten branches with: git push --force-with-lease", + LogLevel::Warning, + ); + } + Err(e) => return reporter.fail("Failed to confirm changes", e), } - if let Some(stderr) = child.stderr.take() { - std::thread::spawn(move || { - let reader = BufReader::new(stderr); - for line in reader.lines() { - if let Ok(line) = line { - if !line.trim().is_empty() { - tx_stderr - .send(BackgroundMessage::Log(format!("πŸ“ {}", line))) - .ok(); - } - } - } - }); - } + send_commits(&reporter, &repo, reload_limit, 0, true); + reporter.send(BackgroundMessage::Done); +} - // send progress updates while process runs - let mut progress = 0.5; - loop { - std::thread::sleep(std::time::Duration::from_millis(500)); - progress += 0.05; - if progress > 0.9 { - progress = 0.9; - } - tx.send(BackgroundMessage::Progress(progress)).ok(); +pub fn rollback_changes_task(path: &Path, reload_limit: usize, tx: Sender) { + let reporter = Reporter { tx }; - match child.try_wait() { - Ok(Some(status)) => { - tx.send(BackgroundMessage::Progress(0.9)).ok(); + let repo = match git::open(path) { + Ok(repo) => repo, + Err(e) => return reporter.fail("Failed to open repository", e), + }; - if !status.success() { - tx.send(BackgroundMessage::Error( - "git filter-branch failed (see logs above)".to_string(), - )) - .ok(); - return; - } + reporter.info("Restoring refs from backup..."); + reporter.progress(0.5); - send_log("βœ… git filter-branch completed successfully"); - break; - } - Ok(None) => { - continue; - } - Err(e) => { - tx.send(BackgroundMessage::Error(format!( - "Error checking status: {}", - e - ))) - .ok(); - return; - } + match git::rollback(&repo) { + Ok(restored) => { + reporter.success(format!("Rollback completed, {} refs restored", restored)); + reporter.progress(1.0); } + Err(e) => return reporter.fail("Rollback failed", e), } - send_log("Collecting preview data..."); - - let repo = match git2::Repository::open(&path) { - Ok(r) => r, - Err(e) => { - tx.send(BackgroundMessage::Error(format!( - "Failed to open repository: {}", - e - ))) - .ok(); - return; - } - }; + send_commits(&reporter, &repo, reload_limit, 0, true); + reporter.send(BackgroundMessage::Done); +} - let target_oid = match git2::Oid::from_str(&commit_hash) { - Ok(oid) => oid, - Err(e) => { - tx.send(BackgroundMessage::Error(format!( - "Invalid hash format: {}", - e - ))) - .ok(); - return; +/// Sends a page of commits. Returns `false` if loading failed. +fn send_commits( + reporter: &Reporter, + repo: &Repository, + limit: usize, + offset: usize, + reset: bool, +) -> bool { + match git::load_commits(repo, limit, offset) { + Ok(page) => { + reporter.info(format!("Loaded {} commits", page.commits.len())); + reporter.send(BackgroundMessage::CommitsLoaded { + commits: page.commits, + has_more: page.has_more, + reset, + }); + true } - }; - - let target_commit = match repo.find_commit(target_oid) { - Ok(c) => c, Err(e) => { - tx.send(BackgroundMessage::Error(format!("Commit not found: {}", e))) - .ok(); - return; + reporter.fail("Error reading commits", e); + false } - }; - - let old_message = target_commit - .message() - .unwrap_or("(no message)") - .lines() - .next() - .unwrap_or("(no message)") - .to_string(); - - let affected_commits = match crate::git::commands::get_original_refs(&path) { - Ok(refs) => refs, - Err(_) => Vec::new(), - }; - - let diff_output = match crate::git::commands::get_git_log(&path, 10) { - Ok(log) => log, - Err(_) => "Failed to get diff".to_string(), - }; - - let preview_data = crate::models::PreviewData::new( - commit_hash.clone(), - old_message, - new_message, - affected_commits, - diff_output, - ); - - send_log(&format!( - "βœ… Commit {} successfully rewritten! Showing preview...", - &commit_hash[..8] - )); - tx.send(BackgroundMessage::Progress(1.0)).ok(); - tx.send(BackgroundMessage::PreviewReady(preview_data)).ok(); - tx.send(BackgroundMessage::Done).ok(); + } } -pub fn rollback_changes_task(path: PathBuf, tx: Sender) { - let send_log = |msg: &str| { - tx.send(BackgroundMessage::Log(msg.to_string())).ok(); - }; - - send_log("Restoring original refs..."); - tx.send(BackgroundMessage::Progress(0.3)).ok(); - - match rollback_changes(&path) { - Ok(restored_count) => { - tx.send(BackgroundMessage::Progress(0.7)).ok(); - send_log(&format!( - "βœ… Rollback completed! Restored {} refs", - restored_count - )); - } - Err(e) => { - tx.send(BackgroundMessage::Error(format!("Rollback error: {}", e))) - .ok(); +fn report_pending_rewrite(reporter: &Reporter, repo: &Repository) { + match git::pending_backups(repo) { + Ok(updates) if !updates.is_empty() => { + reporter.log( + "Found an unconfirmed rewrite: confirm or roll it back", + LogLevel::Warning, + ); + reporter.send(BackgroundMessage::PreviewReady(PreviewData { + details: None, + ref_changes: to_ref_changes(&updates), + })); } + Ok(_) => {} + Err(e) => reporter.fail("Failed to check for unconfirmed rewrite", e), } +} - tx.send(BackgroundMessage::Progress(1.0)).ok(); - tx.send(BackgroundMessage::Done).ok(); +fn to_ref_changes(updates: &[RefUpdate]) -> Vec { + updates + .iter() + .map(|u| RefChange { + name: u.name.clone(), + old_hash: u.old_commit.to_string(), + new_hash: u.new_commit.to_string(), + }) + .collect() } diff --git a/src/git/commands.rs b/src/git/commands.rs deleted file mode 100644 index bfcfb89..0000000 --- a/src/git/commands.rs +++ /dev/null @@ -1,113 +0,0 @@ -use anyhow::Result; -use std::path::Path; -use std::process::{Command, Stdio}; - -pub fn run_git_filter_branch>( - repo_path: P, - commit_hash: &str, - new_message: &str, - modify_all_branches: bool, - branch_name: Option<&str>, -) -> Result { - let mut args = vec![ - "filter-branch".to_string(), - "-f".to_string(), - "--msg-filter".to_string(), - format!( - r#"if [ "$GIT_COMMIT" = "{}" ]; then echo '{}'; else cat; fi"#, - commit_hash, - new_message.replace('\'', "'\\''") - ), - "--".to_string(), - ]; - - if modify_all_branches { - args.push("--all".to_string()); - } else if let Some(branch) = branch_name { - args.push(branch.to_string()); - } else { - args.push("--all".to_string()); - } - - let child = Command::new("git") - .current_dir(repo_path) - .args(&args) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn()?; - - Ok(child) -} - -pub fn get_original_refs>(repo_path: P) -> Result> { - let output = Command::new("git") - .current_dir(repo_path) - .args(&["for-each-ref", "--format=%(refname)", "refs/original/"]) - .output()?; - - let output_str = String::from_utf8_lossy(&output.stdout); - let refs: Vec = output_str - .lines() - .filter(|line| !line.trim().is_empty()) - .map(|line| line.trim().to_string()) - .collect(); - - Ok(refs) -} - -pub fn restore_original_refs>(repo_path: P) -> Result { - let refs = get_original_refs(repo_path.as_ref())?; - let mut restored_count = 0; - - for original_ref in refs { - let target_ref = original_ref.replace("refs/original/", ""); - - let hash_output = Command::new("git") - .current_dir(repo_path.as_ref()) - .args(&["rev-parse", &original_ref]) - .output()?; - - let hash = String::from_utf8_lossy(&hash_output.stdout) - .trim() - .to_string(); - - let result = Command::new("git") - .current_dir(repo_path.as_ref()) - .args(&["update-ref", "-f", &target_ref, &hash]) - .output(); - - if result.is_ok() { - restored_count += 1; - } - } - - Ok(restored_count) -} - -pub fn get_git_log>(repo_path: P, lines: usize) -> Result { - let output = Command::new("git") - .current_dir(repo_path) - .args(&[ - "log", - "--oneline", - "--graph", - "--all", - &format!("-{}", lines), - ]) - .output()?; - - Ok(String::from_utf8_lossy(&output.stdout).to_string()) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_get_git_log() { - let current_dir = std::env::current_dir().unwrap(); - if let Ok(log) = get_git_log(current_dir, 5) { - assert!(!log.is_empty() || true); - } - } -} diff --git a/src/git/mod.rs b/src/git/mod.rs index 164794d..ce6b904 100644 --- a/src/git/mod.rs +++ b/src/git/mod.rs @@ -1,6 +1,8 @@ -pub mod commands; -pub mod operations; pub mod repository; +pub mod rewrite; -pub use operations::{get_current_branch, rollback_changes}; -pub use repository::{GitRepository, GitRepositoryImpl}; +pub use repository::{current_branch, is_valid_repo, load_commits, open, CommitPage}; +pub use rewrite::{ + confirm, normalize_message, pending_backups, rewrite_message, rollback, RefUpdate, + RewriteResult, RewriteScope, BACKUP_PREFIX, +}; diff --git a/src/git/operations.rs b/src/git/operations.rs deleted file mode 100644 index da0f287..0000000 --- a/src/git/operations.rs +++ /dev/null @@ -1,74 +0,0 @@ -use crate::git::commands::{ - get_git_log, get_original_refs, restore_original_refs, run_git_filter_branch, -}; -use crate::git::repository::{GitRepository, GitRepositoryImpl}; -use crate::models::PreviewData; -use anyhow::Result; -use git2::Repository; -use std::path::Path; - -pub fn rewrite_commit>( - repo_path: P, - commit_hash: &str, - new_message: &str, - modify_all_branches: bool, - branch_name: Option<&str>, -) -> Result { - let repo = Repository::open(repo_path.as_ref())?; - let target_oid = git2::Oid::from_str(commit_hash)?; - let target_commit = repo.find_commit(target_oid)?; - - let old_message = target_commit - .message() - .unwrap_or("(no message)") - .lines() - .next() - .unwrap_or("(no message)") - .to_string(); - - let mut child = run_git_filter_branch( - repo_path.as_ref(), - commit_hash, - new_message, - modify_all_branches, - branch_name, - )?; - - let status = child.wait()?; - - if !status.success() { - anyhow::bail!("git filter-branch failed with status: {}", status); - } - - let affected_commits = get_original_refs(repo_path.as_ref())?; - let diff_output = get_git_log(repo_path.as_ref(), 10)?; - - Ok(PreviewData::new( - commit_hash.to_string(), - old_message, - new_message.to_string(), - affected_commits, - diff_output, - )) -} - -pub fn rollback_changes>(repo_path: P) -> Result { - restore_original_refs(repo_path) -} - -pub fn get_current_branch>(repo_path: P) -> Option { - GitRepositoryImpl::open(repo_path) - .ok() - .and_then(|repo| repo.get_current_branch()) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_get_current_branch() { - let current_dir = std::env::current_dir().unwrap(); - let _ = get_current_branch(current_dir); - } -} diff --git a/src/git/repository.rs b/src/git/repository.rs index 37bdc9c..f470b44 100644 --- a/src/git/repository.rs +++ b/src/git/repository.rs @@ -1,88 +1,68 @@ use crate::models::CommitInfo; use anyhow::Result; -use chrono::{DateTime, Utc}; -use git2::Repository; +use chrono::DateTime; +use git2::{Repository, Sort}; use std::path::Path; -pub trait GitRepository { - fn load_commits(&self, limit: usize, offset: usize) -> Result>; - fn get_current_branch(&self) -> Option; +/// One page of commits reachable from HEAD. +#[derive(Clone, Debug)] +pub struct CommitPage { + pub commits: Vec, + pub has_more: bool, } -pub struct GitRepositoryImpl { - repo: Repository, +pub fn open>(path: P) -> Result { + Ok(Repository::open(path)?) } -impl GitRepositoryImpl { - pub fn open>(path: P) -> Result { - let repo = Repository::open(path)?; - Ok(Self { repo }) - } - - pub fn is_valid_repo>(path: P) -> bool { - Repository::open(path).is_ok() - } +pub fn is_valid_repo>(path: P) -> bool { + Repository::open(path).is_ok() } -impl GitRepository for GitRepositoryImpl { - fn load_commits(&self, limit: usize, offset: usize) -> Result> { - let mut revwalk = self.repo.revwalk()?; - revwalk.push_head()?; - - let mut commits = Vec::new(); - let end_index = offset + limit; - - for (i, oid) in revwalk.enumerate() { - if i >= end_index { - break; - } - if i < offset { - continue; - } - - let oid = oid?; - let commit = self.repo.find_commit(oid)?; - - let message = commit - .message() - .unwrap_or("(no message)") - .lines() - .next() - .unwrap_or("(no message)") - .to_string(); - - let time = commit.time(); - let datetime = DateTime::::from_timestamp(time.seconds(), 0).unwrap_or_default(); - let date_str = datetime.format("%Y-%m-%d %H:%M").to_string(); +/// Loads up to `limit` commits starting at `offset`, newest first. +pub fn load_commits(repo: &Repository, limit: usize, offset: usize) -> Result { + // an empty repository has no HEAD commit yet + if repo.head().is_err() { + return Ok(CommitPage { + commits: Vec::new(), + has_more: false, + }); + } - let author = commit.author().name().unwrap_or("Unknown").to_string(); + let mut revwalk = repo.revwalk()?; + revwalk.set_sorting(Sort::TOPOLOGICAL | Sort::TIME)?; + revwalk.push_head()?; - let hash_str = oid.to_string(); - let short_hash = hash_str.chars().take(8).collect::(); + let mut commits = Vec::new(); + let mut has_more = false; - commits.push(CommitInfo::new( - hash_str, short_hash, message, date_str, author, - )); + for oid in revwalk.skip(offset) { + if commits.len() == limit { + has_more = true; + break; } - Ok(commits) - } + let commit = repo.find_commit(oid?)?; + let hash = commit.id().to_string(); + let message = String::from_utf8_lossy(commit.message_bytes()).into_owned(); + let date = DateTime::from_timestamp(commit.time().seconds(), 0) + .unwrap_or_default() + .format("%Y-%m-%d %H:%M") + .to_string(); + let author = commit.author().name().unwrap_or("Unknown").to_string(); - fn get_current_branch(&self) -> Option { - match self.repo.head() { - Ok(head) => head.shorthand().map(|s| s.to_string()), - Err(_) => None, - } + commits.push(CommitInfo::new(hash, message, date, author)); } -} -#[cfg(test)] -mod tests { - use super::*; + Ok(CommitPage { commits, has_more }) +} - #[test] - fn test_is_valid_repo() { - let current_dir = std::env::current_dir().unwrap(); - let _ = GitRepositoryImpl::is_valid_repo(current_dir); +/// Name of the checked-out branch, or `None` for detached HEAD or an unborn branch. +pub fn current_branch(repo: &Repository) -> Option { + if repo.head_detached().unwrap_or(false) { + return None; } + repo.head() + .ok() + .and_then(|head| head.shorthand().ok().map(str::to_string)) } diff --git a/src/git/rewrite.rs b/src/git/rewrite.rs new file mode 100644 index 0000000..cc676d8 --- /dev/null +++ b/src/git/rewrite.rs @@ -0,0 +1,369 @@ +//! Rewriting a commit message directly through libgit2. +//! +//! The target commit gets the new message and every descendant reachable from +//! the selected refs is recreated with updated parents. Trees, authors and +//! committers (including timestamps) are preserved. Before any ref is moved its +//! original value is saved under [`BACKUP_PREFIX`], so the change can be +//! confirmed (backups deleted) or rolled back (refs restored from backups). + +use anyhow::{bail, Context, Result}; +use git2::{ObjectType, Oid, Repository, Signature, Sort}; +use std::collections::HashMap; + +/// Namespace for backups of refs moved by an unconfirmed rewrite. +pub const BACKUP_PREFIX: &str = "refs/commit-rewriter/backup/"; + +const HEAD: &str = "HEAD"; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum RewriteScope { + /// Only the checked-out branch (or detached HEAD). + CurrentBranch, + /// All local branches, tags and detached HEAD. + AllBranches, +} + +/// A ref moved by a rewrite, with the commits it pointed to before and after. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct RefUpdate { + pub name: String, + pub old_commit: Oid, + pub new_commit: Oid, +} + +#[derive(Clone, Debug)] +pub struct RewriteResult { + pub new_target: Oid, + pub rewritten_commits: usize, + pub ref_updates: Vec, +} + +#[derive(Clone, Copy, Debug)] +enum RefKind { + /// Branch or lightweight tag pointing straight at a commit. + Direct, + /// Annotated tag object pointing at a commit. + AnnotatedTag(Oid), + DetachedHead, +} + +#[derive(Clone, Debug)] +struct TrackedRef { + name: String, + commit: Oid, + kind: RefKind, +} + +impl TrackedRef { + /// Object the ref itself points to, which is what a backup must keep. + fn raw_target(&self) -> Oid { + match self.kind { + RefKind::AnnotatedTag(tag) => tag, + RefKind::Direct | RefKind::DetachedHead => self.commit, + } + } +} + +/// Normalizes a message the way `git commit` does: trims trailing whitespace, +/// collapses blank lines and ends it with a newline. +pub fn normalize_message(message: &str) -> Result { + Ok(git2::message_prettify(message, None)?) +} + +/// Replaces the message of `target` and rewrites its descendants. +/// +/// `progress` is called with `(processed, total)` commits. +pub fn rewrite_message( + repo: &Repository, + target: Oid, + new_message: &str, + scope: RewriteScope, + mut progress: impl FnMut(usize, usize), +) -> Result { + if !pending_backups(repo)?.is_empty() { + bail!("an unconfirmed rewrite already exists: confirm or roll it back first"); + } + + let message = normalize_message(new_message)?; + if message.trim().is_empty() { + bail!("commit message must not be empty"); + } + + let target_commit = repo + .find_commit(target) + .with_context(|| format!("commit {} not found", target))?; + if target_commit.message_bytes() == message.as_bytes() { + bail!("new message is the same as the current one"); + } + + let refs: Vec = collect_refs(repo, scope)? + .into_iter() + .filter(|r| { + r.commit == target || repo.graph_descendant_of(r.commit, target).unwrap_or(false) + }) + .collect(); + if refs.is_empty() { + bail!( + "commit {} is not reachable from the selected {}", + short(target), + match scope { + RewriteScope::CurrentBranch => "branch", + RewriteScope::AllBranches => "branches and tags", + } + ); + } + + let mut walk = repo.revwalk()?; + walk.set_sorting(Sort::TOPOLOGICAL | Sort::REVERSE)?; + for r in &refs { + walk.push(r.commit)?; + } + for parent in target_commit.parent_ids() { + walk.hide(parent)?; + } + let oids = walk.collect::, _>>()?; + let total = oids.len(); + + let mut mapping: HashMap = HashMap::new(); + for (i, oid) in oids.iter().enumerate() { + let commit = repo.find_commit(*oid)?; + let old_parents: Vec = commit.parent_ids().collect(); + let new_parents: Vec = old_parents + .iter() + .map(|p| *mapping.get(p).unwrap_or(p)) + .collect(); + + if *oid == target || new_parents != old_parents { + let parents = new_parents + .iter() + .map(|p| repo.find_commit(*p)) + .collect::, _>>()?; + let parent_refs: Vec<_> = parents.iter().collect(); + let commit_message = if *oid == target { + message.clone() + } else { + String::from_utf8_lossy(commit.message_raw_bytes()).into_owned() + }; + let new_oid = repo.commit( + None, + &commit.author(), + &commit.committer(), + &commit_message, + &commit.tree()?, + &parent_refs, + )?; + mapping.insert(*oid, new_oid); + } + + progress(i + 1, total); + } + + let new_target = *mapping + .get(&target) + .context("target commit was not rewritten")?; + + let changed: Vec<&TrackedRef> = refs + .iter() + .filter(|r| mapping.contains_key(&r.commit)) + .collect(); + + for r in &changed { + repo.reference( + &backup_name(&r.name), + r.raw_target(), + true, + "commit-rewriter: backup", + )?; + } + + let mut ref_updates = Vec::new(); + for r in &changed { + let new_commit = mapping[&r.commit]; + if let Err(e) = move_ref(repo, r, new_commit) { + let rollback = rollback(repo) + .map(|n| format!("{} refs restored", n)) + .unwrap_or_else(|err| format!("rollback failed: {:#}", err)); + bail!("failed to update {}: {:#} ({})", r.name, e, rollback); + } + ref_updates.push(RefUpdate { + name: r.name.clone(), + old_commit: r.commit, + new_commit, + }); + } + + Ok(RewriteResult { + new_target, + rewritten_commits: mapping.len(), + ref_updates, + }) +} + +/// Refs saved by an unconfirmed rewrite, with their backed-up and current commits. +pub fn pending_backups(repo: &Repository) -> Result> { + let mut result = Vec::new(); + for reference in repo.references_glob(&format!("{}*", BACKUP_PREFIX))? { + let reference = reference?; + let backup = reference.name()?.to_string(); + let name = backup[BACKUP_PREFIX.len()..].to_string(); + let old_commit = reference.peel_to_commit()?.id(); + let new_commit = if name == HEAD { + repo.head()?.peel_to_commit()?.id() + } else { + repo.find_reference(&name)?.peel_to_commit()?.id() + }; + result.push(RefUpdate { + name, + old_commit, + new_commit, + }); + } + Ok(result) +} + +/// Accepts the rewrite by deleting its backups. Returns the number of backups removed. +pub fn confirm(repo: &Repository) -> Result { + let mut removed = 0; + for reference in repo.references_glob(&format!("{}*", BACKUP_PREFIX))? { + reference?.delete()?; + removed += 1; + } + Ok(removed) +} + +/// Restores every ref saved by an unconfirmed rewrite. Returns the number of refs restored. +/// +/// Each backup is deleted only after its ref was restored, so a failed rollback +/// can be retried. +pub fn rollback(repo: &Repository) -> Result { + let mut restored = 0; + let mut errors = Vec::new(); + + let backups = repo + .references_glob(&format!("{}*", BACKUP_PREFIX))? + .collect::, _>>()?; + + for mut backup in backups { + let backup_ref = backup.name()?.to_string(); + let name = backup_ref[BACKUP_PREFIX.len()..].to_string(); + let result = backup + .target() + .context("backup is not a direct reference") + .and_then(|oid| { + if name == HEAD { + repo.set_head_detached(oid)?; + } else { + repo.reference(&name, oid, true, "commit-rewriter: rollback")?; + } + backup.delete()?; + Ok(()) + }); + + match result { + Ok(()) => restored += 1, + Err(e) => errors.push(format!("{}: {:#}", name, e)), + } + } + + if !errors.is_empty() { + bail!( + "restored {} refs, failed to restore {}: {}", + restored, + errors.len(), + errors.join("; ") + ); + } + Ok(restored) +} + +fn collect_refs(repo: &Repository, scope: RewriteScope) -> Result> { + let mut refs = Vec::new(); + + if repo.head_detached()? { + let commit = repo.head()?.peel_to_commit()?.id(); + refs.push(TrackedRef { + name: HEAD.to_string(), + commit, + kind: RefKind::DetachedHead, + }); + } else if scope == RewriteScope::CurrentBranch { + let head = repo.head().context("HEAD does not point to a commit")?; + refs.push(TrackedRef { + name: head.name()?.to_string(), + commit: head.peel_to_commit()?.id(), + kind: RefKind::Direct, + }); + } + + if scope == RewriteScope::AllBranches { + for glob in ["refs/heads/*", "refs/tags/*"] { + for reference in repo.references_glob(glob)? { + let reference = reference?; + let Some(target) = reference.target() else { + continue; + }; + let name = reference.name()?.to_string(); + let object = repo.find_object(target, None)?; + match object.kind() { + Some(ObjectType::Commit) => refs.push(TrackedRef { + name, + commit: target, + kind: RefKind::Direct, + }), + Some(ObjectType::Tag) => { + let tag = object.peel_to_tag()?; + // Tags of tags and tags of non-commits are left as is. + if tag.target_type() == Some(ObjectType::Commit) { + refs.push(TrackedRef { + name, + commit: tag.target_id(), + kind: RefKind::AnnotatedTag(target), + }); + } + } + _ => {} + } + } + } + } + + Ok(refs) +} + +fn move_ref(repo: &Repository, r: &TrackedRef, new_commit: Oid) -> Result<()> { + let log_message = format!("commit-rewriter: reword {}", short(r.commit)); + match r.kind { + RefKind::Direct => { + repo.reference(&r.name, new_commit, true, &log_message)?; + } + RefKind::DetachedHead => { + repo.set_head_detached(new_commit)?; + } + RefKind::AnnotatedTag(tag_oid) => { + let tag = repo.find_tag(tag_oid)?; + let tagger = match tag.tagger() { + Some(tagger) => tagger.to_owned(), + None => repo + .signature() + .or_else(|_| Signature::now("unknown", "unknown"))?, + }; + let target = repo.find_object(new_commit, Some(ObjectType::Commit))?; + let new_tag = repo.tag_annotation_create( + tag.name()?, + &target, + &tagger, + &String::from_utf8_lossy(tag.message_bytes().unwrap_or_default()), + )?; + repo.reference(&r.name, new_tag, true, &log_message)?; + } + } + Ok(()) +} + +fn backup_name(ref_name: &str) -> String { + format!("{}{}", BACKUP_PREFIX, ref_name) +} + +fn short(oid: Oid) -> String { + oid.to_string()[..8].to_string() +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..647e086 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,5 @@ +pub mod app; +pub mod background; +pub mod git; +pub mod models; +pub mod ui; diff --git a/src/main.rs b/src/main.rs index 0aaeb1d..f1337e8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,6 @@ #![cfg_attr(windows, windows_subsystem = "windows")] -mod app; -mod background; -mod git; -mod models; -mod ui; - -use app::CommitRewriterApp; +use commit_rewriter::app::CommitRewriterApp; use eframe::egui; fn main() -> Result<(), eframe::Error> { diff --git a/src/models/commit.rs b/src/models/commit.rs index edd32b0..94120d7 100644 --- a/src/models/commit.rs +++ b/src/models/commit.rs @@ -2,22 +2,22 @@ pub struct CommitInfo { pub hash: String, pub short_hash: String, + /// First line of the message. + pub summary: String, + /// Full message including body and trailers. pub message: String, pub date: String, pub author: String, } impl CommitInfo { - pub fn new( - hash: String, - short_hash: String, - message: String, - date: String, - author: String, - ) -> Self { + pub fn new(hash: String, message: String, date: String, author: String) -> Self { + let short_hash = hash.chars().take(8).collect(); + let summary = message.lines().next().unwrap_or("").to_string(); Self { hash, short_hash, + summary, message, date, author, @@ -33,15 +33,15 @@ mod tests { fn test_commit_info_creation() { let commit = CommitInfo::new( "abc123def456".to_string(), - "abc123de".to_string(), - "Initial commit".to_string(), + "Initial commit\n\nLonger description\n".to_string(), "2024-01-01 12:00".to_string(), "John Doe".to_string(), ); assert_eq!(commit.hash, "abc123def456"); assert_eq!(commit.short_hash, "abc123de"); - assert_eq!(commit.message, "Initial commit"); + assert_eq!(commit.summary, "Initial commit"); + assert_eq!(commit.message, "Initial commit\n\nLonger description\n"); assert_eq!(commit.date, "2024-01-01 12:00"); assert_eq!(commit.author, "John Doe"); } diff --git a/src/models/log.rs b/src/models/log.rs index 7d2bbaa..21e79e0 100644 --- a/src/models/log.rs +++ b/src/models/log.rs @@ -4,7 +4,6 @@ pub enum LogLevel { Success, Warning, Error, - Debug, } impl LogLevel { @@ -14,7 +13,6 @@ impl LogLevel { LogLevel::Success => "βœ…", LogLevel::Warning => "⚠️", LogLevel::Error => "❌", - LogLevel::Debug => "πŸ”", } } @@ -24,7 +22,6 @@ impl LogLevel { LogLevel::Success => (80, 200, 120), LogLevel::Warning => (255, 180, 50), LogLevel::Error => (255, 100, 100), - LogLevel::Debug => (120, 120, 140), } } } @@ -89,7 +86,6 @@ mod tests { assert_eq!(LogLevel::Success.icon(), "βœ…"); assert_eq!(LogLevel::Warning.icon(), "⚠️"); assert_eq!(LogLevel::Error.icon(), "❌"); - assert_eq!(LogLevel::Debug.icon(), "πŸ”"); } #[test] @@ -99,7 +95,10 @@ mod tests { assert!(filter.should_show(&LogLevel::Success)); assert!(filter.should_show(&LogLevel::Warning)); assert!(filter.should_show(&LogLevel::Error)); - assert!(!filter.should_show(&LogLevel::Debug)); + + let filter = LogFilter::ErrorsOnly; + assert!(!filter.should_show(&LogLevel::Warning)); + assert!(filter.should_show(&LogLevel::Error)); } #[test] diff --git a/src/models/mod.rs b/src/models/mod.rs index 4f65305..0356077 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -4,4 +4,4 @@ pub mod preview; pub use commit::CommitInfo; pub use log::{LogEntry, LogFilter, LogLevel}; -pub use preview::PreviewData; +pub use preview::{PreviewData, RefChange, RewriteDetails}; diff --git a/src/models/preview.rs b/src/models/preview.rs index 9921371..d3caf58 100644 --- a/src/models/preview.rs +++ b/src/models/preview.rs @@ -1,48 +1,25 @@ -#[derive(Clone, Debug)] -pub struct PreviewData { - pub commit_hash: String, - pub old_message: String, - pub new_message: String, - pub affected_commits: Vec, - pub diff_output: String, +/// A ref moved by a rewrite, for display. +#[derive(Clone, Debug, PartialEq)] +pub struct RefChange { + pub name: String, + pub old_hash: String, + pub new_hash: String, } -impl PreviewData { - pub fn new( - commit_hash: String, - old_message: String, - new_message: String, - affected_commits: Vec, - diff_output: String, - ) -> Self { - Self { - commit_hash, - old_message, - new_message, - affected_commits, - diff_output, - } - } +/// What the user reviews before confirming or rolling back a rewrite. +#[derive(Clone, Debug)] +pub struct PreviewData { + /// Details of the rewrite just performed. `None` when an unconfirmed + /// rewrite was found on opening the repository. + pub details: Option, + pub ref_changes: Vec, } -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_preview_data_creation() { - let preview = PreviewData::new( - "abc123".to_string(), - "Old message".to_string(), - "New message".to_string(), - vec!["refs/heads/main".to_string()], - "* abc123 New message".to_string(), - ); - - assert_eq!(preview.commit_hash, "abc123"); - assert_eq!(preview.old_message, "Old message"); - assert_eq!(preview.new_message, "New message"); - assert_eq!(preview.affected_commits.len(), 1); - assert_eq!(preview.diff_output, "* abc123 New message"); - } +#[derive(Clone, Debug)] +pub struct RewriteDetails { + pub old_hash: String, + pub new_hash: String, + pub old_message: String, + pub new_message: String, + pub rewritten_commits: usize, } diff --git a/src/ui/commits_list.rs b/src/ui/commits_list.rs index 2fbfe9d..ce147ba 100644 --- a/src/ui/commits_list.rs +++ b/src/ui/commits_list.rs @@ -2,9 +2,8 @@ use crate::models::CommitInfo; use eframe::egui; pub struct CommitsListResult { - pub selected_commit: Option<(usize, String, String)>, // (index, short_hash, message) + pub selected_index: Option, pub load_more_clicked: bool, - pub search_changed: bool, } pub fn render_commits_list( @@ -17,9 +16,8 @@ pub fn render_commits_list( has_more_commits: bool, ) -> CommitsListResult { let mut result = CommitsListResult { - selected_commit: None, + selected_index: None, load_more_clicked: false, - search_changed: false, }; ui.horizontal(|ui| { @@ -50,21 +48,16 @@ pub fn render_commits_list( if !commits.is_empty() { ui.horizontal(|ui| { - let search_response = ui.add( + ui.add( egui::TextEdit::singleline(search_query) .hint_text("πŸ” Search by hash, message, author...") .desired_width(f32::INFINITY), ); - if search_response.changed() { - result.search_changed = true; - } - - if !search_query.is_empty() { - if ui.small_button("βœ–").on_hover_text("Clear search").clicked() { - search_query.clear(); - result.search_changed = true; - } + if !search_query.is_empty() + && ui.small_button("βœ–").on_hover_text("Clear search").clicked() + { + search_query.clear(); } }); ui.add_space(2.0); @@ -115,31 +108,20 @@ pub fn render_commits_list( let full_text = format!( "{} β”‚ {} β”‚ {}", - commit.short_hash, commit.date, commit.message + commit.short_hash, commit.date, commit.summary ); - // Create selectable with highlighted matches - let response = if !search_query.trim().is_empty() { - render_selectable_with_highlight( - ui, - is_selected, - &full_text, - search_query, - ) - } else { - ui.selectable_label( - is_selected, - egui::RichText::new(&full_text).monospace().size(11.0), - ) - }; + let response = ui.selectable_label( + is_selected, + highlighted_text(ui, &full_text, search_query.trim()), + ); if response.clicked() && !is_processing { - result.selected_commit = - Some((i, commit.short_hash.clone(), commit.message.clone())); + result.selected_index = Some(i); } response.on_hover_text(format!( - "Hash: {}\nAuthor: {}\nDate: {}\nMessage: {}", + "Hash: {}\nAuthor: {}\nDate: {}\n\n{}", commit.hash, commit.author, commit.date, commit.message )); } @@ -183,138 +165,108 @@ pub fn render_commits_list( } fn filter_commits<'a>(commits: &'a [CommitInfo], query: &str) -> Vec<(usize, &'a CommitInfo)> { - if query.trim().is_empty() { - commits.iter().enumerate().collect() - } else { - let query_lower = query.to_lowercase(); - commits - .iter() - .enumerate() - .filter(|(_, commit)| { - commit.message.to_lowercase().contains(&query_lower) - || commit.hash.to_lowercase().contains(&query_lower) - || commit.author.to_lowercase().contains(&query_lower) - }) - .collect() - } + let query = query.trim(); + commits + .iter() + .enumerate() + .filter(|(_, commit)| { + query.is_empty() + || !find_matches(&commit.message, query).is_empty() + || !find_matches(&commit.hash, query).is_empty() + || !find_matches(&commit.author, query).is_empty() + }) + .collect() } -fn render_selectable_with_highlight( - ui: &mut egui::Ui, - is_selected: bool, - text: &str, - query: &str, -) -> egui::Response { - let query_lower = query.to_lowercase(); - let text_lower = text.to_lowercase(); +/// Byte ranges of case-insensitive, non-overlapping matches of `query` in `text`. +/// +/// Works on chars, so ranges always fall on char boundaries of `text` even when +/// lowercasing changes the byte length of a character. +fn find_matches(text: &str, query: &str) -> Vec<(usize, usize)> { + let query: Vec = query.chars().flat_map(char::to_lowercase).collect(); + if query.is_empty() { + return Vec::new(); + } - // Find all match positions + let chars: Vec<(usize, char)> = text.char_indices().collect(); let mut matches = Vec::new(); - let mut search_start = 0; - - while let Some(pos) = text_lower[search_start..].find(&query_lower) { - let actual_pos = search_start + pos; - matches.push((actual_pos, actual_pos + query.len())); - search_start = actual_pos + 1; - } + let mut i = 0; + + while i < chars.len() { + let mut matched = 0; + let mut j = i; + while j < chars.len() && matched < query.len() { + let lower: Vec = chars[j].1.to_lowercase().collect(); + if query[matched..].starts_with(&lower) { + matched += lower.len(); + j += 1; + } else { + break; + } + } - if matches.is_empty() { - return ui.selectable_label( - is_selected, - egui::RichText::new(text).monospace().size(11.0), - ); + if matched == query.len() { + let end = chars.get(j).map_or(text.len(), |(pos, _)| *pos); + matches.push((chars[i].0, end)); + i = j; + } else { + i += 1; + } } - // Create a custom selectable widget with highlighted text - let button_padding = ui.style().spacing.button_padding; - let text_height = ui.text_style_height(&egui::TextStyle::Monospace); - - let (rect, response) = ui.allocate_exact_size( - egui::vec2(ui.available_width(), text_height + button_padding.y * 2.0), - egui::Sense::click(), - ); - - if is_selected { - let selection_color = ui.style().visuals.selection.bg_fill; - ui.painter().rect_filled(rect, 0.0, selection_color); - } + matches +} - if response.hovered() { - let hover_color = ui.style().visuals.widgets.hovered.bg_fill; - ui.painter().rect_filled(rect, 0.0, hover_color); - } +fn highlighted_text(ui: &egui::Ui, text: &str, query: &str) -> egui::text::LayoutJob { + let font_id = egui::FontId::monospace(11.0); + let normal = egui::TextFormat { + font_id: font_id.clone(), + color: ui.visuals().text_color(), + ..Default::default() + }; + let highlight = egui::TextFormat { + font_id, + color: egui::Color32::BLACK, + background: egui::Color32::from_rgb(255, 255, 0), + ..Default::default() + }; - // Render text with highlights + let mut job = egui::text::LayoutJob::default(); let mut last_end = 0; - let text_pos = rect.min + button_padding; - let mut current_x = text_pos.x; - - for (start, end) in matches { - // Render text before match - if start > last_end { - let segment = &text[last_end..start]; - let text_color = ui.style().visuals.text_color(); - ui.painter().text( - egui::pos2(current_x, text_pos.y), - egui::Align2::LEFT_TOP, - segment, - egui::FontId::monospace(11.0), - text_color, - ); - current_x += ui.fonts(|f| { - f.layout_no_wrap( - segment.to_string(), - egui::FontId::monospace(11.0), - text_color, - ) - .size() - .x - }); - } - - // Render highlighted match - let segment = &text[start..end]; - let highlight_rect = egui::Rect::from_min_size( - egui::pos2(current_x, text_pos.y), - egui::vec2( - ui.fonts(|f| { - f.layout_no_wrap( - segment.to_string(), - egui::FontId::monospace(11.0), - egui::Color32::BLACK, - ) - .size() - .x - }), - ui.text_style_height(&egui::TextStyle::Monospace), - ), - ); - ui.painter() - .rect_filled(highlight_rect, 0.0, egui::Color32::from_rgb(255, 255, 0)); - ui.painter().text( - egui::pos2(current_x, text_pos.y), - egui::Align2::LEFT_TOP, - segment, - egui::FontId::monospace(11.0), - egui::Color32::BLACK, - ); - current_x += highlight_rect.width(); - + for (start, end) in find_matches(text, query) { + job.append(&text[last_end..start], 0.0, normal.clone()); + job.append(&text[start..end], 0.0, highlight.clone()); last_end = end; } + job.append(&text[last_end..], 0.0, normal); + job +} + +#[cfg(test)] +mod tests { + use super::*; - // Render remaining text - if last_end < text.len() { - let segment = &text[last_end..]; - let text_color = ui.style().visuals.text_color(); - ui.painter().text( - egui::pos2(current_x, text_pos.y), - egui::Align2::LEFT_TOP, - segment, - egui::FontId::monospace(11.0), - text_color, + #[test] + fn test_find_matches_case_insensitive() { + assert_eq!( + find_matches("Fix Bug in fix", "fix"), + vec![(0, 3), (11, 14)] ); + assert!(find_matches("abc", "x").is_empty()); + assert!(find_matches("abc", "").is_empty()); } - response + #[test] + fn test_find_matches_unicode_boundaries() { + // 'Δ°' lowercases to two chars, which used to shift byte offsets + let text = "Δ°stanbul fix"; + let matches = find_matches(text, "fix"); + assert_eq!(matches.len(), 1); + let (start, end) = matches[0]; + assert_eq!(&text[start..end], "fix"); + + let text = "Π˜ΡΠΏΡ€Π°Π²ΠΈΡ‚ΡŒ ΠΎΡˆΠΈΠ±ΠΊΡƒ"; + let (start, end) = find_matches(text, "ΠžΠ¨Π˜Π‘")[0]; + assert_eq!(&text[start..end], "ошиб"); + } } diff --git a/src/ui/editor_panel.rs b/src/ui/editor_panel.rs index 17da201..d6351ee 100644 --- a/src/ui/editor_panel.rs +++ b/src/ui/editor_panel.rs @@ -7,7 +7,7 @@ pub struct EditorPanelResult { pub fn render_editor_panel( ui: &mut egui::Ui, new_message: &mut String, - selected_index: Option, + has_selection: bool, is_processing: bool, ) -> EditorPanelResult { let mut result = EditorPanelResult { @@ -23,7 +23,7 @@ pub fn render_editor_panel( ); if !new_message.trim().is_empty() { - let len = new_message.lines().next().unwrap_or("").len(); + let len = new_message.lines().next().unwrap_or("").chars().count(); let color = if len > 72 { egui::Color32::from_rgb(255, 180, 50) } else { @@ -64,7 +64,7 @@ pub fn render_editor_panel( if ui .add_enabled( - !is_processing && selected_index.is_some() && !new_message.trim().is_empty(), + !is_processing && has_selection && !new_message.trim().is_empty(), apply_btn, ) .clicked() @@ -72,7 +72,7 @@ pub fn render_editor_panel( result.apply_clicked = true; } - if selected_index.is_none() { + if !has_selection { ui.label( egui::RichText::new("← Select a commit from the list") .size(11.0) diff --git a/src/ui/logs_panel.rs b/src/ui/logs_panel.rs index cfb73c4..8531b4a 100644 --- a/src/ui/logs_panel.rs +++ b/src/ui/logs_panel.rs @@ -7,16 +7,22 @@ pub fn render_logs_panel( log_filter: &mut LogFilter, show_progress: bool, progress: f32, - is_processing: bool, -) { +) -> bool { + let mut clear_clicked = false; + ui.vertical(|ui| { ui.horizontal(|ui| { ui.heading(egui::RichText::new("πŸ“ Logs").size(18.0).strong()); ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - if ui.button("πŸ—‘οΈ Clear").clicked() && !is_processing {} + if ui + .add_enabled(!logs.is_empty(), egui::Button::new("πŸ—‘οΈ Clear")) + .clicked() + { + clear_clicked = true; + } - egui::ComboBox::from_id_source("log_filter") + egui::ComboBox::from_id_salt("log_filter") .selected_text(log_filter.name()) .show_ui(ui, |ui| { ui.selectable_value(log_filter, LogFilter::All, LogFilter::All.name()); @@ -65,7 +71,7 @@ pub fn render_logs_panel( let remaining_height = ui.available_height(); egui::ScrollArea::vertical() - .stick_to_bottom(false) + .stick_to_bottom(true) .auto_shrink([false, true]) .max_height(remaining_height.min(800.0)) .show(ui, |ui| { @@ -95,6 +101,8 @@ pub fn render_logs_panel( } }); }); + + clear_clicked } fn render_log_entry(ui: &mut egui::Ui, entry: &LogEntry) { diff --git a/src/ui/main_window.rs b/src/ui/main_window.rs index 4b25a00..0061e60 100644 --- a/src/ui/main_window.rs +++ b/src/ui/main_window.rs @@ -1,4 +1,3 @@ -use crate::models::CommitInfo; use eframe::egui; pub struct MainWindowResult { @@ -9,11 +8,11 @@ pub struct MainWindowResult { pub fn render_main_window( ui: &mut egui::Ui, repo_path: Option<&std::path::PathBuf>, - commits: &[CommitInfo], + commits_count: usize, is_processing: bool, show_help: &mut bool, modify_all_branches: &mut bool, - current_branch: Option<&String>, + current_branch: Option<&str>, ) -> MainWindowResult { let mut result = MainWindowResult { pick_folder_clicked: false, @@ -55,9 +54,9 @@ pub fn render_main_window( if *show_help { ui.add_space(3.0); - egui::Frame::none() + egui::Frame::NONE .fill(egui::Color32::from_rgb(50, 60, 80)) - .rounding(5.0) + .corner_radius(5.0) .inner_margin(10.0) .show(ui, |ui| { ui.label( @@ -77,9 +76,13 @@ pub fn render_main_window( .strong() .color(egui::Color32::from_rgb(255, 180, 50)), ); - ui.label("β€’ History rewriting requires force push in terminal"); - ui.label("β€’ Don't use on shared branches"); - ui.label("β€’ Make a backup first"); + ui.label( + "β€’ Rewriting changes the hashes of the commit and all its descendants", + ); + ui.label( + "β€’ Push with git push --force-with-lease, don't rewrite shared branches", + ); + ui.label("β€’ Original refs are kept until you confirm, Cancel restores them"); ui.add_space(5.0); ui.separator(); @@ -128,28 +131,25 @@ pub fn render_main_window( ui.horizontal(|ui| { ui.label("🌐 Modification mode:"); - let modify_all = *modify_all_branches; - ui.checkbox( - modify_all_branches, - egui::RichText::new(if modify_all { - "All branches (--all)" - } else { - "Current branch only" - }) - .size(12.0), + ui.add_enabled( + !is_processing, + egui::Checkbox::new( + modify_all_branches, + egui::RichText::new("All branches and tags").size(12.0), + ), ); if !*modify_all_branches { if let Some(branch) = current_branch { ui.label( - egui::RichText::new(format!("({})", branch)) + egui::RichText::new(format!("only {}", branch)) .monospace() .size(11.0) .color(egui::Color32::from_rgb(100, 200, 255)), ); } else { ui.label( - egui::RichText::new("(not detected)") + egui::RichText::new("only detached HEAD") .size(11.0) .color(egui::Color32::from_rgb(255, 150, 50)), ); @@ -163,7 +163,7 @@ pub fn render_main_window( .color(egui::Color32::from_rgb(255, 180, 50)), ); ui.label( - egui::RichText::new("Modifies all branches") + egui::RichText::new("Rewrites every branch and tag containing the commit") .size(10.0) .color(egui::Color32::from_rgb(255, 180, 50)) .italics(), @@ -184,10 +184,10 @@ pub fn render_main_window( .color(egui::Color32::GRAY), ); - if !commits.is_empty() { + if commits_count > 0 { ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { ui.label( - egui::RichText::new(format!("πŸ“Š {} commits", commits.len())) + egui::RichText::new(format!("πŸ“Š {} commits", commits_count)) .size(11.0) .color(egui::Color32::from_rgb(100, 200, 100)), ); diff --git a/src/ui/preview_modal.rs b/src/ui/preview_modal.rs index 4ab7a97..8fcbe7e 100644 --- a/src/ui/preview_modal.rs +++ b/src/ui/preview_modal.rs @@ -1,4 +1,4 @@ -use crate::models::PreviewData; +use crate::models::{PreviewData, RefChange}; use eframe::egui; pub struct PreviewModalResult { @@ -22,112 +22,98 @@ pub fn render_preview_modal( .default_size([800.0, 600.0]) .show(ctx, |ui| { ui.vertical(|ui| { - ui.heading( - egui::RichText::new("Review changes before confirming") - .size(16.0) - .strong(), - ); - - ui.add_space(10.0); - ui.separator(); - ui.add_space(5.0); + match &preview_data.details { + Some(details) => { + ui.heading( + egui::RichText::new("Review changes before confirming") + .size(16.0) + .strong(), + ); - ui.horizontal(|ui| { - ui.label("πŸ“Œ Commit hash:"); - ui.label( - egui::RichText::new(&preview_data.commit_hash[..8]) - .monospace() - .size(12.0), - ); - }); + ui.add_space(10.0); + ui.separator(); + ui.add_space(5.0); + + ui.horizontal(|ui| { + ui.label("πŸ“Œ Commit:"); + ui.label( + egui::RichText::new(format!( + "{} β†’ {}", + short(&details.old_hash), + short(&details.new_hash) + )) + .monospace() + .size(12.0), + ); + ui.label( + egui::RichText::new(format!( + "({} commits rewritten)", + details.rewritten_commits + )) + .size(11.0) + .color(egui::Color32::GRAY), + ); + }); - ui.add_space(5.0); + ui.add_space(5.0); - ui.label( - egui::RichText::new("❌ Old message:") - .size(13.0) - .strong() - .color(egui::Color32::from_rgb(255, 100, 100)), - ); - egui::Frame::none() - .fill(egui::Color32::from_rgb(40, 30, 30)) - .rounding(3.0) - .inner_margin(8.0) - .show(ui, |ui| { - ui.label( - egui::RichText::new(&preview_data.old_message) - .monospace() - .size(11.0), + message_block( + ui, + "❌ Old message:", + egui::Color32::from_rgb(255, 100, 100), + egui::Color32::from_rgb(40, 30, 30), + &details.old_message, ); - }); - ui.add_space(5.0); + ui.add_space(5.0); - ui.label( - egui::RichText::new("βœ… New message:") - .size(13.0) - .strong() - .color(egui::Color32::from_rgb(100, 200, 100)), - ); - egui::Frame::none() - .fill(egui::Color32::from_rgb(30, 40, 30)) - .rounding(3.0) - .inner_margin(8.0) - .show(ui, |ui| { + message_block( + ui, + "βœ… New message:", + egui::Color32::from_rgb(100, 200, 100), + egui::Color32::from_rgb(30, 40, 30), + &details.new_message, + ); + } + None => { + ui.heading( + egui::RichText::new("Unconfirmed rewrite found") + .size(16.0) + .strong(), + ); + ui.add_space(5.0); ui.label( - egui::RichText::new(&preview_data.new_message) - .monospace() - .size(11.0), + "A previous rewrite in this repository was neither confirmed nor \ + rolled back. Confirm to keep it or cancel to restore the original refs.", ); - }); + } + } ui.add_space(10.0); ui.separator(); ui.add_space(5.0); - if !preview_data.affected_commits.is_empty() { - ui.label(egui::RichText::new("πŸ“‹ Affected refs:").size(13.0).strong()); - ui.add_space(3.0); - - egui::ScrollArea::vertical() - .max_height(100.0) - .show(ui, |ui| { - for ref_name in &preview_data.affected_commits { - ui.label( - egui::RichText::new(ref_name) - .monospace() - .size(10.0) - .color(egui::Color32::GRAY), - ); - } - }); - - ui.add_space(5.0); - } - - ui.label( - egui::RichText::new("πŸ“Š Commit history (last 10):") - .size(13.0) - .strong(), - ); + ui.label(egui::RichText::new("πŸ“‹ Updated refs:").size(13.0).strong()); ui.add_space(3.0); egui::ScrollArea::vertical() .max_height(150.0) .show(ui, |ui| { - egui::Frame::none() - .fill(egui::Color32::from_rgb(20, 20, 20)) - .rounding(3.0) - .inner_margin(8.0) - .show(ui, |ui| { - ui.label( - egui::RichText::new(&preview_data.diff_output) - .monospace() - .size(10.0), - ); - }); + for change in &preview_data.ref_changes { + ref_change_row(ui, change); + } }); + ui.add_space(5.0); + ui.label( + egui::RichText::new( + "Cancel restores the refs above. After confirming, push with \ + git push --force-with-lease.", + ) + .size(11.0) + .color(egui::Color32::GRAY), + ); + ui.add_space(10.0); ui.separator(); ui.add_space(5.0); @@ -158,3 +144,52 @@ pub fn render_preview_modal( result } + +fn message_block( + ui: &mut egui::Ui, + title: &str, + title_color: egui::Color32, + fill: egui::Color32, + message: &str, +) { + ui.label( + egui::RichText::new(title) + .size(13.0) + .strong() + .color(title_color), + ); + egui::Frame::NONE + .fill(fill) + .corner_radius(3.0) + .inner_margin(8.0) + .show(ui, |ui| { + egui::ScrollArea::vertical() + .id_salt(title) + .max_height(120.0) + .show(ui, |ui| { + ui.label( + egui::RichText::new(message.trim_end()) + .monospace() + .size(11.0), + ); + }); + }); +} + +fn ref_change_row(ui: &mut egui::Ui, change: &RefChange) { + ui.label( + egui::RichText::new(format!( + "{} {} β†’ {}", + change.name, + short(&change.old_hash), + short(&change.new_hash) + )) + .monospace() + .size(10.0) + .color(egui::Color32::GRAY), + ); +} + +fn short(hash: &str) -> &str { + hash.get(..8).unwrap_or(hash) +} diff --git a/tests/integration_test.rs b/tests/integration_test.rs deleted file mode 100644 index 74fb51a..0000000 --- a/tests/integration_test.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[test] -fn test_placeholder() { - assert!(true); -} diff --git a/tests/rewrite.rs b/tests/rewrite.rs new file mode 100644 index 0000000..36c7447 --- /dev/null +++ b/tests/rewrite.rs @@ -0,0 +1,437 @@ +use commit_rewriter::git::{self, RewriteScope, BACKUP_PREFIX}; +use git2::{Oid, Repository, Signature, Time}; +use tempfile::TempDir; + +struct TestRepo { + _dir: TempDir, + repo: Repository, + counter: i64, +} + +impl TestRepo { + fn new() -> Self { + let dir = TempDir::new().unwrap(); + let repo = Repository::init(dir.path()).unwrap(); + repo.set_head("refs/heads/main").unwrap(); + Self { + _dir: dir, + repo, + counter: 0, + } + } + + fn signature(&self, name: &str) -> Signature<'static> { + Signature::new( + name, + &format!("{}@example.com", name.to_lowercase()), + &Time::new(1_700_000_000 + self.counter * 60, 0), + ) + .unwrap() + } + + /// Creates a commit with a new file on top of `parents` and moves `ref_name` to it. + fn commit(&mut self, ref_name: Option<&str>, message: &str, parents: &[Oid]) -> Oid { + self.counter += 1; + let blob = self + .repo + .blob(format!("content {}", self.counter).as_bytes()) + .unwrap(); + + let mut builder = match parents.first() { + Some(p) => { + let tree = self.repo.find_commit(*p).unwrap().tree().unwrap(); + self.repo.treebuilder(Some(&tree)).unwrap() + } + None => self.repo.treebuilder(None).unwrap(), + }; + builder + .insert(format!("file{}.txt", self.counter), blob, 0o100644) + .unwrap(); + let tree = self.repo.find_tree(builder.write().unwrap()).unwrap(); + + let parents: Vec<_> = parents + .iter() + .map(|p| self.repo.find_commit(*p).unwrap()) + .collect(); + let parent_refs: Vec<_> = parents.iter().collect(); + let author = self.signature("Author"); + let committer = self.signature("Committer"); + self.repo + .commit(ref_name, &author, &committer, message, &tree, &parent_refs) + .unwrap() + } + + fn ref_commit(&self, name: &str) -> Oid { + self.repo + .find_reference(name) + .unwrap() + .peel_to_commit() + .unwrap() + .id() + } + + fn message(&self, oid: Oid) -> String { + self.repo + .find_commit(oid) + .unwrap() + .message() + .unwrap() + .to_string() + } + + fn parent(&self, oid: Oid) -> Oid { + self.repo.find_commit(oid).unwrap().parent_id(0).unwrap() + } + + fn backups(&self) -> usize { + self.repo + .references_glob(&format!("{}*", BACKUP_PREFIX)) + .unwrap() + .count() + } +} + +/// main: a -> b -> c, where b has a body and trailers. +fn linear_repo() -> (TestRepo, [Oid; 3]) { + let mut t = TestRepo::new(); + let a = t.commit(Some("HEAD"), "First\n", &[]); + let b = t.commit( + Some("HEAD"), + "Second\n\nDetailed body.\n\nSigned-off-by: Author \n", + &[a], + ); + let c = t.commit(Some("HEAD"), "Third\n", &[b]); + (t, [a, b, c]) +} + +fn rewrite(t: &TestRepo, target: Oid, message: &str, scope: RewriteScope) -> git::RewriteResult { + git::rewrite_message(&t.repo, target, message, scope, |_, _| {}).unwrap() +} + +#[test] +fn rewrites_message_and_keeps_body_trees_and_signatures() { + let (t, [a, b, c]) = linear_repo(); + let old = t.repo.find_commit(b).unwrap(); + let new_message = old + .message() + .unwrap() + .replacen("Second", "Second, reworded", 1); + + let result = rewrite(&t, b, &new_message, RewriteScope::CurrentBranch); + + let new_c = t.ref_commit("refs/heads/main"); + let new_b = t.parent(new_c); + assert_ne!(new_c, c); + assert_eq!(new_b, result.new_target); + assert_eq!( + t.parent(new_b), + a, + "commits before the target are untouched" + ); + assert_eq!(result.rewritten_commits, 2); + + assert_eq!( + t.message(new_b), + "Second, reworded\n\nDetailed body.\n\nSigned-off-by: Author \n" + ); + assert_eq!(t.message(new_c), "Third\n"); + + for (old_oid, new_oid) in [(b, new_b), (c, new_c)] { + let old = t.repo.find_commit(old_oid).unwrap(); + let new = t.repo.find_commit(new_oid).unwrap(); + assert_eq!(old.tree_id(), new.tree_id()); + assert_eq!(old.author().to_string(), new.author().to_string()); + assert_eq!(old.author().when(), new.author().when()); + assert_eq!(old.committer().when(), new.committer().when()); + } +} + +#[test] +fn messages_are_passed_verbatim() { + let (t, [_, b, _]) = linear_repo(); + let message = "Quote ' \"double\" $HOME `cmd` back\\slash \\n \\c"; + + let result = rewrite(&t, b, message, RewriteScope::CurrentBranch); + + assert_eq!(t.message(result.new_target), format!("{}\n", message)); +} + +#[test] +fn current_branch_scope_leaves_other_refs() { + let (mut t, [_, b, c]) = linear_repo(); + let feature = t.commit(Some("refs/heads/feature"), "Feature\n", &[c]); + t.repo + .tag_lightweight("v1", &t.repo.find_object(c, None).unwrap(), false) + .unwrap(); + + let result = rewrite(&t, b, "Reworded\n", RewriteScope::CurrentBranch); + + assert_eq!(result.ref_updates.len(), 1); + assert_eq!(result.ref_updates[0].name, "refs/heads/main"); + assert_eq!(t.ref_commit("refs/heads/feature"), feature); + assert_eq!(t.ref_commit("refs/tags/v1"), c); +} + +#[test] +fn all_branches_scope_updates_branches_and_tags() { + let (mut t, [a, b, c]) = linear_repo(); + let feature = t.commit(Some("refs/heads/feature"), "Feature\n", &[c]); + let unrelated = t.commit(Some("refs/heads/old"), "Old branch\n", &[a]); + t.repo + .tag_lightweight("light", &t.repo.find_object(c, None).unwrap(), false) + .unwrap(); + let tagger = t.signature("Tagger"); + t.repo + .tag( + "annotated", + &t.repo.find_object(b, None).unwrap(), + &tagger, + "Release notes\n", + false, + ) + .unwrap(); + + let result = rewrite(&t, b, "Reworded\n", RewriteScope::AllBranches); + + let new_c = t.ref_commit("refs/heads/main"); + let new_b = result.new_target; + assert_eq!(t.parent(new_c), new_b); + assert_eq!(t.ref_commit("refs/tags/light"), new_c); + assert_eq!(t.ref_commit("refs/tags/annotated"), new_b); + assert_eq!(t.parent(t.ref_commit("refs/heads/feature")), new_c); + assert_ne!(t.ref_commit("refs/heads/feature"), feature); + assert_eq!( + t.ref_commit("refs/heads/old"), + unrelated, + "branch without the commit is untouched" + ); + + let tag = t + .repo + .find_reference("refs/tags/annotated") + .unwrap() + .peel_to_tag() + .unwrap(); + assert_eq!(tag.message().unwrap(), Some("Release notes\n")); + assert_eq!(tag.tagger().unwrap().name().unwrap(), "Tagger"); + + let mut names: Vec<_> = result.ref_updates.iter().map(|u| u.name.as_str()).collect(); + names.sort(); + assert_eq!( + names, + [ + "refs/heads/feature", + "refs/heads/main", + "refs/tags/annotated", + "refs/tags/light" + ] + ); +} + +#[test] +fn rewrites_merge_commits() { + let mut t = TestRepo::new(); + let a = t.commit(Some("HEAD"), "Base\n", &[]); + let side = t.commit(None, "Side\n", &[a]); + let main = t.commit(Some("HEAD"), "Main\n", &[a]); + let merge = t.commit(Some("HEAD"), "Merge\n", &[main, side]); + + rewrite(&t, side, "Side reworded\n", RewriteScope::CurrentBranch); + + let new_merge = t.ref_commit("refs/heads/main"); + assert_ne!(new_merge, merge); + let new_merge = t.repo.find_commit(new_merge).unwrap(); + assert_eq!( + new_merge.parent_id(0).unwrap(), + main, + "first parent was not rewritten" + ); + assert_eq!( + t.message(new_merge.parent_id(1).unwrap()), + "Side reworded\n" + ); +} + +#[test] +fn rewrites_root_commit() { + let (t, [a, _, _]) = linear_repo(); + + let result = rewrite(&t, a, "Root reworded\n", RewriteScope::CurrentBranch); + + let root = t.repo.find_commit(result.new_target).unwrap(); + assert_eq!(root.parent_count(), 0); + assert_eq!(t.message(root.id()), "Root reworded\n"); + assert_eq!(result.rewritten_commits, 3); +} + +#[test] +fn rewrites_detached_head() { + let (t, [_, b, c]) = linear_repo(); + t.repo.set_head_detached(c).unwrap(); + + rewrite(&t, b, "Reworded\n", RewriteScope::CurrentBranch); + + assert!(t.repo.head_detached().unwrap()); + let head = t.repo.head().unwrap().peel_to_commit().unwrap().id(); + assert_ne!(head, c); + assert_eq!(t.message(t.parent(head)), "Reworded\n"); + assert_eq!( + t.ref_commit("refs/heads/main"), + c, + "branch is not part of current scope" + ); +} + +#[test] +fn rollback_restores_all_refs_and_removes_backups() { + let (mut t, [_, b, c]) = linear_repo(); + t.commit(Some("refs/heads/feature"), "Feature\n", &[c]); + let tagger = t.signature("Tagger"); + let tag = t + .repo + .tag( + "annotated", + &t.repo.find_object(b, None).unwrap(), + &tagger, + "Notes\n", + false, + ) + .unwrap(); + let before: Vec<_> = [ + "refs/heads/main", + "refs/heads/feature", + "refs/tags/annotated", + ] + .iter() + .map(|name| t.repo.find_reference(name).unwrap().target().unwrap()) + .collect(); + + rewrite(&t, b, "Reworded\n", RewriteScope::AllBranches); + assert_eq!(t.backups(), 3); + assert_eq!(git::pending_backups(&t.repo).unwrap().len(), 3); + + assert_eq!(git::rollback(&t.repo).unwrap(), 3); + + let after: Vec<_> = [ + "refs/heads/main", + "refs/heads/feature", + "refs/tags/annotated", + ] + .iter() + .map(|name| t.repo.find_reference(name).unwrap().target().unwrap()) + .collect(); + assert_eq!(before, after); + assert_eq!( + after[2], tag, + "annotated tag points to the original tag object" + ); + assert_eq!(t.backups(), 0); +} + +#[test] +fn confirm_removes_backups_and_allows_next_rewrite() { + let (t, [a, b, _]) = linear_repo(); + + rewrite(&t, b, "Reworded\n", RewriteScope::CurrentBranch); + assert_eq!(git::confirm(&t.repo).unwrap(), 1); + assert_eq!(t.backups(), 0); + assert!(git::pending_backups(&t.repo).unwrap().is_empty()); + + rewrite(&t, a, "First reworded\n", RewriteScope::CurrentBranch); + // rolling back the second rewrite must not undo the confirmed first one + git::rollback(&t.repo).unwrap(); + let head = t.ref_commit("refs/heads/main"); + assert_eq!(t.message(t.parent(head)), "Reworded\n"); +} + +#[test] +fn pending_rewrite_blocks_new_one() { + let (t, [a, b, _]) = linear_repo(); + rewrite(&t, b, "Reworded\n", RewriteScope::CurrentBranch); + + let err = git::rewrite_message( + &t.repo, + a, + "Other\n", + RewriteScope::CurrentBranch, + |_, _| {}, + ) + .unwrap_err(); + assert!(err.to_string().contains("unconfirmed rewrite"), "{}", err); +} + +#[test] +fn rejects_unchanged_empty_and_unreachable() { + let (mut t, [a, b, _]) = linear_repo(); + let other = t.commit(Some("refs/heads/other"), "Other\n", &[a]); + + let unchanged = t.message(b); + for (target, message, expected) in [ + (b, unchanged.as_str(), "same as the current"), + (b, " \n\n", "must not be empty"), + (other, "Reworded\n", "not reachable"), + ] { + let err = git::rewrite_message( + &t.repo, + target, + message, + RewriteScope::CurrentBranch, + |_, _| {}, + ) + .unwrap_err(); + assert!(err.to_string().contains(expected), "{}", err); + } + assert_eq!(t.backups(), 0); +} + +#[test] +fn reports_progress_for_every_commit() { + let (t, [_, b, _]) = linear_repo(); + let mut calls = Vec::new(); + + git::rewrite_message( + &t.repo, + b, + "Reworded\n", + RewriteScope::CurrentBranch, + |done, total| calls.push((done, total)), + ) + .unwrap(); + + assert_eq!(calls, vec![(1, 2), (2, 2)]); +} + +#[test] +fn loads_commits_page_by_page() { + let mut t = TestRepo::new(); + let mut parent = Vec::new(); + for i in 0..5 { + parent = vec![t.commit( + Some("HEAD"), + &format!("Commit {}\n\nBody {}\n", i, i), + &parent, + )]; + } + + let page = git::load_commits(&t.repo, 3, 0).unwrap(); + assert_eq!(page.commits.len(), 3); + assert!(page.has_more); + assert_eq!(page.commits[0].summary, "Commit 4"); + assert_eq!(page.commits[0].message, "Commit 4\n\nBody 4\n"); + + let page = git::load_commits(&t.repo, 3, 3).unwrap(); + assert_eq!(page.commits.len(), 2); + assert!(!page.has_more); + + let page = git::load_commits(&t.repo, 5, 0).unwrap(); + assert!(!page.has_more, "exactly limit commits means no more pages"); +} + +#[test] +fn empty_repository_has_no_commits() { + let t = TestRepo::new(); + let page = git::load_commits(&t.repo, 50, 0).unwrap(); + assert!(page.commits.is_empty()); + assert!(!page.has_more); + assert_eq!(git::current_branch(&t.repo), None); +} From 4874848d8fe6ac44bd2cb4e789688143d2f57e1c Mon Sep 17 00:00:00 2001 From: Amin Atabiev Date: Sun, 11 Oct 2026 14:06:44 +0300 Subject: [PATCH 2/5] ci: add clippy, build with --locked, drop GTK build dependency --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++---- .github/workflows/release.yml | 4 ++-- Makefile | 3 +-- scripts/build-linux.sh | 2 +- scripts/build-macos-app.sh | 2 +- scripts/build-windows.sh | 2 +- 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8c4b15..a3e4e30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,30 @@ jobs: - name: Check formatting run: cargo fmt -- --check + # Linter + clippy: + name: Clippy + runs-on: ubuntu-22.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential pkg-config + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: Cache Rust build + uses: Swatinem/rust-cache@v2 + + - name: Run clippy + run: cargo clippy --all-targets --locked -- -D warnings + # Compilation and tests on Linux test: name: Test (Linux) @@ -38,7 +62,7 @@ jobs: - name: Install system dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential pkg-config libgtk-3-dev + sudo apt-get install -y build-essential pkg-config - name: Setup Rust uses: dtolnay/rust-toolchain@stable @@ -47,10 +71,10 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Check code compiles - run: cargo check --all-targets + run: cargo check --all-targets --locked - name: Run tests - run: cargo test --verbose --all-targets + run: cargo test --all-targets --locked # Windows cross-compilation check (same toolchain as release builds) windows: @@ -74,4 +98,4 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Build for Windows - run: cargo build --release --target x86_64-pc-windows-gnu + run: cargo build --release --locked --target x86_64-pc-windows-gnu diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea43d76..3455cb7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -162,7 +162,7 @@ jobs: - name: Install system dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential pkg-config libgtk-3-dev + sudo apt-get install -y build-essential pkg-config - name: Setup Rust uses: dtolnay/rust-toolchain@stable @@ -308,7 +308,7 @@ jobs: 2. Make it executable: \`chmod +x commit-rewriter-$VERSION-linux-*.AppImage\` 3. Run it: \`./commit-rewriter-$VERSION-linux-*.AppImage\` - Or extract the tar.gz and run \`commit-rewriter\` (requires GTK 3). + Or extract the tar.gz and run \`commit-rewriter\`. --- diff --git a/Makefile b/Makefile index e776721..09dcbb4 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ # Variables PROJECT = commit-rewriter -VERSION = 2.0.0 BUILD_DIR = target/release DIST_DIR = releases @@ -83,7 +82,7 @@ fmt: ## Format code # Linter check clippy: ## Run clippy - cargo clippy -- -D warnings + cargo clippy --all-targets -- -D warnings # Full check before commit check: fmt clippy test ## Formatting, linter and tests diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh index 4e0d739..67db8f4 100755 --- a/scripts/build-linux.sh +++ b/scripts/build-linux.sh @@ -83,7 +83,7 @@ info "Rust version: $(rustc --version)" # Build project info "Compiling project..." -cargo build --release +cargo build --release --locked BINARY_PATH="target/release/${PROJECT_NAME}" DIST_DIR="releases" diff --git a/scripts/build-macos-app.sh b/scripts/build-macos-app.sh index 3919b13..8be12e9 100755 --- a/scripts/build-macos-app.sh +++ b/scripts/build-macos-app.sh @@ -80,7 +80,7 @@ info "Building for macOS ($ARCH_NAME)..." # Build project info "Compiling project..." -cargo build --release --target "$TARGET" +cargo build --release --locked --target "$TARGET" BINARY_PATH="target/$TARGET/release/${PROJECT_NAME}" APP_DIR="${DIST_DIR}/${APP_NAME}.app" diff --git a/scripts/build-windows.sh b/scripts/build-windows.sh index 881d35a..c6935de 100755 --- a/scripts/build-windows.sh +++ b/scripts/build-windows.sh @@ -100,7 +100,7 @@ fi # Build project (Windows subsystem without console) info "Compiling project (Windows GUI, no console)..." # Rustflags are configured in .cargo/config.toml -cargo build --release --target "$TARGET" +cargo build --release --locked --target "$TARGET" BINARY_PATH="target/$TARGET/release/${PROJECT_NAME}.exe" EXE_NAME="${APP_NAME}.exe" From b5e65708d9043b1d11e957dfd7e74cd14580d142 Mon Sep 17 00:00:00 2001 From: Amin Atabiev Date: Sun, 11 Oct 2026 14:06:44 +0300 Subject: [PATCH 3/5] docs: describe backups and scope, fix links and requirements --- README.md | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index cb98c67..170370f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # πŸ¦€ Git Commit Rewriter [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Rust](https://img.shields.io/badge/rust-1.70%2B-orange.svg)](https://www.rust-lang.org/) -[![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey.svg)](https://github.com/atabits/commit-rewriter) +[![Rust](https://img.shields.io/badge/rust-1.95%2B-orange.svg)](https://www.rust-lang.org/) +[![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey.svg)](https://github.com/atabits/git-commit-rewriter) > **Edit Git commit messages the easy way** β€” A beautiful, fast GUI app built with Rust @@ -27,8 +27,8 @@ ### Download & Build ```bash -git clone https://github.com/atabits/commit-rewriter.git -cd commit-rewriter +git clone https://github.com/atabits/git-commit-rewriter.git +cd git-commit-rewriter cargo build --release ``` @@ -69,13 +69,16 @@ commit-rewriter **πŸ›‘οΈ Built-in Safety** -The app automatically creates backups in `refs/original/` before making changes. You can rollback anytime through the UI! +- By default only the current branch is rewritten. Enable **All branches and tags** to also update every other branch and tag that contains the commit. +- The full commit message is edited, including its body and trailers such as `Signed-off-by:`. Authors, dates and file contents stay the same. +- Before moving any ref, the app saves its original value under `refs/commit-rewriter/backup/`. **Confirm** deletes the backups, **Cancel** restores the refs. If the app is closed before you decide, it asks again the next time the repository is opened. +- Remote-tracking branches are never touched, and commit signatures (GPG/SSH) are not preserved on rewritten commits. --- ## πŸ› οΈ For Developers -Need **Rust 1.70+** and **Git** installed. +Need **Rust 1.95+**. Git itself is not required: the app works through libgit2. ```bash # Development build @@ -84,11 +87,11 @@ cargo build # Release build (optimized) cargo build --release -# Run with debug logs -RUST_LOG=debug cargo run - # Run tests cargo test + +# Formatting, lints and tests (same checks as CI) +make check ``` ### πŸ“¦ Build for Distribution @@ -104,16 +107,18 @@ cargo build --release --target x86_64-pc-windows-gnu make linux ``` -On Linux, building requires GTK 3 development headers (used for the folder picker): +On Linux, building requires a C toolchain and pkg-config: ```bash # Debian / Ubuntu -sudo apt install build-essential pkg-config libgtk-3-dev +sudo apt install build-essential pkg-config # Arch -sudo pacman -S base-devel pkgconf gtk3 +sudo pacman -S base-devel pkgconf ``` +The folder picker uses [xdg-desktop-portal](https://flatpak.github.io/xdg-desktop-portal/), which is available on most desktop environments. + --- ## πŸ“„ License From 776e93ba2d56eb4b3f43e723d343464e1742e52d Mon Sep 17 00:00:00 2001 From: Amin Atabiev Date: Sun, 11 Oct 2026 14:10:02 +0300 Subject: [PATCH 4/5] chore: bump version to 2.1.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c445c8..7983c8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -656,7 +656,7 @@ dependencies = [ [[package]] name = "commit-rewriter" -version = "2.0.0" +version = "2.1.0" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index ec665db..626f854 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "commit-rewriter" -version = "2.0.0" +version = "2.1.0" edition = "2021" rust-version = "1.95" authors = ["Amin Atabiev"] From e43b2359f82368734bfbf6e30ee8ae1eaf638f08 Mon Sep 17 00:00:00 2001 From: Amin Atabiev Date: Sun, 11 Oct 2026 14:28:50 +0300 Subject: [PATCH 5/5] feat: redesign the interface - header with repository, branch and rewrite scope, commits list in the middle, message editor and activity log at the bottom - single-line commit rows with hash, summary, author and date, search matches highlighted and long text truncated - preview as a modal dialog with before/after messages and updated refs - shared theme with accent color for light and dark system themes - keyboard focus ring on commit rows, editor height capped - Reset button and Apply enabled only for a changed message - open the folder dialog asynchronously so the window keeps responding - show the home directory as ~ in paths --- Cargo.lock | 1 + Cargo.toml | 1 + src/app.rs | 184 +++++++++++++--------- src/main.rs | 9 +- src/models/log.rs | 24 +-- src/ui/commits_list.rs | 328 +++++++++++++++++++++++----------------- src/ui/editor_panel.rs | 119 ++++++++------- src/ui/logs_panel.rs | 141 +++++------------ src/ui/main_window.rs | 255 +++++++++++-------------------- src/ui/mod.rs | 1 + src/ui/preview_modal.rs | 254 ++++++++++++------------------- src/ui/theme.rs | 154 +++++++++++++++++++ 12 files changed, 767 insertions(+), 704 deletions(-) create mode 100644 src/ui/theme.rs diff --git a/Cargo.lock b/Cargo.lock index 7983c8b..6128cc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -662,6 +662,7 @@ dependencies = [ "chrono", "eframe", "git2", + "pollster 0.4.0", "rfd", "tempfile", ] diff --git a/Cargo.toml b/Cargo.toml index 626f854..f952991 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ eframe = "0.36" git2 = { version = "0.21", default-features = false, features = ["vendored-libgit2"] } chrono = "0.4" rfd = "0.17" +pollster = "0.4" anyhow = "1.0" [dev-dependencies] diff --git a/src/app.rs b/src/app.rs index 9f7d94d..a95cf0a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -4,7 +4,7 @@ use crate::background::{ }; use crate::git::{self, RewriteScope}; use crate::models::{CommitInfo, LogEntry, LogFilter, LogLevel, PreviewData}; -use crate::ui::{commits_list, editor_panel, logs_panel, main_window, preview_modal}; +use crate::ui::{commits_list, editor_panel, logs_panel, main_window, preview_modal, theme}; use eframe::egui; use std::path::PathBuf; use std::sync::mpsc::{self, Sender}; @@ -33,6 +33,8 @@ pub struct CommitRewriterApp { pub is_processing: bool, pub message_receiver: Option>, + /// Result of an open folder dialog; `None` inside means it was cancelled. + folder_receiver: Option>>, initialized: bool, pub show_help: bool, @@ -63,6 +65,7 @@ impl Default for CommitRewriterApp { is_processing: false, message_receiver: None, + folder_receiver: None, initialized: false, show_help: false, @@ -74,7 +77,7 @@ impl Default for CommitRewriterApp { // try to use current directory if it's a git repo match std::env::current_dir() { Ok(dir) if git::is_valid_repo(&dir) => { - app.add_log(&format!("Opened repository: {}", dir.display())); + app.add_log(&format!("Opened repository {}", theme::display_path(&dir))); app.set_repo(dir); } _ => app.add_log("Select a Git repository to get started"), @@ -251,10 +254,39 @@ impl CommitRewriterApp { } } + /// Opens the folder dialog without blocking the UI thread, so the window + /// keeps responding to the compositor while the dialog is open. fn pick_repository(&mut self, ctx: &egui::Context) { - let Some(path) = rfd::FileDialog::new().pick_folder() else { + if self.folder_receiver.is_some() { return; + } + + let (tx, rx) = mpsc::channel(); + self.folder_receiver = Some(rx); + + let ctx = ctx.clone(); + std::thread::spawn(move || { + let folder = pollster::block_on(rfd::AsyncFileDialog::new().pick_folder()); + tx.send(folder.map(|handle| handle.path().to_path_buf())) + .ok(); + ctx.request_repaint(); + }); + } + + fn process_picked_folder(&mut self, ctx: &egui::Context) { + let Some(receiver) = &self.folder_receiver else { + return; + }; + let path = match receiver.try_recv() { + Ok(Some(path)) => path, + Ok(None) | Err(mpsc::TryRecvError::Disconnected) => { + self.folder_receiver = None; + return; + } + Err(mpsc::TryRecvError::Empty) => return, }; + self.folder_receiver = None; + if !git::is_valid_repo(&path) { self.add_log_typed( "Selected directory is not a Git repository", @@ -267,10 +299,13 @@ impl CommitRewriterApp { match &self.current_branch { Some(branch) => self.add_log(&format!( "Loading commits from {} (branch {})", - path.display(), + theme::display_path(&path), branch )), - None => self.add_log(&format!("Loading commits from {}", path.display())), + None => self.add_log(&format!( + "Loading commits from {}", + theme::display_path(&path) + )), } self.load_commits_async(ctx); } @@ -307,6 +342,7 @@ impl eframe::App for CommitRewriterApp { } self.process_background_messages(); + self.process_picked_folder(ctx); if self.is_processing || self.loading_more { ctx.request_repaint(); @@ -315,6 +351,9 @@ impl eframe::App for CommitRewriterApp { fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) { let ctx = ui.ctx().clone(); + // the preview must be answered before anything else can change + let busy = + self.is_processing || self.preview_data.is_some() || self.folder_receiver.is_some(); if let Some(preview) = &self.preview_data { let result = preview_modal::render_preview_modal(&ctx, preview, self.is_processing); @@ -328,87 +367,88 @@ impl eframe::App for CommitRewriterApp { } } - egui::Panel::right("logs_panel") - .resizable(true) - .default_size(450.0) - .min_size(300.0) - .max_size(600.0) + egui::Panel::top("header") + .frame(theme::panel_frame(ui)) .show(ui, |ui| { - let clear_clicked = logs_panel::render_logs_panel( + let result = main_window::render_main_window( ui, - &self.logs, - &mut self.log_filter, + self.repo_path.as_ref(), + busy, + &mut self.show_help, + &mut self.modify_all_branches, + self.current_branch.as_deref(), self.show_progress, self.progress, ); - if clear_clicked { - self.logs.clear(); + + if result.pick_folder_clicked { + self.pick_repository(&ctx); } - }); - egui::CentralPanel::default_margins().show(ui, |ui| { - // the modal must be answered before anything else can change - let busy = self.is_processing || self.preview_data.is_some(); - - let main_result = main_window::render_main_window( - ui, - self.repo_path.as_ref(), - self.commits.len(), - busy, - &mut self.show_help, - &mut self.modify_all_branches, - self.current_branch.as_deref(), - ); + if result.refresh_clicked { + self.add_log("Refreshing commits list..."); + if let Some(path) = &self.repo_path { + self.current_branch = git::open(path) + .ok() + .and_then(|repo| git::current_branch(&repo)); + } + self.load_commits_async(&ctx); + } + }); - if main_result.pick_folder_clicked { - self.pick_repository(&ctx); - } + egui::Panel::bottom("logs_panel") + .frame(theme::panel_frame(ui)) + .resizable(true) + .default_size(150.0) + .min_size(90.0) + .max_size(400.0) + .show(ui, |ui| { + if logs_panel::render_logs_panel(ui, &self.logs, &mut self.log_filter) { + self.logs.clear(); + } + }); - if main_result.refresh_clicked { - self.add_log("Refreshing commits list..."); - if let Some(path) = &self.repo_path { - self.current_branch = git::open(path) - .ok() - .and_then(|repo| git::current_branch(&repo)); + egui::Panel::bottom("editor_panel") + .frame(theme::panel_frame(ui)) + .show(ui, |ui| { + let original = self + .selected_index + .and_then(|i| self.commits.get(i)) + .map(|c| c.message.as_str()); + let result = + editor_panel::render_editor_panel(ui, &mut self.new_message, original, busy); + + if result.reset_clicked { + if let Some(original) = original { + self.new_message = original.trim_end().to_string(); + } } - self.load_commits_async(&ctx); - } + if result.apply_clicked { + self.apply_change(&ctx); + } + }); - let commits_result = commits_list::render_commits_list( - ui, - &self.commits, - self.selected_index, - &mut self.search_query, - busy, - self.loading_more, - self.has_more_commits, - ); + egui::CentralPanel::default_margins() + .frame(egui::Frame::central_panel(ui.style()).inner_margin(theme::PANEL_MARGIN)) + .show(ui, |ui| { + let result = commits_list::render_commits_list( + ui, + &self.commits, + self.selected_index, + &mut self.search_query, + busy, + self.loading_more, + self.has_more_commits, + ); - if let Some(index) = commits_result.selected_index { - if let Some(commit) = self.commits.get(index) { - self.selected_index = Some(index); + if let Some(commit) = result.selected_index.and_then(|i| self.commits.get(i)) { self.new_message = commit.message.trim_end().to_string(); - let log = format!("Selected commit {} - {}", commit.short_hash, commit.summary); - self.add_log(&log); + self.selected_index = result.selected_index; } - } - - if commits_result.load_more_clicked { - self.load_more_commits_async(&ctx); - } - - ui.separator(); - let editor_result = editor_panel::render_editor_panel( - ui, - &mut self.new_message, - self.selected_index.is_some(), - busy, - ); - - if editor_result.apply_clicked { - self.apply_change(&ctx); - } - }); + if result.load_more_clicked { + self.load_more_commits_async(&ctx); + } + }); } } diff --git a/src/main.rs b/src/main.rs index f1337e8..89d58e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,14 @@ #![cfg_attr(windows, windows_subsystem = "windows")] use commit_rewriter::app::CommitRewriterApp; +use commit_rewriter::ui::theme; use eframe::egui; fn main() -> Result<(), eframe::Error> { let options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default() - .with_inner_size([900.0, 700.0]) + .with_inner_size([1000.0, 760.0]) + .with_min_inner_size([640.0, 520.0]) .with_title("Git Commit Rewriter"), ..Default::default() }; @@ -14,6 +16,9 @@ fn main() -> Result<(), eframe::Error> { eframe::run_native( "Git Commit Rewriter", options, - Box::new(|_cc| Ok(Box::new(CommitRewriterApp::default()))), + Box::new(|cc| { + theme::apply(&cc.egui_ctx); + Ok(Box::new(CommitRewriterApp::default())) + }), ) } diff --git a/src/models/log.rs b/src/models/log.rs index 21e79e0..ed20c14 100644 --- a/src/models/log.rs +++ b/src/models/log.rs @@ -9,19 +9,19 @@ pub enum LogLevel { impl LogLevel { pub fn icon(&self) -> &'static str { match self { - LogLevel::Info => "πŸ“", - LogLevel::Success => "βœ…", - LogLevel::Warning => "⚠️", - LogLevel::Error => "❌", + LogLevel::Info => "β€’", + LogLevel::Success => "βœ”", + LogLevel::Warning => "⚠", + LogLevel::Error => "βœ–", } } pub fn color(&self) -> (u8, u8, u8) { match self { - LogLevel::Info => (150, 150, 160), - LogLevel::Success => (80, 200, 120), - LogLevel::Warning => (255, 180, 50), - LogLevel::Error => (255, 100, 100), + LogLevel::Info => (140, 142, 150), + LogLevel::Success => (80, 180, 110), + LogLevel::Warning => (230, 170, 50), + LogLevel::Error => (220, 90, 90), } } } @@ -82,10 +82,10 @@ mod tests { #[test] fn test_log_level_icon() { - assert_eq!(LogLevel::Info.icon(), "πŸ“"); - assert_eq!(LogLevel::Success.icon(), "βœ…"); - assert_eq!(LogLevel::Warning.icon(), "⚠️"); - assert_eq!(LogLevel::Error.icon(), "❌"); + assert_eq!(LogLevel::Info.icon(), "β€’"); + assert_eq!(LogLevel::Success.icon(), "βœ”"); + assert_eq!(LogLevel::Warning.icon(), "⚠"); + assert_eq!(LogLevel::Error.icon(), "βœ–"); } #[test] diff --git a/src/ui/commits_list.rs b/src/ui/commits_list.rs index ce147ba..d5f8460 100644 --- a/src/ui/commits_list.rs +++ b/src/ui/commits_list.rs @@ -1,5 +1,6 @@ use crate::models::CommitInfo; -use eframe::egui; +use crate::ui::theme; +use eframe::egui::{self, text::LayoutJob, Color32, FontId, Sense, TextFormat}; pub struct CommitsListResult { pub selected_index: Option, @@ -20,152 +21,192 @@ pub fn render_commits_list( load_more_clicked: false, }; - ui.horizontal(|ui| { - ui.label(egui::RichText::new("πŸ“‹ Commits List").size(14.0).strong()); - - if !commits.is_empty() { - let filtered = filter_commits(commits, search_query); - let total = commits.len(); - let filtered_count = filtered.len(); - - if !search_query.trim().is_empty() && filtered_count != total { - ui.label( - egui::RichText::new(format!("({} of {})", filtered_count, total)) - .size(11.0) - .color(egui::Color32::from_rgb(100, 150, 255)), - ); - } else { - ui.label( - egui::RichText::new(format!("({})", total)) - .size(11.0) - .color(egui::Color32::GRAY), - ); - } - } - }); - - ui.add_space(2.0); + let query = search_query.trim().to_string(); + let filtered = filter_commits(commits, &query); - if !commits.is_empty() { - ui.horizontal(|ui| { - ui.add( - egui::TextEdit::singleline(search_query) - .hint_text("πŸ” Search by hash, message, author...") - .desired_width(f32::INFINITY), - ); + ui.horizontal(|ui| { + ui.label(theme::section_title("Commits")); + let count = if query.is_empty() { + commits.len().to_string() + } else { + format!("{} of {}", filtered.len(), commits.len()) + }; + ui.label(theme::muted(ui, count)); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { if !search_query.is_empty() && ui.small_button("βœ–").on_hover_text("Clear search").clicked() { search_query.clear(); } + ui.add( + egui::TextEdit::singleline(search_query) + .hint_text("πŸ” Search message, hash, author") + .desired_width(260.0), + ); }); - ui.add_space(2.0); - } + }); - let available_height = ui.available_height() - 150.0; - egui::ScrollArea::vertical() - .max_height(available_height.max(100.0)) - .auto_shrink([false, false]) - .show(ui, |ui| { - if commits.is_empty() { - ui.centered_and_justified(|ui| { - ui.label( - egui::RichText::new("Select a Git repository\nto view commits") - .color(egui::Color32::GRAY) - .italics() - .size(12.0), + ui.add_space(4.0); + + theme::card(ui).inner_margin(4).show(ui, |ui| { + egui::ScrollArea::vertical() + .auto_shrink([false, false]) + .show(ui, |ui| { + if commits.is_empty() { + empty_state( + ui, + "No commits to show", + "Open a Git repository to get started", ); - }); - } else { - let filtered = filter_commits(commits, search_query); - - if filtered.is_empty() && !search_query.trim().is_empty() { - ui.centered_and_justified(|ui| { - ui.vertical(|ui| { - ui.label( - egui::RichText::new("πŸ”") - .size(32.0) - .color(egui::Color32::GRAY), - ); - ui.label( - egui::RichText::new("Nothing found") - .size(13.0) - .color(egui::Color32::GRAY), - ); - ui.label( - egui::RichText::new(format!("For query: \"{}\"", search_query)) - .size(11.0) - .color(egui::Color32::DARK_GRAY) - .italics(), - ); - }); - }); - } else { - for (original_index, commit) in filtered.iter() { - let i = *original_index; - let is_selected = selected_index == Some(i); - - let full_text = format!( - "{} β”‚ {} β”‚ {}", - commit.short_hash, commit.date, commit.summary - ); - - let response = ui.selectable_label( - is_selected, - highlighted_text(ui, &full_text, search_query.trim()), - ); - - if response.clicked() && !is_processing { - result.selected_index = Some(i); - } + return; + } + if filtered.is_empty() { + empty_state( + ui, + "Nothing found", + &format!("No commits match \"{}\"", query), + ); + return; + } - response.on_hover_text(format!( - "Hash: {}\nAuthor: {}\nDate: {}\n\n{}", - commit.hash, commit.author, commit.date, commit.message - )); + for (index, commit) in &filtered { + let response = commit_row(ui, commit, selected_index == Some(*index), &query); + if response.clicked() && !is_processing { + result.selected_index = Some(*index); } + } - // Only show "Load more" button if there are potentially more commits - if has_more_commits { - ui.add_space(3.0); - ui.separator(); - ui.add_space(3.0); - - ui.centered_and_justified(|ui| { - if loading_more { - ui.horizontal(|ui| { - ui.spinner(); - ui.label( - egui::RichText::new("Loading...") - .size(11.0) - .color(egui::Color32::GRAY), - ); - }); - } else { - let load_more_btn = egui::Button::new( - egui::RichText::new("⬇ Load 50 more commits").size(12.0), - ); - - if ui - .add_enabled(!is_processing, load_more_btn) - .on_hover_text("Load next 50 commits") - .clicked() - { - result.load_more_clicked = true; - } - } - }); - } + if has_more_commits { + ui.add_space(6.0); + ui.vertical_centered(|ui| { + if loading_more { + ui.spinner(); + } else if ui + .add_enabled(!is_processing, egui::Button::new("Load more commits")) + .clicked() + { + result.load_more_clicked = true; + } + }); + ui.add_space(6.0); } - } - }); + }); + }); result } +fn commit_row( + ui: &mut egui::Ui, + commit: &CommitInfo, + selected: bool, + query: &str, +) -> egui::Response { + let (rect, response) = ui.allocate_exact_size( + egui::vec2(ui.available_width(), theme::ROW_HEIGHT), + Sense::click(), + ); + + let visuals = ui.visuals().clone(); + let painter = ui.painter_at(rect); + + if selected { + painter.rect_filled(rect, 6.0, visuals.selection.bg_fill); + painter.rect_filled( + egui::Rect::from_min_size( + rect.min + egui::vec2(0.0, 6.0), + egui::vec2(3.0, rect.height() - 12.0), + ), + 2.0, + theme::ACCENT, + ); + } else if response.hovered() { + painter.rect_filled(rect, 6.0, visuals.faint_bg_color); + } + if response.gained_focus() { + response.scroll_to_me(None); + } + if response.has_focus() { + painter.rect_stroke( + rect.shrink(1.0), + 6.0, + egui::Stroke::new(1.5, theme::ACCENT), + egui::StrokeKind::Inside, + ); + } + + let text_color = visuals.text_color(); + let weak_color = visuals.weak_text_color(); + let padding = 12.0; + let center_y = rect.center().y; + + // hash on the left + let hash_job = highlighted_text( + &commit.short_hash, + query, + FontId::monospace(13.0), + theme::ACCENT, + None, + ); + let hash = painter.layout_job(hash_job); + let hash_pos = egui::pos2(rect.left() + padding, center_y - hash.size().y / 2.0); + let summary_left = hash_pos.x + hash.size().x + 14.0; + painter.galley(hash_pos, hash, text_color); + + // author and date on the right + let meta_text = format!("{} Β· {}", commit.author, commit.date); + let meta_job = highlighted_text( + &meta_text, + query, + FontId::proportional(12.5), + weak_color, + None, + ); + let meta = painter.layout_job(meta_job); + let meta_pos = egui::pos2( + rect.right() - padding - meta.size().x, + center_y - meta.size().y / 2.0, + ); + let summary_right = meta_pos.x - 16.0; + painter.galley(meta_pos, meta, weak_color); + + // summary in between, truncated to one line + let width = (summary_right - summary_left).max(40.0); + let summary_job = highlighted_text( + &commit.summary, + query, + FontId::proportional(14.0), + text_color, + Some(width), + ); + let summary = painter.layout_job(summary_job); + painter.galley( + egui::pos2(summary_left, center_y - summary.size().y / 2.0), + summary, + text_color, + ); + + response + .on_hover_cursor(egui::CursorIcon::PointingHand) + .on_hover_text(format!( + "{}\n{} Β· {}\n\n{}", + commit.hash, + commit.author, + commit.date, + commit.message.trim_end() + )) +} + +fn empty_state(ui: &mut egui::Ui, title: &str, subtitle: &str) { + ui.add_space(ui.available_height() * 0.3); + ui.vertical_centered(|ui| { + ui.label(egui::RichText::new(title).size(16.0).strong()); + ui.label(theme::muted(ui, subtitle)); + }); +} + fn filter_commits<'a>(commits: &'a [CommitInfo], query: &str) -> Vec<(usize, &'a CommitInfo)> { - let query = query.trim(); commits .iter() .enumerate() @@ -217,21 +258,27 @@ fn find_matches(text: &str, query: &str) -> Vec<(usize, usize)> { matches } -fn highlighted_text(ui: &egui::Ui, text: &str, query: &str) -> egui::text::LayoutJob { - let font_id = egui::FontId::monospace(11.0); - let normal = egui::TextFormat { +/// Text with search matches highlighted, optionally truncated to one line of `max_width`. +fn highlighted_text( + text: &str, + query: &str, + font_id: FontId, + color: Color32, + max_width: Option, +) -> LayoutJob { + let normal = TextFormat { font_id: font_id.clone(), - color: ui.visuals().text_color(), + color, ..Default::default() }; - let highlight = egui::TextFormat { + let highlight = TextFormat { font_id, - color: egui::Color32::BLACK, - background: egui::Color32::from_rgb(255, 255, 0), + color: Color32::BLACK, + background: Color32::from_rgb(255, 214, 102), ..Default::default() }; - let mut job = egui::text::LayoutJob::default(); + let mut job = LayoutJob::default(); let mut last_end = 0; for (start, end) in find_matches(text, query) { job.append(&text[last_end..start], 0.0, normal.clone()); @@ -239,6 +286,15 @@ fn highlighted_text(ui: &egui::Ui, text: &str, query: &str) -> egui::text::Layou last_end = end; } job.append(&text[last_end..], 0.0, normal); + + if let Some(max_width) = max_width { + job.wrap = egui::text::TextWrapping { + max_width, + max_rows: 1, + break_anywhere: true, + overflow_character: Some('…'), + }; + } job } diff --git a/src/ui/editor_panel.rs b/src/ui/editor_panel.rs index d6351ee..a7794ee 100644 --- a/src/ui/editor_panel.rs +++ b/src/ui/editor_panel.rs @@ -1,84 +1,91 @@ -use eframe::egui; +use crate::ui::theme; +use eframe::egui::{self, RichText}; + +/// Recommended maximum length of the first line. +const SUBJECT_LIMIT: usize = 72; +const EDITOR_MAX_HEIGHT: f32 = 180.0; pub struct EditorPanelResult { pub apply_clicked: bool, + pub reset_clicked: bool, } +/// Message editor. `original` is the current message of the selected commit. pub fn render_editor_panel( ui: &mut egui::Ui, new_message: &mut String, - has_selection: bool, + original: Option<&str>, is_processing: bool, ) -> EditorPanelResult { let mut result = EditorPanelResult { apply_clicked: false, + reset_clicked: false, }; - ui.vertical(|ui| { - ui.horizontal(|ui| { - ui.label( - egui::RichText::new("✏️ New Commit Message") - .size(14.0) - .strong(), - ); - - if !new_message.trim().is_empty() { - let len = new_message.lines().next().unwrap_or("").chars().count(); - let color = if len > 72 { - egui::Color32::from_rgb(255, 180, 50) - } else { - egui::Color32::from_rgb(100, 200, 100) - }; + let changed = original.is_some_and(|o| o.trim_end() != new_message.trim_end()); - ui.label( - egui::RichText::new(format!("{} characters", len)) - .size(11.0) - .color(color), - ); + ui.horizontal(|ui| { + ui.label(theme::section_title("Message")); - if len > 72 { - ui.label( - egui::RichText::new("⚠️ Recommended ≀72") - .size(10.0) - .color(egui::Color32::from_rgb(255, 180, 50)), - ); - } - } - }); - - ui.add_space(2.0); + if original.is_some() { + let len = new_message.lines().next().unwrap_or("").chars().count(); + let color = if len > SUBJECT_LIMIT { + theme::WARNING + } else { + ui.visuals().weak_text_color() + }; + ui.label( + RichText::new(format!("subject {}/{}", len, SUBJECT_LIMIT)) + .small() + .color(color), + ) + .on_hover_text("Keep the first line within 72 characters"); + } + }); - let text_edit = egui::TextEdit::multiline(new_message) - .desired_width(f32::INFINITY) - .desired_rows(4) - .hint_text("Enter new commit message...") - .font(egui::TextStyle::Monospace); + ui.add_space(4.0); - ui.add_enabled(!is_processing, text_edit); + // long messages scroll instead of pushing the commit list away + egui::ScrollArea::vertical() + .id_salt("message_editor") + .max_height(EDITOR_MAX_HEIGHT) + .show(ui, |ui| { + ui.add_enabled( + original.is_some() && !is_processing, + egui::TextEdit::multiline(new_message) + .desired_width(f32::INFINITY) + .desired_rows(6) + .hint_text("Select a commit to edit its message") + .font(egui::TextStyle::Monospace) + .margin(egui::Margin::same(8)), + ); + }); - ui.add_space(3.0); + ui.add_space(6.0); - ui.horizontal(|ui| { - let apply_btn = egui::Button::new(egui::RichText::new("βœ… Apply Change").size(14.0)) - .min_size(egui::vec2(180.0, 36.0)); + ui.horizontal(|ui| { + if changed { + ui.label(theme::muted(ui, "Unsaved changes").small()); + } - if ui - .add_enabled( - !is_processing && has_selection && !new_message.trim().is_empty(), - apply_btn, - ) - .clicked() + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + if theme::primary_button( + ui, + "Apply change", + changed && !is_processing && !new_message.trim().is_empty(), + ) + .on_disabled_hover_text("Edit the message of a selected commit first") + .clicked() { result.apply_clicked = true; } - if !has_selection { - ui.label( - egui::RichText::new("← Select a commit from the list") - .size(11.0) - .color(egui::Color32::GRAY) - .italics(), - ); + if ui + .add_enabled(changed && !is_processing, egui::Button::new("Reset")) + .on_hover_text("Restore the current message") + .clicked() + { + result.reset_clicked = true; } }); }); diff --git a/src/ui/logs_panel.rs b/src/ui/logs_panel.rs index 8531b4a..d4ff4ff 100644 --- a/src/ui/logs_panel.rs +++ b/src/ui/logs_panel.rs @@ -1,103 +1,46 @@ use crate::models::{LogEntry, LogFilter}; -use eframe::egui; +use crate::ui::theme; +use eframe::egui::{self, RichText}; -pub fn render_logs_panel( - ui: &mut egui::Ui, - logs: &[LogEntry], - log_filter: &mut LogFilter, - show_progress: bool, - progress: f32, -) -> bool { +/// Activity log. Returns `true` when Clear was clicked. +pub fn render_logs_panel(ui: &mut egui::Ui, logs: &[LogEntry], log_filter: &mut LogFilter) -> bool { let mut clear_clicked = false; - ui.vertical(|ui| { - ui.horizontal(|ui| { - ui.heading(egui::RichText::new("πŸ“ Logs").size(18.0).strong()); - - ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - if ui - .add_enabled(!logs.is_empty(), egui::Button::new("πŸ—‘οΈ Clear")) - .clicked() - { - clear_clicked = true; - } - - egui::ComboBox::from_id_salt("log_filter") - .selected_text(log_filter.name()) - .show_ui(ui, |ui| { - ui.selectable_value(log_filter, LogFilter::All, LogFilter::All.name()); - ui.selectable_value( - log_filter, - LogFilter::Important, - LogFilter::Important.name(), - ); - ui.selectable_value( - log_filter, - LogFilter::ErrorsOnly, - LogFilter::ErrorsOnly.name(), - ); - }); - }); - }); - - ui.add_space(2.0); - - ui.label( - egui::RichText::new(format!("πŸ“Š Entries: {}", logs.len())) - .small() - .color(egui::Color32::GRAY), - ); - - ui.separator(); - - if show_progress { - ui.vertical(|ui| { - ui.horizontal(|ui| { - ui.label("⏳"); - ui.label( - egui::RichText::new("Executing operation...") - .color(egui::Color32::from_rgb(100, 150, 255)), - ); + ui.horizontal(|ui| { + ui.label(theme::section_title("Activity")); + ui.label(theme::muted(ui, logs.len().to_string())); + + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + if ui + .add_enabled(!logs.is_empty(), egui::Button::new("Clear").small()) + .clicked() + { + clear_clicked = true; + } + + egui::ComboBox::from_id_salt("log_filter") + .selected_text(log_filter.name()) + .width(110.0) + .show_ui(ui, |ui| { + for filter in [LogFilter::All, LogFilter::Important, LogFilter::ErrorsOnly] { + ui.selectable_value(log_filter, filter, filter.name()); + } }); + }); + }); - let progress_bar = egui::ProgressBar::new(progress) - .show_percentage() - .animate(true); - ui.add(progress_bar); - }); - ui.add_space(3.0); - ui.separator(); - } + ui.add_space(4.0); - let remaining_height = ui.available_height(); + theme::card(ui).inner_margin(6).show(ui, |ui| { egui::ScrollArea::vertical() .stick_to_bottom(true) - .auto_shrink([false, true]) - .max_height(remaining_height.min(800.0)) + .auto_shrink([false, false]) .show(ui, |ui| { if logs.is_empty() { - ui.add_space(ui.available_height() * 0.1); - ui.centered_and_justified(|ui| { - ui.vertical(|ui| { - ui.label( - egui::RichText::new("πŸ“") - .size(48.0) - .color(egui::Color32::from_rgb(100, 100, 120)), - ); - ui.label( - egui::RichText::new("Logs will appear here") - .size(13.0) - .color(egui::Color32::GRAY) - .italics(), - ); - }); - }); - } else { - for entry in logs { - if log_filter.should_show(&entry.level) { - render_log_entry(ui, entry); - } - } + ui.label(theme::muted(ui, "Nothing here yet").italics()); + } + for entry in logs.iter().filter(|e| log_filter.should_show(&e.level)) { + render_log_entry(ui, entry); } }); }); @@ -106,23 +49,13 @@ pub fn render_logs_panel( } fn render_log_entry(ui: &mut egui::Ui, entry: &LogEntry) { - let icon = entry.level.icon(); let (r, g, b) = entry.level.color(); let color = egui::Color32::from_rgb(r, g, b); - ui.horizontal(|ui| { - ui.label(egui::RichText::new(icon).size(12.0)); - ui.label( - egui::RichText::new(&entry.timestamp) - .monospace() - .size(10.0) - .color(egui::Color32::GRAY), - ); - ui.label( - egui::RichText::new(&entry.message) - .monospace() - .size(10.5) - .color(color), - ); + ui.horizontal_top(|ui| { + ui.spacing_mut().item_spacing.x = 6.0; + ui.label(RichText::new(entry.level.icon()).color(color).monospace()); + ui.label(theme::muted(ui, &entry.timestamp).monospace().size(12.0)); + ui.add(egui::Label::new(RichText::new(&entry.message).size(13.0).color(color)).wrap()); }); } diff --git a/src/ui/main_window.rs b/src/ui/main_window.rs index 0061e60..9e4403c 100644 --- a/src/ui/main_window.rs +++ b/src/ui/main_window.rs @@ -1,203 +1,126 @@ -use eframe::egui; +use crate::ui::theme; +use eframe::egui::{self, RichText}; pub struct MainWindowResult { pub pick_folder_clicked: bool, pub refresh_clicked: bool, } +/// Header with the repository, actions and rewrite scope. +#[allow(clippy::too_many_arguments)] pub fn render_main_window( ui: &mut egui::Ui, repo_path: Option<&std::path::PathBuf>, - commits_count: usize, is_processing: bool, show_help: &mut bool, modify_all_branches: &mut bool, current_branch: Option<&str>, + show_progress: bool, + progress: f32, ) -> MainWindowResult { let mut result = MainWindowResult { pick_folder_clicked: false, refresh_clicked: false, }; - ui.vertical(|ui| { - ui.horizontal(|ui| { - ui.heading( - egui::RichText::new("πŸ”§ Git Commit Rewriter") - .size(22.0) - .strong(), - ); - - ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - if ui.button("❓").on_hover_text("Help").clicked() { - *show_help = !*show_help; - } - }); - }); - - ui.horizontal(|ui| { - ui.label( - egui::RichText::new( - "Select a commit from the list, edit its message and apply the change", - ) - .size(12.0) - .color(egui::Color32::GRAY), - ); + ui.horizontal(|ui| { + ui.label(RichText::new("Git Commit Rewriter").heading().strong()); + ui.label(theme::muted(ui, format!("v{}", env!("CARGO_PKG_VERSION"))).small()); - ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - ui.label( - egui::RichText::new("Created by Amin Atabiev") - .size(11.0) - .color(egui::Color32::from_rgb(150, 200, 255)), - ); - }); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + ui.toggle_value(show_help, "Help"); }); + }); - if *show_help { - ui.add_space(3.0); - egui::Frame::NONE - .fill(egui::Color32::from_rgb(50, 60, 80)) - .corner_radius(5.0) - .inner_margin(10.0) - .show(ui, |ui| { - ui.label( - egui::RichText::new("πŸ’‘ How to use:") - .strong() - .color(egui::Color32::from_rgb(100, 200, 255)), - ); - ui.label("1. Select a Git repository"); - ui.label("2. Click on a commit in the list"); - ui.label("3. Edit the message"); - ui.label("4. Click 'Apply change'"); - ui.label("5. Watch the logs on the right"); - - ui.add_space(3.0); - ui.label( - egui::RichText::new("⚠️ Important:") - .strong() - .color(egui::Color32::from_rgb(255, 180, 50)), - ); - ui.label( - "β€’ Rewriting changes the hashes of the commit and all its descendants", - ); - ui.label( - "β€’ Push with git push --force-with-lease, don't rewrite shared branches", - ); - ui.label("β€’ Original refs are kept until you confirm, Cancel restores them"); + ui.add_space(4.0); - ui.add_space(5.0); - ui.separator(); - ui.add_space(3.0); - ui.label( - egui::RichText::new("ℹ️ About:") - .strong() - .color(egui::Color32::from_rgb(150, 200, 255)), - ); - ui.label("Created by: Amin Atabiev"); - }); + ui.horizontal(|ui| { + if ui + .add_enabled(!is_processing, egui::Button::new("πŸ“‚ Open repository…")) + .clicked() + { + result.pick_folder_clicked = true; } - ui.add_space(3.0); - - ui.horizontal(|ui| { - let btn = egui::Button::new(egui::RichText::new("πŸ“‚ Select Repository").size(14.0)) - .min_size(egui::vec2(160.0, 32.0)); - - if ui.add_enabled(!is_processing, btn).clicked() { - result.pick_folder_clicked = true; - } - - let refresh_btn = egui::Button::new(egui::RichText::new("πŸ”„ Refresh").size(14.0)) - .min_size(egui::vec2(120.0, 32.0)); + if ui + .add_enabled( + !is_processing && repo_path.is_some(), + egui::Button::new("⟳ Refresh"), + ) + .on_hover_text("Reload commits and the current branch") + .clicked() + { + result.refresh_clicked = true; + } - if ui - .add_enabled(!is_processing && repo_path.is_some(), refresh_btn) - .clicked() - { - result.refresh_clicked = true; + ui.add_space(8.0); + + match repo_path { + Some(path) => { + let name = path + .file_name() + .map(|n| n.to_string_lossy().into_owned()) + .unwrap_or_else(|| theme::display_path(path)); + ui.label(RichText::new(name).strong()) + .on_hover_text(theme::display_path(path)); + theme::chip(ui, current_branch.unwrap_or("detached HEAD"), theme::ACCENT); } - - if is_processing { - ui.spinner(); - ui.label( - egui::RichText::new("Processing...") - .color(egui::Color32::from_rgb(100, 150, 255)), - ); + None => { + ui.label(theme::muted(ui, "No repository selected")); } - }); + } + }); + if repo_path.is_some() { ui.add_space(2.0); - - if repo_path.is_some() { - ui.horizontal(|ui| { - ui.label("🌐 Modification mode:"); - - ui.add_enabled( - !is_processing, - egui::Checkbox::new( - modify_all_branches, - egui::RichText::new("All branches and tags").size(12.0), - ), - ); - - if !*modify_all_branches { - if let Some(branch) = current_branch { - ui.label( - egui::RichText::new(format!("only {}", branch)) - .monospace() - .size(11.0) - .color(egui::Color32::from_rgb(100, 200, 255)), - ); - } else { - ui.label( - egui::RichText::new("only detached HEAD") - .size(11.0) - .color(egui::Color32::from_rgb(255, 150, 50)), - ); - } - } - - if *modify_all_branches { - ui.label( - egui::RichText::new("⚠️") - .size(12.0) - .color(egui::Color32::from_rgb(255, 180, 50)), - ); - ui.label( - egui::RichText::new("Rewrites every branch and tag containing the commit") - .size(10.0) - .color(egui::Color32::from_rgb(255, 180, 50)) - .italics(), - ); - } + ui.horizontal(|ui| { + ui.label(theme::muted(ui, "Rewrite")); + ui.add_enabled_ui(!is_processing, |ui| { + let branch_label = match current_branch { + Some(branch) => format!("current branch ({})", branch), + None => "detached HEAD".to_string(), + }; + ui.radio_value(modify_all_branches, false, branch_label); + ui.radio_value(modify_all_branches, true, "all branches and tags"); }); - ui.add_space(2.0); - } - - if let Some(path) = repo_path { - ui.horizontal(|ui| { - ui.label("πŸ“"); + if *modify_all_branches { ui.label( - egui::RichText::new(format!("{}", path.display())) - .monospace() - .size(11.0) - .color(egui::Color32::GRAY), + RichText::new("⚠ every branch and tag containing the commit changes") + .small() + .color(theme::WARNING), ); - - if commits_count > 0 { - ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - ui.label( - egui::RichText::new(format!("πŸ“Š {} commits", commits_count)) - .size(11.0) - .color(egui::Color32::from_rgb(100, 200, 100)), - ); - }); - } - }); - } - - ui.separator(); - }); + } + }); + } + + if *show_help { + ui.add_space(6.0); + theme::card(ui).show(ui, |ui| { + ui.set_width(ui.available_width()); + ui.label(RichText::new("How to use").strong()); + ui.label("1. Open a Git repository"); + ui.label("2. Select a commit and edit its message"); + ui.label("3. Apply, review the preview and keep or roll back the change"); + ui.add_space(4.0); + ui.label(RichText::new("Good to know").strong()); + ui.label("β€’ Rewriting changes the hashes of the commit and all its descendants"); + ui.label("β€’ Push with git push --force-with-lease, don't rewrite shared branches"); + ui.label("β€’ Original refs are kept until you confirm, rolling back restores them"); + ui.add_space(4.0); + ui.label(theme::muted(ui, "Created by Amin Atabiev").small()); + }); + } + + if show_progress { + ui.add_space(6.0); + ui.add( + egui::ProgressBar::new(progress) + .desired_height(6.0) + .fill(theme::ACCENT) + .animate(true), + ); + } result } diff --git a/src/ui/mod.rs b/src/ui/mod.rs index ab74267..824ccbb 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -3,3 +3,4 @@ pub mod editor_panel; pub mod logs_panel; pub mod main_window; pub mod preview_modal; +pub mod theme; diff --git a/src/ui/preview_modal.rs b/src/ui/preview_modal.rs index 8fcbe7e..deabe1e 100644 --- a/src/ui/preview_modal.rs +++ b/src/ui/preview_modal.rs @@ -1,5 +1,6 @@ use crate::models::{PreviewData, RefChange}; -use eframe::egui; +use crate::ui::theme; +use eframe::egui::{self, RichText}; pub struct PreviewModalResult { pub confirm_clicked: bool, @@ -16,180 +17,121 @@ pub fn render_preview_modal( cancel_clicked: false, }; - egui::Window::new("πŸ” Preview Changes") - .collapsible(false) - .resizable(true) - .default_size([800.0, 600.0]) - .show(ctx, |ui| { - ui.vertical(|ui| { - match &preview_data.details { - Some(details) => { - ui.heading( - egui::RichText::new("Review changes before confirming") - .size(16.0) - .strong(), - ); + let max_width = (ctx.content_rect().width() - 80.0).clamp(320.0, 720.0); - ui.add_space(10.0); - ui.separator(); - ui.add_space(5.0); + egui::Modal::new(egui::Id::new("preview_modal")).show(ctx, |ui| { + ui.set_width(max_width); - ui.horizontal(|ui| { - ui.label("πŸ“Œ Commit:"); - ui.label( - egui::RichText::new(format!( - "{} β†’ {}", - short(&details.old_hash), - short(&details.new_hash) - )) - .monospace() - .size(12.0), - ); - ui.label( - egui::RichText::new(format!( - "({} commits rewritten)", - details.rewritten_commits - )) - .size(11.0) - .color(egui::Color32::GRAY), - ); - }); - - ui.add_space(5.0); - - message_block( - ui, - "❌ Old message:", - egui::Color32::from_rgb(255, 100, 100), - egui::Color32::from_rgb(40, 30, 30), - &details.old_message, - ); - - ui.add_space(5.0); - - message_block( - ui, - "βœ… New message:", - egui::Color32::from_rgb(100, 200, 100), - egui::Color32::from_rgb(30, 40, 30), - &details.new_message, - ); - } - None => { - ui.heading( - egui::RichText::new("Unconfirmed rewrite found") - .size(16.0) - .strong(), - ); - ui.add_space(5.0); - ui.label( - "A previous rewrite in this repository was neither confirmed nor \ - rolled back. Confirm to keep it or cancel to restore the original refs.", - ); - } - } - - ui.add_space(10.0); - ui.separator(); - ui.add_space(5.0); - - ui.label(egui::RichText::new("πŸ“‹ Updated refs:").size(13.0).strong()); - ui.add_space(3.0); - - egui::ScrollArea::vertical() - .max_height(150.0) - .show(ui, |ui| { - for change in &preview_data.ref_changes { - ref_change_row(ui, change); - } - }); + match &preview_data.details { + Some(details) => { + ui.label(RichText::new("Review the rewrite").heading().strong()); + ui.horizontal(|ui| { + theme::chip(ui, theme::short_hash(&details.old_hash), theme::DANGER); + ui.label(RichText::new("β†’").monospace()); + theme::chip(ui, theme::short_hash(&details.new_hash), theme::SUCCESS); + ui.label(theme::muted( + ui, + format!("{} commits rewritten", details.rewritten_commits), + )); + }); - ui.add_space(5.0); + ui.add_space(8.0); + message_block(ui, "Before", theme::DANGER, &details.old_message); + ui.add_space(6.0); + message_block(ui, "After", theme::SUCCESS, &details.new_message); + } + None => { ui.label( - egui::RichText::new( - "Cancel restores the refs above. After confirming, push with \ - git push --force-with-lease.", - ) - .size(11.0) - .color(egui::Color32::GRAY), + RichText::new("Unconfirmed rewrite found") + .heading() + .strong(), ); - - ui.add_space(10.0); - ui.separator(); - ui.add_space(5.0); - - ui.horizontal(|ui| { - ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - let cancel_btn = - egui::Button::new(egui::RichText::new("❌ Cancel Changes").size(14.0)) - .fill(egui::Color32::from_rgb(200, 80, 80)); - - if ui.add_enabled(!is_processing, cancel_btn).clicked() { - result.cancel_clicked = true; - } - - ui.add_space(10.0); - - let confirm_btn = - egui::Button::new(egui::RichText::new("βœ… Confirm Changes").size(14.0)) - .fill(egui::Color32::from_rgb(80, 200, 80)); - - if ui.add_enabled(!is_processing, confirm_btn).clicked() { - result.confirm_clicked = true; - } - }); + ui.label( + "A previous rewrite in this repository was neither kept nor rolled back. \ + Decide what to do with it before making new changes.", + ); + } + } + + ui.add_space(10.0); + ui.label( + RichText::new(format!("Updated refs ({})", preview_data.ref_changes.len())).strong(), + ); + ui.add_space(2.0); + theme::card(ui).inner_margin(8).show(ui, |ui| { + ui.set_width(ui.available_width()); + egui::ScrollArea::vertical() + .id_salt("ref_changes") + .max_height(120.0) + .show(ui, |ui| { + for change in &preview_data.ref_changes { + ref_change_row(ui, change); + } }); + }); + + ui.add_space(8.0); + ui.label( + theme::muted( + ui, + "Roll back restores the refs above. After keeping the changes, push them with \ + git push --force-with-lease.", + ) + .small(), + ); + + ui.add_space(10.0); + ui.horizontal(|ui| { + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + if theme::primary_button(ui, "Keep changes", !is_processing).clicked() { + result.confirm_clicked = true; + } + if ui + .add_enabled(!is_processing, theme::danger_button("Roll back")) + .clicked() + { + result.cancel_clicked = true; + } }); }); + }); result } -fn message_block( - ui: &mut egui::Ui, - title: &str, - title_color: egui::Color32, - fill: egui::Color32, - message: &str, -) { - ui.label( - egui::RichText::new(title) - .size(13.0) - .strong() - .color(title_color), - ); - egui::Frame::NONE - .fill(fill) - .corner_radius(3.0) - .inner_margin(8.0) +fn message_block(ui: &mut egui::Ui, title: &str, color: egui::Color32, message: &str) { + ui.label(RichText::new(title).small().strong().color(color)); + egui::Frame::new() + .fill(color.gamma_multiply(0.08)) + .stroke(egui::Stroke::new(1.0, color.gamma_multiply(0.4))) + .corner_radius(6) + .inner_margin(8) .show(ui, |ui| { + ui.set_width(ui.available_width()); egui::ScrollArea::vertical() .id_salt(title) - .max_height(120.0) + .max_height(110.0) .show(ui, |ui| { - ui.label( - egui::RichText::new(message.trim_end()) - .monospace() - .size(11.0), - ); + ui.add(egui::Label::new(RichText::new(message.trim_end()).monospace()).wrap()); }); }); } fn ref_change_row(ui: &mut egui::Ui, change: &RefChange) { - ui.label( - egui::RichText::new(format!( - "{} {} β†’ {}", - change.name, - short(&change.old_hash), - short(&change.new_hash) - )) - .monospace() - .size(10.0) - .color(egui::Color32::GRAY), - ); -} - -fn short(hash: &str) -> &str { - hash.get(..8).unwrap_or(hash) + ui.horizontal(|ui| { + ui.label(RichText::new(&change.name).monospace()); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + ui.label( + theme::muted( + ui, + format!( + "{} β†’ {}", + theme::short_hash(&change.old_hash), + theme::short_hash(&change.new_hash) + ), + ) + .monospace(), + ); + }); + }); } diff --git a/src/ui/theme.rs b/src/ui/theme.rs new file mode 100644 index 0000000..24ecf22 --- /dev/null +++ b/src/ui/theme.rs @@ -0,0 +1,154 @@ +//! Shared look: spacing, colors and small widget helpers. + +use eframe::egui::{self, Color32, CornerRadius, FontId, RichText, Stroke, TextStyle, Theme}; + +/// Orange from the app icon. +pub const ACCENT: Color32 = Color32::from_rgb(240, 136, 62); +pub const DANGER: Color32 = Color32::from_rgb(220, 90, 90); +pub const SUCCESS: Color32 = Color32::from_rgb(80, 180, 110); +pub const WARNING: Color32 = Color32::from_rgb(230, 170, 50); + +pub const ROW_HEIGHT: f32 = 30.0; +pub const PANEL_MARGIN: i8 = 12; + +pub fn apply(ctx: &egui::Context) { + ctx.set_theme(egui::ThemePreference::System); + + ctx.all_styles_mut(|style| { + style.spacing.item_spacing = egui::vec2(8.0, 6.0); + style.spacing.button_padding = egui::vec2(12.0, 5.0); + style.spacing.interact_size.y = 28.0; + style.spacing.text_edit_width = 240.0; + + style.text_styles = [ + (TextStyle::Heading, FontId::proportional(18.0)), + (TextStyle::Body, FontId::proportional(14.0)), + (TextStyle::Button, FontId::proportional(14.0)), + (TextStyle::Monospace, FontId::monospace(13.0)), + (TextStyle::Small, FontId::proportional(11.5)), + ] + .into(); + + let radius = CornerRadius::same(6); + let widgets = &mut style.visuals.widgets; + for w in [ + &mut widgets.noninteractive, + &mut widgets.inactive, + &mut widgets.hovered, + &mut widgets.active, + &mut widgets.open, + ] { + w.corner_radius = radius; + } + style.visuals.window_corner_radius = CornerRadius::same(10); + style.visuals.selection.stroke = Stroke::new(1.0, ACCENT); + style.visuals.hyperlink_color = ACCENT; + }); + + ctx.style_mut_of(Theme::Dark, |style| { + let v = &mut style.visuals; + v.panel_fill = Color32::from_rgb(30, 31, 34); + v.window_fill = Color32::from_rgb(38, 40, 44); + v.extreme_bg_color = Color32::from_rgb(22, 23, 25); + v.faint_bg_color = Color32::from_rgb(36, 37, 41); + v.selection.bg_fill = Color32::from_rgb(92, 58, 34); + v.widgets.noninteractive.bg_stroke = Stroke::new(1.0, Color32::from_rgb(50, 52, 57)); + }); + + ctx.style_mut_of(Theme::Light, |style| { + let v = &mut style.visuals; + v.panel_fill = Color32::from_rgb(246, 246, 248); + v.window_fill = Color32::WHITE; + v.extreme_bg_color = Color32::WHITE; + v.faint_bg_color = Color32::from_rgb(236, 237, 240); + v.selection.bg_fill = Color32::from_rgb(253, 222, 199); + v.widgets.noninteractive.bg_stroke = Stroke::new(1.0, Color32::from_rgb(222, 223, 228)); + }); +} + +/// Frame for top and bottom panels. +pub fn panel_frame(ui: &egui::Ui) -> egui::Frame { + egui::Frame::side_top_panel(ui.style()) + .inner_margin(egui::Margin::symmetric(PANEL_MARGIN, 10)) + .stroke(ui.visuals().widgets.noninteractive.bg_stroke) +} + +/// Bordered box used to group content inside a panel. +pub fn card(ui: &egui::Ui) -> egui::Frame { + egui::Frame::group(ui.style()) + .fill(ui.visuals().extreme_bg_color) + .inner_margin(10) + .corner_radius(8) +} + +pub fn section_title(text: &str) -> RichText { + RichText::new(text).strong().size(15.0) +} + +pub fn muted(ui: &egui::Ui, text: impl Into) -> RichText { + RichText::new(text).color(ui.visuals().weak_text_color()) +} + +/// Main action of a section: filled with the accent color while enabled. +pub fn primary_button(ui: &mut egui::Ui, text: &str, enabled: bool) -> egui::Response { + let button = if enabled { + egui::Button::new( + RichText::new(text) + .strong() + .color(Color32::from_rgb(30, 20, 12)), + ) + .fill(ACCENT) + } else { + egui::Button::new(RichText::new(text).strong()) + }; + ui.add_enabled(enabled, button.min_size(egui::vec2(0.0, 32.0))) +} + +/// Outlined button for destructive actions. +pub fn danger_button(text: &str) -> egui::Button<'_> { + egui::Button::new(RichText::new(text).color(DANGER)) + .stroke(Stroke::new(1.0, DANGER)) + .fill(Color32::TRANSPARENT) + .min_size(egui::vec2(0.0, 32.0)) +} + +/// Small rounded label, e.g. for the branch name. +pub fn chip(ui: &mut egui::Ui, text: &str, color: Color32) { + egui::Frame::new() + .fill(color.gamma_multiply(0.18)) + .corner_radius(10) + .inner_margin(egui::Margin::symmetric(8, 2)) + .show(ui, |ui| { + ui.label(RichText::new(text).monospace().size(12.0).color(color)); + }); +} + +/// Path for display, with the home directory shown as `~`. +pub fn display_path(path: &std::path::Path) -> String { + let home = std::env::var_os("HOME").or_else(|| std::env::var_os("USERPROFILE")); + if let Some(rest) = home.and_then(|home| path.strip_prefix(home).ok().map(|r| r.to_path_buf())) + { + return std::path::Path::new("~").join(rest).display().to_string(); + } + path.display().to_string() +} + +pub fn short_hash(hash: &str) -> &str { + hash.get(..8).unwrap_or(hash) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_short_hash() { + assert_eq!(short_hash("0123456789abcdef"), "01234567"); + assert_eq!(short_hash("abc"), "abc"); + } + + #[test] + fn test_display_path_outside_home() { + assert_eq!(display_path(std::path::Path::new("/opt/repo")), "/opt/repo"); + } +}