2 Commits

Author SHA1 Message Date
phundrak 827b2a64f7 ci(nix): add archive packages and overhaul CI workflows
Run checks and build archives / build (linux-aarch64) (push) Has been cancelled
Run checks and build archives / build (linux-x86_64) (push) Has been cancelled
Run checks and build archives / build (windows-x86_64) (push) Has been cancelled
Run checks and build archives / coverage-and-sonar (push) Has been cancelled
2026-05-28 21:42:16 +02:00
phundrak 691d6c701d feat(nix): simplify flake.nix, remove devenv 2026-05-28 21:42:16 +02:00
26 changed files with 299 additions and 1212 deletions
-32
View File
@@ -1,35 +1,3 @@
## [1.1.0] - 2026-06-14
### Features
- *(errors)* Preserve jj-emitted errors when loading config
- *(cli)* Add jj-lib version to version output
- *(nix)* Simplify flake.nix, remove devenv
- Implement --new flag
- *(references)* Add ticket reference footers
### Bug Fixes
- *(scope)* No new string allocation to count characters
### Refactor
- *(nix)* Simplify package declaration
- *(workflow)* Remove unnecessary async declarations
- *(BreakingChange)* Rename method ignore to is_absent
- *(prompter)* Simplify commit type selection
### Documentation
- *(contributing)* Clarifying and expanding AI requirements
- *(README)* Update the README to reflect new features
### Miscellaneous Tasks
- *(jj-lib)* Upgrade to jj-lib 0.40.0
- *(nix)* Add archive packages and overhaul CI workflows
- *(nix)* Temporary use of cargoHash instead of cargoLock.lockFile
- *(nix)* Dont put a zip in a zip
## [1.0.0] - 2026-03-25
### Features
Generated
+238 -82
View File
@@ -151,9 +151,9 @@ checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1"
[[package]]
name = "bitflags"
version = "2.13.0"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
[[package]]
name = "blake2"
@@ -216,9 +216,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.63"
version = "1.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f"
checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98"
dependencies = [
"find-msvc-tools",
"shlex",
@@ -243,9 +243,9 @@ dependencies = [
[[package]]
name = "chrono"
version = "0.4.45"
version = "0.4.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0"
dependencies = [
"iana-time-zone",
"js-sys",
@@ -740,27 +740,30 @@ dependencies = [
[[package]]
name = "git-conventional"
version = "1.1.0"
version = "0.12.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7079e0e98895b810e042ef90b667d8d0a28c172fb3212e777b2d279ec2b29f25"
checksum = "f6a949b7fcc81df22526032dcddb006e78c8575e47b0e7ba57d9960570a57bc4"
dependencies = [
"unicase",
"winnow 1.0.3",
"winnow 0.7.15",
]
[[package]]
name = "gix"
version = "0.84.0"
version = "0.83.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae54ae0ebd1a5a3c3f8d95dd3b5ca6e63f4fed9bfd585e13801a97d7bde8f9ce"
checksum = "6ce52001b946a6249d5d0d3011df0a042ac3f8a4d013460db6476577b0b9c567"
dependencies = [
"gix-actor",
"gix-archive",
"gix-attributes",
"gix-blame",
"gix-command",
"gix-commitgraph",
"gix-config",
"gix-date",
"gix-diff",
"gix-dir",
"gix-discover",
"gix-error",
"gix-features",
@@ -772,6 +775,8 @@ dependencies = [
"gix-ignore",
"gix-index",
"gix-lock",
"gix-merge",
"gix-negotiate",
"gix-object",
"gix-odb",
"gix-pack",
@@ -784,6 +789,7 @@ dependencies = [
"gix-revwalk",
"gix-sec",
"gix-shallow",
"gix-status",
"gix-submodule",
"gix-tempfile",
"gix-trace",
@@ -792,6 +798,7 @@ dependencies = [
"gix-utils",
"gix-validate",
"gix-worktree",
"gix-worktree-state",
"gix-worktree-stream",
"nonempty",
"smallvec",
@@ -809,6 +816,19 @@ dependencies = [
"gix-error",
]
[[package]]
name = "gix-archive"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a20ec244b733338d4cb60e5e05eac700dab7fcc689647b1d1daa9396b119342"
dependencies = [
"bstr",
"gix-date",
"gix-error",
"gix-object",
"gix-worktree-stream",
]
[[package]]
name = "gix-attributes"
version = "0.33.1"
@@ -835,6 +855,26 @@ dependencies = [
"gix-error",
]
[[package]]
name = "gix-blame"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14dab9a942ab54a9661ded7397c3bf927274e7afa94494db0d75cfcbde02ca0a"
dependencies = [
"gix-commitgraph",
"gix-date",
"gix-diff",
"gix-error",
"gix-hash",
"gix-object",
"gix-revwalk",
"gix-trace",
"gix-traverse",
"gix-worktree",
"smallvec",
"thiserror",
]
[[package]]
name = "gix-chunk"
version = "0.7.2"
@@ -873,9 +913,9 @@ dependencies = [
[[package]]
name = "gix-config"
version = "0.57.0"
version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f2372d4b49ca28431e7d150cab9d25edc1890f0184bd57eb0e917c7799e63de"
checksum = "8c01848aebd21c67f6ba41f1de8efd46ae96df21f001954a3c9e1517e514d410"
dependencies = [
"bstr",
"gix-config-value",
@@ -916,9 +956,9 @@ dependencies = [
[[package]]
name = "gix-diff"
version = "0.64.0"
version = "0.63.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b6d9528f32d94cef2edf39a1ac01fe5a0fc44ddbb18d9e44099936047c3302b"
checksum = "dc08e0fa1a91ff5f24affeab052f198056645e1de004910bde7b82b50ea5982a"
dependencies = [
"bstr",
"gix-command",
@@ -936,10 +976,30 @@ dependencies = [
]
[[package]]
name = "gix-discover"
version = "0.52.0"
name = "gix-dir"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77bacdd12b7879d2178a80c58c2f319995e4654e1a7a23e3181e5c8a12b824f7"
checksum = "32a0fc06e9e1e430cbf0a313666976d90f822f461a6525320427aa9b8af5236c"
dependencies = [
"bstr",
"gix-discover",
"gix-fs",
"gix-ignore",
"gix-index",
"gix-object",
"gix-path",
"gix-pathspec",
"gix-trace",
"gix-utils",
"gix-worktree",
"thiserror",
]
[[package]]
name = "gix-discover"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17852e6a501e688a1702b24ebe5b3761d4719455bc869fd29f38b0b859bcad34"
dependencies = [
"bstr",
"dunce",
@@ -982,9 +1042,9 @@ dependencies = [
[[package]]
name = "gix-filter"
version = "0.31.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecf74b7d16f6694ce4a3049074c41be0c7987105743674f1671807bd6dce09fa"
checksum = "dac917dbe9653c9b615d248db91907a365bd779750c9e1b457a9d9fdeece3a08"
dependencies = [
"bstr",
"encoding_rs",
@@ -1075,9 +1135,9 @@ dependencies = [
[[package]]
name = "gix-index"
version = "0.52.0"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e6b28cc592dc753adb58302bb14a64e412ee591a3bec77aa4df87bff74fa80d"
checksum = "54c3ef97ad08121e4327a6226bd63fed6b9e3c6b976d48bddd4356d9d41191db"
dependencies = [
"bitflags",
"bstr",
@@ -1092,7 +1152,7 @@ dependencies = [
"gix-traverse",
"gix-utils",
"gix-validate",
"hashbrown 0.17.1",
"hashbrown 0.16.1",
"itoa",
"libc",
"memmap2",
@@ -1113,10 +1173,50 @@ dependencies = [
]
[[package]]
name = "gix-object"
version = "0.61.0"
name = "gix-merge"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5cd857e29429c7213bdef3f5aef83f8cc124774fe8ae0d27b1607d218d6d525"
checksum = "74bbcdcc52b70a32f0a151b024dff9d0fcf56ee48f00d9503e735af9d99ea881"
dependencies = [
"bstr",
"gix-command",
"gix-diff",
"gix-filter",
"gix-fs",
"gix-hash",
"gix-imara-diff",
"gix-index",
"gix-object",
"gix-path",
"gix-quote",
"gix-revision",
"gix-revwalk",
"gix-tempfile",
"gix-trace",
"gix-worktree",
"nonempty",
"thiserror",
]
[[package]]
name = "gix-negotiate"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "103d42bfade1b8a96ca5005933127bdad461ce588d92422b2c2daa3ff20d780c"
dependencies = [
"bitflags",
"gix-commitgraph",
"gix-date",
"gix-hash",
"gix-object",
"gix-revwalk",
]
[[package]]
name = "gix-object"
version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a38075a95d7cc5df8afd38e72c617026c1456952207a4120a7f55a3fbf93b4d7"
dependencies = [
"bstr",
"gix-actor",
@@ -1133,9 +1233,9 @@ dependencies = [
[[package]]
name = "gix-odb"
version = "0.81.0"
version = "0.80.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d004c32858b1556f2d7874405edb3c97dc78fc09beaa87d57bb077ee2858a7d"
checksum = "aeeda12a9663120418735ecdc1250d06eeab0be75700e47b3402a981331716ba"
dependencies = [
"arc-swap",
"gix-features",
@@ -1154,9 +1254,9 @@ dependencies = [
[[package]]
name = "gix-pack"
version = "0.71.0"
version = "0.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e43626f2a27d1033674ec1a196b845614231e6bbd949d5e21c133045ff56b174"
checksum = "daf02e6f5c8f07a069c9ea5245f40d9b14856ada4086091dc99941b49002b4fa"
dependencies = [
"clru",
"gix-chunk",
@@ -1213,9 +1313,9 @@ dependencies = [
[[package]]
name = "gix-protocol"
version = "0.62.0"
version = "0.61.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51dea3acb390707ab868f1f9584f18449eb95d869deffae96768e47d303595ee"
checksum = "aa4bee82db63ec635996b96efae71cf467c155fa3f34a556184373224a26c4fd"
dependencies = [
"bstr",
"gix-date",
@@ -1243,9 +1343,9 @@ dependencies = [
[[package]]
name = "gix-ref"
version = "0.64.0"
version = "0.63.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c04f64c37eb7e6feb73c7060f8dc6f381cc5de5d53249bfd450bc48a86b2e8b"
checksum = "d8ba9cc15f558b274c99349b83130f5ec83459660828fde9718bbbb43a726167"
dependencies = [
"gix-actor",
"gix-features",
@@ -1263,9 +1363,9 @@ dependencies = [
[[package]]
name = "gix-refspec"
version = "0.42.0"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b216ae06ec74b5f24ad0142026a997fb0a935b7410eaf9c1616fc3f0e6c5a6d3"
checksum = "61755b27d57edc8940a1b1593c8c61548ca8e4c02da1ed8d5bfeda9eb2a6b761"
dependencies = [
"bstr",
"gix-error",
@@ -1279,10 +1379,11 @@ dependencies = [
[[package]]
name = "gix-revision"
version = "0.46.0"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b47c88884dd3c1a19a39da19d10211fcdea2809aadc86869b6e824a1774340f"
checksum = "1fb5288fac706d3ea3e4e2ba9ec38b78743b8c02f422e18cb342299cfd6ab7e8"
dependencies = [
"bitflags",
"bstr",
"gix-commitgraph",
"gix-date",
@@ -1290,14 +1391,15 @@ dependencies = [
"gix-hash",
"gix-object",
"gix-revwalk",
"gix-trace",
"nonempty",
]
[[package]]
name = "gix-revwalk"
version = "0.32.0"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85f5756abffe0917827aac683b13684ed99875bc398fa1f9b8f479b0681ef9e6"
checksum = "313813706b073a12ff7f9b2896bf3e6504cdac7cfbc97b1920114724705069f0"
dependencies = [
"gix-commitgraph",
"gix-date",
@@ -1335,10 +1437,33 @@ dependencies = [
]
[[package]]
name = "gix-submodule"
version = "0.31.0"
name = "gix-status"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3059890ef054066c22a94bfc6a3eaba0d806aedcd630a0bc9e5783fd88884781"
checksum = "68c6d2a8c521ffa205fe7e268c82e6d1378ba37cd826ca10ab6129fdc29a4b65"
dependencies = [
"bstr",
"filetime",
"gix-diff",
"gix-dir",
"gix-features",
"gix-filter",
"gix-fs",
"gix-hash",
"gix-index",
"gix-object",
"gix-path",
"gix-pathspec",
"gix-worktree",
"portable-atomic",
"thiserror",
]
[[package]]
name = "gix-submodule"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fd5fc8692890bd71a596e540fd4c364f8460eaa82c4eaaedebde6e1e3eb4d91"
dependencies = [
"bstr",
"gix-config",
@@ -1386,9 +1511,9 @@ dependencies = [
[[package]]
name = "gix-traverse"
version = "0.58.0"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8de590ecc86a3b2870665f2288324fa9f7f8672c7fc2d4e020fdd81cd1f7aed"
checksum = "a14b7052c0786676c03e71fcfde7d7f0f8e8316e642b5cec6bb3998719b2ce5c"
dependencies = [
"bitflags",
"gix-commitgraph",
@@ -1419,6 +1544,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66c50966184123caf580ffa64e28031a878597f1c7fceb8fe19566c38eb1b771"
dependencies = [
"bstr",
"fastrand",
"unicode-normalization",
]
@@ -1434,9 +1560,9 @@ dependencies = [
[[package]]
name = "gix-worktree"
version = "0.53.0"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cef414ed275e8407cd5d53d301e83be19700b0dd3f859d2434417b58f454a2d1"
checksum = "d69955eb5e2910832f88d041964b809eee01dadd579237e0b55efec58fd406fd"
dependencies = [
"bstr",
"gix-attributes",
@@ -1451,10 +1577,28 @@ dependencies = [
]
[[package]]
name = "gix-worktree-stream"
version = "0.33.0"
name = "gix-worktree-state"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25e9ed30100c63f7590bc581c225e53f731a53e06aa79a245739c07f7dcc557"
checksum = "8a96dccbcf9e8fe0291c55f06e08da93ebb2e691c1311276f541eefcc6d70800"
dependencies = [
"bstr",
"gix-features",
"gix-filter",
"gix-fs",
"gix-index",
"gix-object",
"gix-path",
"gix-worktree",
"io-close",
"thiserror",
]
[[package]]
name = "gix-worktree-stream"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8444b8ed4662e1a0c97f3eceda29630001a1bbb2632201e50312623e594213"
dependencies = [
"gix-attributes",
"gix-error",
@@ -1533,8 +1677,6 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash 0.2.0",
]
@@ -1689,9 +1831,9 @@ dependencies = [
[[package]]
name = "ignore"
version = "0.4.26"
version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b915661dd01db3f05050265b2477bcc6527b3792388e2749b41623cc592be67d"
checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a"
dependencies = [
"crossbeam-deque",
"globset",
@@ -1740,6 +1882,16 @@ dependencies = [
"logos",
]
[[package]]
name = "io-close"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cadcf447f06744f8ce713d2d6239bb5bde2c357a452397a9ed90c625da390bc"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.2"
@@ -1763,9 +1915,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "jiff"
version = "0.2.28"
version = "0.2.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4603d3033e49e2b0e31229fcab20a5d40089c607d975cd9c80551dc69eed9102"
checksum = "392c70591e8749fe235ddaf513e6f58b26bce3dcc16524cecc8936f75afa161e"
dependencies = [
"jiff-static",
"jiff-tzdb-platform",
@@ -1778,9 +1930,9 @@ dependencies = [
[[package]]
name = "jiff-static"
version = "0.2.28"
version = "0.2.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "782d32378dddf207193ac91cefb848ad41abb58195c95168e1291227a0832b47"
checksum = "47b605b0c050d845fc355bb11eb3f9a8deddc218ea60c76e61aa1f2adfb2c96a"
dependencies = [
"proc-macro2",
"quote",
@@ -1804,7 +1956,7 @@ dependencies = [
[[package]]
name = "jj-cz"
version = "1.1.1-dev"
version = "1.0.1-dev"
dependencies = [
"assert_cmd",
"assert_fs",
@@ -1813,7 +1965,6 @@ dependencies = [
"chrono",
"clap",
"etcetera",
"futures-util",
"git-conventional",
"inquire",
"jj-lib",
@@ -1827,9 +1978,9 @@ dependencies = [
[[package]]
name = "jj-lib"
version = "0.42.0"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d1647b1f02e5dee29a8c1c7946aab2cc9b1aa830c492c118886103fde8892a9"
checksum = "39b88d4463d0f0d5542b5b746cd0c3c3fa69d7fdbdfbe45e22bdb737fc47fa53"
dependencies = [
"async-trait",
"blake2",
@@ -1867,6 +2018,7 @@ dependencies = [
"strsim",
"tempfile",
"thiserror",
"tokio",
"toml_edit",
"tracing",
"winreg",
@@ -1874,9 +2026,9 @@ dependencies = [
[[package]]
name = "jj-lib-proc-macros"
version = "0.42.0"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9025afcb9fb06cb7b81ebb19764a3f76d0ad0e442632227ce242c519de540df"
checksum = "a57bb4bbead2b2c6087d1b403e83b962d9da17a7c838aecc93646fcd047c29e4"
dependencies = [
"proc-macro2",
"quote",
@@ -1975,9 +2127,9 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.32"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a"
checksum = "616ec5685824bcc94416c6d4a7a446eea774a31efd7062c8480ba6fd06d7a6e5"
[[package]]
name = "logos"
@@ -2267,9 +2419,9 @@ dependencies = [
[[package]]
name = "prost"
version = "0.14.4"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1"
checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568"
dependencies = [
"bytes",
"prost-derive",
@@ -2277,9 +2429,9 @@ dependencies = [
[[package]]
name = "prost-derive"
version = "0.14.4"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf"
checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b"
dependencies = [
"anyhow",
"itertools",
@@ -2559,9 +2711,9 @@ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
[[package]]
name = "shlex"
version = "2.0.1"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "signal-hook"
@@ -2751,6 +2903,7 @@ version = "1.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe"
dependencies = [
"bytes",
"pin-project-lite",
"tokio-macros",
]
@@ -2862,9 +3015,9 @@ dependencies = [
[[package]]
name = "typenum"
version = "1.20.1"
version = "1.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
[[package]]
name = "ucd-trie"
@@ -2916,9 +3069,9 @@ dependencies = [
[[package]]
name = "unicode-segmentation"
version = "1.13.3"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c"
[[package]]
name = "unicode-width"
@@ -3188,6 +3341,9 @@ name = "winnow"
version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
dependencies = [
"memchr",
]
[[package]]
name = "winnow"
@@ -3310,9 +3466,9 @@ checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
[[package]]
name = "yoke"
version = "0.8.3"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
dependencies = [
"stable_deref_trait",
"yoke-derive",
@@ -3333,18 +3489,18 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.8.50"
version = "0.8.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b065d4f0e55f82fae73202e189638116a87c55ab6b8e6c2721e13dd9d854ad1"
checksum = "bce33a6288fa3f072a8c2c7d0f2fdbb90e28298f0135c1f99b96c3db2efcc60b"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.50"
version = "0.8.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b631b19d36a892ab55420c92dbc83ccd79274f25be714855d3074aa71cab639"
checksum = "8fd425244944f4ab65ccff928e7323354c5a018c75838362fdce749dfad2ee1e"
dependencies = [
"proc-macro2",
"quote",
+11 -12
View File
@@ -1,6 +1,6 @@
[package]
name = "jj-cz"
version = "1.1.1-dev"
version = "1.0.1-dev"
description = "Conventional commits for Jujutsu"
edition = "2024"
publish = true
@@ -24,22 +24,21 @@ test-utils = []
[dependencies]
async-trait = "0.1.89"
etcetera = "0.11.0"
clap = { version = "4.6.1", features = ["derive"] }
git-conventional = "1.1.0"
inquire = { version = "0.9.4", features = ["editor"] }
jj-lib = "0.42.0"
lazy-regex = { version = "3.6.0", features = ["lite"] }
clap = { version = "4.5.57", features = ["derive"] }
git-conventional = "0.12.9"
inquire = { version = "0.9.2", features = ["editor"] }
jj-lib = "0.41.0"
lazy-regex = { version = "3.5.1", features = ["lite"] }
thiserror = "2.0.18"
tokio = { version = "1.52.3", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
textwrap = "0.16.2"
unicode-width = "0.2.2"
chrono = "0.4.45"
futures-util = "0.3.32"
chrono = "0.4.44"
[dev-dependencies]
assert_cmd = "2.2.2"
assert_fs = "1.1.4"
predicates = "3.1.4"
assert_cmd = "2.1.2"
assert_fs = "1.1.3"
predicates = "3.1.3"
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] }
+7 -77
View File
@@ -1,45 +1,13 @@
---
include_toc: true
gitea: none
---
# jj-cz: Conventional Commits for Jujutsu
<h1 align="center">jj-cz: Conventional Commits for Jujutsu</h1>
<div align="center">
<strong>
An interactive CLI tool that guides Jujutsu users through creating <a href="https://www.conventionalcommits.org/" rel="noopener">conventional commit</a> messages.
</strong>
</div>
<br/>
<div align="center">
<!-- CI -->
<a href="https://labs.phundrak.com/phundrak/jj-cz/actions?workflow=action.yml&branch=develop">
<img src="https://labs.phundrak.com/phundrak/jj-cz/actions/workflows/action.yml/badge.svg?branch=develop" alt="actions status" />
</a>
<!-- Crates.io -->
<a href="https://crates.io/crates/sqlx">
<img src="https://img.shields.io/crates/v/jj-cz.svg" alt="Crates.io version"/>
</a>
<!-- License -->
<a href="#license">
<img src="https://img.shields.io/badge/License-MIT-blue" alt="MIT License" />
</a>
<a href="#license">
<img src="https://img.shields.io/badge/License-GPL--3.0--or--later-blue" alt="GPL License" />
</a>
<!-- Tools -->
<a href="https://www.gnu.org/software/emacs/" target="_blank">
<img src="https://img.shields.io/badge/Made%20with-GNU%2FEmacs-blueviolet.svg?logo=GNU%20Emacs&logoColor=white" alt="Made with GNU/Emacs" />
</a>
</div>
[![demo](assets/demo.gif)](assets/demo.cast)
An interactive CLI tool that guides Jujutsu users through creating
[conventional commit](https://www.conventionalcommits.org/) messages.
## Features
- Interactive prompts for type, scope, breaking changes, ticket references, and description
- All 11 commit types with descriptions (feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert)
- Interactive prompts for type, scope, and description
- All 11 commit types with descriptions (feat, fix, docs, style,
refactor, perf, test, build, ci, chore, revert)
- Optional scope with validation
- 72-character first-line limit enforcement
- Preview before applying
@@ -60,23 +28,12 @@ You can also set the revision message of a few revisions at once, or
target a single revision other than the current one.
```sh
jj-cz @- xs develop # assuming the revision xs and the bookmark develop exist
jj-cz @- xs develop
```
No explicit revision is simply the equivalent of `jj-cz @`, like
`jj desc`.
If you want to create a new revision after calling `jj-cz` on a single
revision, you can use the `-n` or `--new` flag.
```sh
jj-cz -n # equivalent of `jj-cz && jj new`
jj-cz xs -n # equivalent of `jj-cz xs && jj new xs`
jj-cz -n xs # equivalent of `jj-cz xs && jj new xs`
```
You cannot, however, call `jj-cz` on multiple revisions with the `--new` flag active.
## Requirements
- A Jujutsu repository
@@ -136,30 +93,3 @@ Just make sure Rust is available on your machine (duh!).
```sh
cargo install --path .
```
## Tips and questions
### Running `jj cz` instead of `jj-cz`
I do not actually use `jj-cz`, but `jj cz`. I just find it more
natural to treat it as its own jj subcommand. To achieve that, you can
simply add an alias to your jujutsu configuration.
```toml
[aliases]
cz = ["utils", "exec", "--", "jj-cz"]
```
### `$EDITOR` and editing the revisions body message
`jj-cz` relies on your `$EDITOR` variable to open a temporary file in
which youll write the body of your commit. This body does not include
some footers `jj-cz` may include by itself, such as the breaking
change footer.
In some cases, you may not notice a new editor open. In this case,
check whether you already have an editor open, the file might be
there. In my case, if I already have an open Emacsclient, it will open
there.
## License
This project is licensed under either the [MIT](LICENSE.MIT.md) or [GPL-3.0](LICENSE.GPL.md) licenses, as you prefer.
-190
View File
@@ -1,190 +0,0 @@
{"version":3,"term":{"cols":120,"rows":18,"type":"screen-256color","version":"tmux 3.6a","theme":{"fg":"#d8dee9","bg":"#2e3440","palette":"#3b4252:#bf616a:#a3be8c:#ebcb8b:#81a1c1:#b48ead:#88c0d0:#e5e9f0:#4c566a:#bf616a:#a3be8c:#d08770:#5e81ac:#b48ead:#8fbcbb:#eceff4"}},"timestamp":1781441421,"env":{"SHELL":"bash --norc"}}
[0.003, "o", "bash-5.3$ "]
[2.269, "o", "j"]
[0.149, "o", "j"]
[0.256, "o", " "]
[0.075, "o", "s"]
[0.120, "o", "h"]
[0.149, "o", "o"]
[0.135, "o", "w"]
[0.225, "o", "\r\n"]
[0.079, "o", "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\u001b[?2004h\u001b[>4;2m"]
[0.001, "o", "\u001b[?25l\u001b[HCommit ID: \u001b[34mb6890ed4d3c203026c4b6c349c61c918486732e4\u001b[39m\u001b[K\u001b[2;1HChange ID: \u001b[35mymmvxvqykryrsxmnxzttymztwtkpltqz\u001b[39m\u001b[K\u001b[3;1HAuthor : \u001b[33mLucien Cartier-Tilet\u001b[39m <\u001b[33mlucien@phundrak.com\u001b[39m> (\u001b[36m2026-06-14 14:31:57\u001b[39m)\u001b[K\u001b[4;1HCommitter: \u001b[33mLucien Cartier-Tilet\u001b[39m <\u001b[33mlucien@phundrak.com\u001b[39m> (\u001b[36m2026-06-14 14:50:24\u001b[39m)\u001b[K\u001b[5;1HSignature: \u001b[32mgood\u001b[39m signature by \u001b[33mlucien@phundrak.com\u001b[39m \u001b[36mSHA256:CE0HPsbW3L2YiJETx1zYZ2muMptaAqTN2g3498KrMkc\u001b[39m\u001b[K\u001b[6;1H\u001b[K\u001b[7;1H\u001b[33m (no description set)\u001b[39m\u001b[K\u001b[8;1H\u001b[K\u001b[9;1H\u001b[33mModified regular file README.md:\u001b[39m\u001b[K\u001b[10;1H ...\u001b[K\u001b[11;1H\u001b[0;2m\u000f\u001b[31m 3\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 3\u001b[0m\u000f: An interactive CLI tool that guides Jujutsu users through creating\u001b[K\u001b[12;1H\u001b[0;2m\u000f\u001b[31m 4\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 4\u001b[0m\u000f: [conventional commit](https://www.conventionalcommits.org/) messages.\u001b[K\u001b[13;1H\u001b[0;2m\u000f\u001b[31m 5\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 5\u001b[0m\u000f: \u001b[K\u001b[14;1H \u001b[32m 6\u001b[39m: \u001b[0;4m\u000f\u001b[32m[![asciicast](assets/demo.cast)](assets/demo.cast)\u001b[0m\u000f\u001b[K\u001b[15;1H \u001b[32m 7\u001b[39m: \u001b[K\u001b[16;1H\u001b[0;2m\u000f\u001b[31m 6\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 8\u001b[0m\u000f: ## Features\u001b[K\u001b[17;1H\u001b[0;2m\u000f\u001b[31m 7\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 9\u001b[0m\u000f: \u001b[K\u001b[18;1H\u001b[30m\u001b[47m wrap lines 1- 17/ 84 \u001b[39m\u001b[K\r\u001b[49m"]
[1.270, "o", "\u001b[34h\u001b[?25h\u001b[1;18r\u001b[18;1H\u001b[J\u001b[34h\u001b[?25h\u001b[?2004l\u001b[>4;0m"]
[0.002, "o", "bash-5.3$ "]
[0.403, "o", "j"]
[0.137, "o", "j"]
[0.284, "o", " "]
[0.584, "o", "\b \b"]
[0.046, "o", "-"]
[0.360, "o", "c"]
[0.089, "o", "z"]
[0.316, "o", "\r\n"]
[0.027, "o", "\u001b[?2004h"]
[0.000, "o", "\u001b[?25l\u001b[38;5;10m?\u001b[39m Select commit type: \r\n\u001b[38;5;14m>\u001b["]
[0.000, "o", "39m \u001b[38;5;14"]
[0.000, "o", "m"]
[0.000, "o", "feat\u001b[39m\r\n\u001b[38;5;14m \u001b[39m fix\r\n\u001b[38;5;14m \u001b[39m"]
[0.000, "o", " docs\r\n\u001b["]
[0.000, "o", "38;5;14m \u001b[39m style\r\n\u001b[38;5;14m "]
[0.000, "o", "\u001b[39m refactor\r\n\u001b[38;5;14m \u001b[39m perf"]
[0.000, "o", "\r\n\u001b["]
[0.000, "o", "38;5;14m "]
[0.000, "o", "\u001b[39m test"]
[0.000, "o", "\r\n\u001b[38;"]
[0.000, "o", "5;14m"]
[0.000, "o", " \u001b[39m build\r"]
[0.000, "o", "\n\u001b[38;5;14"]
[0.000, "o", "m \u001b["]
[0.000, "o", "39m"]
[0.000, "o", " ci\r"]
[0.000, "o", "\n"]
[0.000, "o", "\u001b[38;5;14m \u001b[39"]
[0.000, "o", "m "]
[0.000, "o", "chore"]
[0.000, "o", "\r\n\u001b["]
[0.000, "o", "38;5;14m"]
[0.000, "o", " \u001b["]
[0.000, "o", "39m revert\r"]
[0.000, "o", "\n\u001b[38;5;14m"]
[0.000, "o", "["]
[0.000, "o", "\u001b[39"]
[0.000, "o", "m\u001b["]
[0.000, "o", "38;5;14mUse arrow keys to navigate, Enter to select. See https://www.conventionalcommits.org/ for details.\u001b[39m\u001b[38;"]
[0.000, "o", "5;14m]\u001b[39"]
[0.000, "o", "m\r\u001b[12"]
[0.000, "o", "A\u001b[22"]
[0.000, "o", "C\u001b[?25h"]
[0.377, "o", "\u001b[?25l\u001b[22D\u001b[38;5;10m?\u001b[39m Select commit type: d \u001b[K\r\n\u001b[38;5;14m>\u001b[39m \u001b[38;5;14mdocs\u001b[39m\u001b[K"]
[0.000, "o", "\r\n\u001b[38;5;14m \u001b[39m build\u001b[K\r\n\u001b[38;5;14m[\u001b[39m\u001b[38;5;14mUse arrow keys to navigate, Enter to select. See https://www.conventionalcommits.org/ for details."]
[0.000, "o", "\u001b[39m\u001b[38;5;14m]\u001b[39m\u001b[K\r"]
[0.000, "o", "\n\u001b[2K\r\n\u001b[2K\r\n\u001b[2K\r\n\u001b[2K\r\n"]
[0.000, "o", "\u001b[2K\r\n\u001b[2K"]
[0.000, "o", "\r\n\u001b[2K\r\n\u001b[2K"]
[0.000, "o", "\r\n"]
[0.000, "o", "\u001b[2K\r\u001b["]
[0.000, "o", "12A\u001b[23"]
[0.000, "o", "C\u001b[?25h"]
[0.091, "o", "\u001b[?25l\u001b[23D\u001b[38;5;10m?\u001b[39m Select commit type: do \u001b[K\r\n\r\n\u001b[38;5;14m[\u001b[39m\u001b[38;5;14mUse arrow keys to navigate, Enter to select. See https://www.conventionalcommits.org/ for details.\u001b[39m\u001b[38;5;14m]\u001b[39m\u001b[K\r\n"]
[0.000, "o", "\u001b[2K\r\u001b[3A\u001b[24C\u001b[?25h"]
[0.119, "o", "\u001b[?25l\u001b[24D\u001b[38;5;10m?\u001b[39m Select commit type: doc \u001b[K\r\n\r\n\r\u001b[2A\u001b[25C\u001b[?25h"]
[0.391, "o", "\u001b[?25l\u001b[25D\u001b[38;5;10m>\u001b[39m Select commit type: \u001b[38;5;14mdocs: Documentation only changes\u001b[39m\u001b[K\r\n\u001b[2K\r\n\u001b[2K\r\n\u001b[?25h"]
[0.000, "o", "\u001b[2A\u001b[?25h\u001b[?2004l\u001b[?2004h"]
[0.000, "o", "\u001b[?25l\u001b[38;5;10m?\u001b[39m Enter scope (optional): \u001b[38;"]
[0.000, "o", "5;8mLeave empty if no scope\u001b[39"]
[0.000, "o", "m \r\n\u001b[38;5;14m[\u001b[39m\u001b[38;5;14mScope is optional. If provided, it should be a noun representing the section of code affected (e.g., 'api', 'ui', 'conf\u001b[39m"]
[0.000, "o", "\r\n"]
[0.000, "o", "\u001b[38;5;14mig'). Max 30 characters.\u001b["]
[0.000, "o", "39m"]
[0.000, "o", "\u001b[38;5;14m]\u001b[39m\r\u001b["]
[0.000, "o", "2A\u001b["]
[0.000, "o", "26C\u001b[?25h"]
[1.140, "o", "\u001b[?25l\u001b[26D\u001b[38;5;10m?\u001b[39"]
[0.000, "o", "m Enter scope (optional): R \u001b[K\r\n\r\n\r\u001b[2A\u001b[27C\u001b[?25h"]
[0.000, "o", "\u001b[?25l\u001b[27D\u001b[38;5;10m?\u001b[39m Enter scope (optional): RE \u001b[K\r\n\r\n\r\u001b["]
[0.000, "o", "2A\u001b[28C\u001b[?25h"]
[0.076, "o", "\u001b[?25l\u001b[28D\u001b[38;5;10m?\u001b[39m Enter scope (optional): REA \u001b[K\r\n\r\n\r\u001b[2A\u001b[29C\u001b[?25h"]
[0.089, "o", "\u001b[?25l\u001b[29D\u001b[38;5;10m?\u001b[39m Enter scope (optional): READ \u001b[K\r\n\r\n\r\u001b[2A\u001b[30C\u001b[?25h"]
[0.090, "o", "\u001b[?25l\u001b[30D\u001b[38;5;10m?\u001b[39m Enter scope (optional): READM \u001b[K\r\n\r\n\r\u001b[2A\u001b[31C\u001b[?25h"]
[0.272, "o", "\u001b[?25l\u001b[31D\u001b[38;5;10m?\u001b[39m Enter scope (optional): README \u001b[K\r\n\r\n\r\u001b[2A\u001b[32C\u001b[?25h"]
[0.748, "o", "\u001b[?25l\u001b[32D\u001b[38;5;10m>\u001b[39m Enter scope (optional): \u001b[38;5;14mREADME\u001b[39m\u001b[K\r\n\u001b[2K\r\n\u001b[2K\r\n\u001b[?25h\u001b[2A\u001b[?25h\u001b[?2004l"]
[0.000, "o", "\u001b[?2004h"]
[0.000, "o", "\u001b[?25l\u001b[38;5;10m?\u001b[39m Enter description (required): \r\n\u001b[38;5;14"]
[0.001, "o", "m[\u001b[39m\u001b[38;5;14mDescription is required. Short summary in imperative mood (e.g., 'add feature', 'fix bug'). Soft limit: 50 characters.\u001b[39m\u001b[38;5;14m]\u001b[39m\r\u001b[1A\u001b[32C\u001b[?25h"]
[1.229, "o", "\u001b[?25l\u001b[32D\u001b[38;5;10m?\u001b[39m Enter description (required): u \u001b[K\r\n\r\u001b[1A\u001b[33C\u001b[?25h"]
[0.090, "o", "\u001b[?25l\u001b[33D\u001b[38;5;10m?\u001b[39m Enter description (required): up \u001b[K\r\n\r\u001b[1A\u001b[34C\u001b[?25h"]
[0.076, "o", "\u001b[?25l\u001b[34D\u001b[38;5;10m"]
[0.000, "o", "?\u001b[39m Enter description (required): upd \u001b[K\r\n\r\u001b[1A\u001b[35C\u001b[?25h"]
[0.134, "o", "\u001b[?25l\u001b[35D\u001b[38;5;10m?\u001b[39m Enter description (required): upda \u001b[K\r\n\r\u001b[1A\u001b[36C\u001b[?25h"]
[0.075, "o", "\u001b[?25l\u001b[36D\u001b[38;5;10m?\u001b[39m Enter description (required): updat \u001b[K\r\n\r\u001b[1A\u001b[37C\u001b[?25h"]
[0.225, "o", "\u001b[?25l\u001b[37D\u001b[38;5;10m?\u001b[39m Enter description (required): update \u001b[K\r\n\r\u001b[1A\u001b[38C\u001b[?25h"]
[0.090, "o", "\u001b[?25l\u001b[38D\u001b[38;5;10m?\u001b[39m Enter description (required): update \u001b[K\r\n\r\u001b[1A\u001b[39C\u001b[?25h"]
[0.255, "o", "\u001b[?25l\u001b[39D\u001b[38;5;10m?\u001b[39m Enter description (required): update t \u001b[K\r\n\r\u001b[1A\u001b[40C\u001b[?25h\u001b[?25l\u001b[40D\u001b[38;5;10m?\u001b[39m Enter description (required): update th \u001b[K\r\n\r\u001b[1"]
[0.000, "o", "A\u001b[41C\u001b[?25h"]
[0.000, "o", "\u001b[?25l\u001b[41D\u001b[38;5;10m?\u001b[39m Enter description (required): update the \u001b[K\r\n\r\u001b[1A\u001b[42C\u001b[?25h"]
[0.166, "o", "\u001b[?25l\u001b[42D\u001b[38;5;10m?\u001b[39"]
[0.000, "o", "m Enter description (required): update the \u001b[K\r\n\r\u001b[1A\u001b[43C\u001b[?25h"]
[0.329, "o", "\u001b[?25l\u001b[43D\u001b[38;5;10m?\u001b[39m Enter description (required): update the R \u001b[K\r\n\r\u001b[1A\u001b[44C\u001b[?25h\u001b[?25l\u001b[44D\u001b[38;5;10m?\u001b[39m Enter description (required):"]
[0.000, "o", " update the RE \u001b[K\r\n\r\u001b[1A\u001b[45C\u001b[?25h"]
[0.075, "o", "\u001b[?25l\u001b[45D\u001b[38;5;10m?\u001b[39m Enter description (required): update the REA \u001b[K\r\n\r\u001b[1A\u001b[46C\u001b[?25h"]
[0.150, "o", "\u001b[?25l\u001b[46D\u001b[38;5;10m?\u001b[39m Enter description (required): "]
[0.000, "o", "update the READ \u001b[K\r\n\r\u001b[1A\u001b[47C\u001b[?25h"]
[0.060, "o", "\u001b[?25l\u001b[47D\u001b[38;5;10m?\u001b[39m Enter description (required): update the READM \u001b[K\r\n\r\u001b[1A\u001b[48C\u001b[?25h"]
[0.300, "o", "\u001b[?25l\u001b[48D\u001b["]
[0.000, "o", "38;5;10m?\u001b[39m Enter description (required): update the README \u001b[K\r"]
[0.000, "o", "\n\r\u001b[1A"]
[0.000, "o", "\u001b[49C\u001b[?25h"]
[0.600, "o", "\u001b[?25l\u001b[49D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README \u001b[K\r\n\r\u001b[1A\u001b[50C\u001b[?25h"]
[0.165, "o", "\u001b[?25l\u001b[50D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README t \u001b[K\r\n\r\u001b[1A"]
[0.000, "o", "\u001b[51C\u001b[?25h"]
[0.000, "o", "\u001b[?25l\u001b[51D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to \u001b[K\r"]
[0.000, "o", "\n\r"]
[0.000, "o", "\u001b[1A\u001b[52C\u001b[?25h"]
[0.165, "o", "\u001b[?25l\u001b[52D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to \u001b[K\r\n\r\u001b[1A\u001b[53C\u001b[?25h"]
[0.075, "o", "\u001b[?25l\u001b[53D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to r \u001b[K\r\n\r\u001b[1A\u001b[54C\u001b[?25h"]
[0.090, "o", "\u001b[?25l\u001b[54D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to re \u001b[K\r\n\r\u001b[1A\u001b[55C\u001b[?25h"]
[0.180, "o", "\u001b[?25l\u001b[55D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to ref \u001b[K\r\n\r\u001b[1A\u001b[56C\u001b[?25h"]
[0.151, "o", "\u001b[?25l\u001b[56D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to refl \u001b[K\r\n\r\u001b[1A\u001b[57C\u001b[?25h"]
[0.254, "o", "\u001b[?25l\u001b[57D\u001b[38;5;10m?\u001b[39m Enter description (required): "]
[0.000, "o", "update the README to refle \u001b[K\r\n\r\u001b[1A\u001b[58C\u001b[?25h"]
[0.000, "o", "\u001b[?25l\u001b[58D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflec \u001b[K"]
[0.000, "o", "\r\n\r\u001b[1A\u001b["]
[0.000, "o", "59C\u001b[?25h"]
[0.210, "o", "\u001b[?25l\u001b[59D\u001b[38;5;10m"]
[0.000, "o", "?\u001b[39m Enter description (required): update the README to reflect \u001b[K\r\n\r\u001b[1A"]
[0.000, "o", "\u001b[60C\u001b[?25h"]
[0.151, "o", "\u001b[?25l\u001b[60D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect \u001b[K\r\n\r\u001b[1A\u001b[61C\u001b[?25h"]
[0.074, "o", "\u001b[?25l\u001b[61D\u001b[38;5;10m?\u001b[39"]
[0.000, "o", "m Enter description (required): update the README to reflect n \u001b[K\r\n\r\u001b[1A\u001b[62C\u001b[?25h"]
[0.075, "o", "\u001b[?25l\u001b[62D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect ne \u001b[K\r\n\r\u001b[1A\u001b[63C\u001b[?25h"]
[0.135, "o", "\u001b[?25l\u001b[63D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new \u001b[K\r\n\r\u001b[1A\u001b[64C\u001b[?25h"]
[0.256, "o", "\u001b[?25l\u001b[64D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new \u001b[K\r\n\r\u001b[1A\u001b[65C\u001b[?25h"]
[0.179, "o", "\u001b[?25l\u001b[65D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new f \u001b[K\r\n\r\u001b[1A\u001b[66C\u001b[?25h"]
[0.104, "o", "\u001b[?25l\u001b[66D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new fe \u001b[K\r\n\r\u001b[1A\u001b[67C\u001b[?25h"]
[0.016, "o", "\u001b[?25l\u001b[67D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new fea \u001b[K\r\n\r\u001b["]
[0.000, "o", "1A\u001b[68C\u001b[?25h"]
[0.240, "o", "\u001b[?25l\u001b[68D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new feat \u001b[K\r\n\r\u001b[1A\u001b[69C\u001b[?25h"]
[0.075, "o", "\u001b[?25l\u001b[69D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new featr \u001b[K\r\n\r\u001b[1A\u001b[70C\u001b[?25h"]
[0.000, "o", "\u001b[?25l\u001b[70D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new featru \u001b[K\r\n\r\u001b[1A\u001b[71C\u001b[?25h"]
[0.735, "o", "\u001b[?25l\u001b[71D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new featr \u001b[K\r\n\r\u001b[1A\u001b[70C\u001b[?25h"]
[0.179, "o", "\u001b[?25l\u001b[70D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new feat \u001b[K"]
[0.000, "o", "\r\n\r\u001b[1A\u001b[69C\u001b[?25h"]
[0.091, "o", "\u001b[?25l\u001b[69D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new featu \u001b[K\r\n\r\u001b[1A\u001b[70C\u001b[?25h"]
[0.166, "o", "\u001b[?25l\u001b[70D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new featur \u001b[K\r\n\r\u001b[1A\u001b[71C\u001b[?25h"]
[0.253, "o", "\u001b[?25l\u001b[71D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new feature \u001b[K\r\n\r\u001b[1A\u001b[72C\u001b[?25h"]
[0.000, "o", "\u001b[?25l\u001b[72D\u001b[38;5;10m?\u001b[39m Enter description (required): update the README to reflect new features \u001b[K\r\n\r\u001b[1A\u001b[73C\u001b[?25h"]
[0.796, "o", "\u001b[?25l\u001b[73D\u001b[38;5;10m>\u001b[39m Enter description (required): \u001b[38;5;14m"]
[0.000, "o", "update the README to reflect new features\u001b[39m\u001b[K\r\n\u001b[2K\r\n\u001b[?25h\u001b[1A\u001b[?25h\u001b[?2004l"]
[0.000, "o", "\u001b[?2004h"]
[0.000, "o", "\u001b[?25l\u001b[38;5;10m?\u001b[39m "]
[0.000, "o", "Does this revision include a breaking change? (y/N) \r\u001b["]
[0.000, "o", "54C\u001b[?25h"]
[1.079, "o", "\u001b[?25l\u001b[54D\u001b[38;5;10m>\u001b[39m Does this revision include a breaking change? \u001b[38;5;14mNo\u001b[39m\u001b[K\r\n\u001b[?25h"]
[0.000, "o", "\u001b[?25h\u001b[?2004l"]
[0.000, "o", "\u001b[?2004h"]
[0.000, "o", "\u001b[?25l\u001b[38;5;10m?\u001b[39m Add a body? (y/N) \r\u001b[20C\u001b[?25h"]
[1.035, "o", "\u001b[?25l\u001b[20D\u001b[38;5;10m>\u001b[39m Add a body? \u001b[38;5;14mNo\u001b[39m\u001b[K\r\n\u001b[?25h"]
[0.000, "o", "\u001b[?25h\u001b[?2004l"]
[0.000, "o", "\r\n📝 Commit Message Preview:\r\n┌──────────────────────────────────────────────────────────────────────────┐\r\n│ docs(README): update the README to reflect new features │\r\n└──────────────────────────────────────────────────────────────────────────┘\r\n\r\n\u001b[?2004h"]
[0.000, "o", "\u001b[?25l\u001b[38;5;10m?\u001b[39m Apply this commit message? (Y/n) "]
[0.000, "o", "\r\n\u001b[38;5;14m[\u001b[39m\u001b[38;5;14m"]
[0.000, "o", "Select 'No' to cancel and start over\u001b[39m"]
[0.000, "o", "\u001b[38;"]
[0.000, "o", "5;14m]\u001b[39m\r\u001b[1A\u001b[35C\u001b[?25h"]
[1.185, "o", "\u001b[?25l\u001b[35D\u001b[38;5;10m>\u001b[39m Apply this commit message? \u001b[38;5;14mYes\u001b[39m\u001b[K\r\n\u001b[2K\r\n\u001b[?25h\u001b[1A\u001b[?25h\u001b[?2004l"]
[0.015, "o", "✅ Commit message applied successfully!\r\n"]
[0.001, "o", "bash-5.3$ "]
[1.394, "o", "j"]
[0.182, "o", "j"]
[0.254, "o", " "]
[0.225, "o", "s"]
[0.060, "o", "h"]
[0.256, "o", "o"]
[0.118, "o", "w"]
[0.225, "o", "\r\n"]
[0.087, "o", "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\u001b[?2004h\u001b[>4;2m"]
[0.000, "o", "\u001b[?25l\u001b[HCommit ID: \u001b[34m9a200a9c47baa5a8a43c46e5fd9cc6a5ebd5bddb\u001b[39m\u001b[K\u001b[2;1HChange ID: \u001b[35mymmvxvqykryrsxmnxzttymztwtkpltqz\u001b[39m\u001b[K\u001b[3;1HAuthor : \u001b[33mLucien Cartier-Tilet\u001b[39m <\u001b[33mlucien@phundrak.com\u001b[39m> (\u001b[36m2026-06-14 14:31:57\u001b[39m)\u001b[K\u001b[4;1HCommitter: \u001b[33mLucien Cartier-Tilet\u001b[39m <\u001b[33mlucien@phundrak.com\u001b[39m> (\u001b[36m2026-06-14 14:50:46\u001b[39m)\u001b[K\u001b[5;1HSignature: \u001b[32mgood\u001b[39m signature by \u001b[33mlucien@phundrak.com\u001b[39m \u001b[36mSHA256:CE0HPsbW3L2YiJETx1zYZ2muMptaAqTN2g3498KrMkc\u001b[39m\u001b[K\u001b[6;1H\u001b[K\u001b[7;1H docs(README): update the README to reflect new features\u001b[K\u001b[8;1H\u001b[K\u001b[9;1H\u001b[33mModified regular file README.md:\u001b[39m\u001b[K\u001b[10;1H ...\u001b[K\u001b[11;1H\u001b[0;2m\u000f\u001b[31m 3\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 3\u001b[0m\u000f: An interactive CLI tool that guides Jujutsu users through creating\u001b[K\u001b[12;1H\u001b[0;2m\u000f\u001b[31m 4\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 4\u001b[0m\u000f: [conventional commit](https://www.conventionalcommits.org/) messages.\u001b[K\u001b[13;1H\u001b[0;2m\u000f\u001b[31m 5\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 5\u001b[0m\u000f: \u001b[K\u001b[14;1H \u001b[32m 6\u001b[39m: \u001b[0;4m\u000f\u001b[32m[![asciicast](assets/demo.cast)](assets/demo.cast)\u001b[0m\u000f\u001b[K\u001b[15;1H \u001b[32m 7\u001b[39m: \u001b[K\u001b[16;1H\u001b[0;2m\u000f\u001b[31m 6\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 8\u001b[0m\u000f: ## Features\u001b[K\u001b[17;1H\u001b[0;2m\u000f\u001b[31m 7\u001b[0m\u000f \u001b[0;2m\u000f\u001b[32m 9\u001b[0m\u000f: \u001b[K\u001b[18;1H\u001b[30m\u001b[47m wrap lines 1- 17/258 \u001b[39m\u001b[K\r\u001b[49m"]
[1.968, "o", "\u001b[34h\u001b[?25h\u001b[1;18r\u001b[18;1H\u001b[J\u001b[34h\u001b[?25h\u001b[?2004l\u001b[>4;0m"]
[0.002, "o", "bash-5.3$ "]
[0.764, "o", "exit\r\n"]
[0.001, "x", "0"]
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 KiB

-7
View File
@@ -38,12 +38,6 @@ command = [
]
need_stdout = true
[jobs.coverage]
command = [
"cargo", "tarpaulin", "--config", ".tarpaulin.local.toml", "--features", "test-utils"
]
need_stdout = true
[jobs.doc]
command = ["cargo", "doc", "--color", "always", "--no-deps"]
need_stdout = false
@@ -88,4 +82,3 @@ allow_warnings = true
[keybindings]
# alt-m = "job:my-job"
c = "job:clippy-all" # comment this to have 'c' run clippy on only the default target
v = "job:coverage"
Generated
+6 -6
View File
@@ -81,11 +81,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1779877693,
"narHash": "sha256-NOF9NAREhxr50bbBfVcVOq+ArCMSoe8dP79Pk2uyARk=",
"lastModified": 1776949667,
"narHash": "sha256-GMSVw35Q+294GlrTUKlx087E31z7KurReQ1YHSKp5iw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4100e830e085863741bc69b156ec4ccd53ab5be0",
"rev": "01fbdeef22b76df85ea168fbfe1bfd9e63681b30",
"type": "github"
},
"original": {
@@ -127,11 +127,11 @@
]
},
"locked": {
"lastModified": 1779992051,
"narHash": "sha256-4YWGv/0NkAdtTW1MXfaLYpfC9BhpCy9k1pWkR0xI9uw=",
"lastModified": 1777173302,
"narHash": "sha256-ERiu3cbxvnTDxiDcimRA7af7xp6x1y0sRyLGm28Qzz8=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "e93ad0df1073b2c969a8f0c1f10b84e870469d40",
"rev": "aaec8c50baeaf2f2ba653e8aae71778a2bbbac94",
"type": "github"
},
"original": {
+2 -10
View File
@@ -15,16 +15,8 @@
};
nixConfig = {
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
"phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk="
];
extra-substituters = [
"https://nix-community.cachix.org"
"https://devenv.cachix.org"
"https://phundrak.cachix.org"
];
extra-trusted-public-keys = ["phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk="];
extra-substituters = ["https://phundrak.cachix.org"];
};
outputs = {
+1 -4
View File
@@ -9,10 +9,7 @@ pkgs.stdenv.mkDerivation rec {
nativeBuildInputs = [pkgs.zip];
buildPhase = ''
mkdir -p $out/dist
# zip -j $out/dist/${name}.zip ${bin}/bin/jj-cz* ${src}/README.md ${src}/LICENSE.*
cp ${bin}/bin/jj-cz* $out/dist/
cp ${src}/README.md $out/dist/
cp ${src}/LICENSE.* $out/dist/
zip -j $out/dist/${name}.zip ${bin}/bin/jj-cz* ${src}/README.md ${src}/LICENSE.*
'';
installPhase = "";
dontConfigure = true;
+1 -2
View File
@@ -9,8 +9,7 @@
pname = name;
inherit version;
src = pkgs.lib.cleanSource ../.;
# cargoLock.lockFile = ../Cargo.lock;
cargoHash = "sha256-pAAp3bq4zZwRYC5v7wX56KbBgA1q2C/Td5jX2ge+VpY=";
cargoLock.lockFile = ../Cargo.lock;
useNextest = true;
meta = {
inherit (cargoToml.package) description homepage;
-95
View File
@@ -18,10 +18,6 @@ pub struct Cli {
/// The revision(s) whose description to edit (default: @)
#[arg(value_name = "REVSETS")]
revsets: Vec<String>,
/// Create a new child revision after editing the description
#[arg(short, long)]
new: bool,
}
impl Cli {
@@ -33,95 +29,4 @@ impl Cli {
self.revsets.iter().map(|s| s.as_str()).collect()
}
}
pub fn create_new(&self) -> bool {
self.new
}
pub fn validate(&self) -> Result<(), jj_cz::Error> {
if self.new && self.revsets().len() > 1 {
Err(jj_cz::Error::NewFlagWithMultipleRevisions)
} else {
Ok(())
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use clap::Parser;
#[test]
fn revsets_defaults_to_at() {
let cli = Cli::parse_from(["jj-cz"]);
assert_eq!(cli.revsets(), vec!["@"]);
}
#[test]
fn revsets_returns_provided_values() {
let cli = Cli::parse_from(["jj-cz", "abc", "def"]);
let revsets = cli.revsets();
assert_eq!(revsets, vec!["abc", "def"]);
}
#[test]
fn revsets_single_revset() {
let cli = Cli::parse_from(["jj-cz", "xyz"]);
assert_eq!(cli.revsets(), vec!["xyz"]);
}
#[test]
fn create_new_returns_false_by_default() {
let cli = Cli::parse_from(["jj-cz"]);
assert!(!cli.create_new());
}
#[test]
fn create_new_returns_true_with_flag() {
let cli = Cli::parse_from(["jj-cz", "--new"]);
assert!(cli.create_new());
}
#[test]
fn create_new_returns_true_with_short_flag() {
let cli = Cli::parse_from(["jj-cz", "-n"]);
assert!(cli.create_new());
}
#[test]
fn validate_ok_with_no_args() {
let cli = Cli::parse_from(["jj-cz"]);
assert!(cli.validate().is_ok());
}
#[test]
fn validate_ok_with_new_and_single_revset() {
let cli = Cli::parse_from(["jj-cz", "--new", "@"]);
assert!(cli.validate().is_ok());
}
#[test]
fn validate_ok_with_multiple_revsets_no_new() {
let cli = Cli::parse_from(["jj-cz", "abc", "def"]);
assert!(cli.validate().is_ok());
}
#[test]
fn validate_err_with_new_and_multiple_revsets() {
let cli = Cli::parse_from(["jj-cz", "--new", "abc", "def"]);
let result = cli.validate();
assert!(result.is_err());
assert!(matches!(
result.unwrap_err(),
jj_cz::Error::NewFlagWithMultipleRevisions
));
}
#[test]
fn cli_derives_debug() {
let cli = Cli::parse_from(["jj-cz", "--new", "@"]);
let debug = format!("{:?}", cli);
assert!(debug.contains("Cli"));
}
}
+2 -4
View File
@@ -4,12 +4,10 @@ pub trait Footer {
fn as_footer(&self) -> String {
let default = format!("{}: {}", self.prefix(), self.note());
let mut footer = if default.chars().count() > 72 {
if default.chars().count() > 72 {
textwrap::wrap(&default, 71).join("\n ")
} else {
default
};
footer.push('\n');
footer
}
}
}
+2 -27
View File
@@ -1,4 +1,4 @@
use super::{Body, BreakingChange, CommitType, Description, Footer, References, Scope};
use super::{Body, BreakingChange, CommitType, Description, Scope};
use thiserror::Error;
/// Errors that can occur when creating a ConventionalCommit
@@ -23,7 +23,6 @@ pub struct ConventionalCommit {
description: Description,
breaking_change: BreakingChange,
body: Body,
references: References,
}
impl ConventionalCommit {
@@ -45,7 +44,6 @@ impl ConventionalCommit {
description: Description,
breaking_change: BreakingChange,
body: Body,
references: References,
) -> Result<Self, CommitMessageError> {
let commit = Self {
commit_type,
@@ -53,7 +51,6 @@ impl ConventionalCommit {
description,
breaking_change,
body,
references,
};
let len = commit.first_line_len();
if len > Self::FIRST_LINE_MAX_LENGTH {
@@ -95,7 +92,6 @@ impl ConventionalCommit {
&self.description,
&self.breaking_change,
&self.body,
&self.references,
)
}
@@ -110,16 +106,14 @@ impl ConventionalCommit {
description: &Description,
breaking_change: &BreakingChange,
body: &Body,
references: &References,
) -> String {
let scope = scope.header_segment();
let breaking_change_header = breaking_change.header_segment();
let breaking_change_footer = breaking_change.as_footer();
let refs_footer = references.as_footer();
format!(
r#"{commit_type}{scope}{breaking_change_header}: {description}
{}
{breaking_change_footer}{refs_footer}"#,
{breaking_change_footer}"#,
body.format()
)
.trim()
@@ -160,7 +154,6 @@ mod tests {
description,
breaking_change,
Body::default(),
References::default(),
)
.expect("test commit should have valid line length")
}
@@ -644,7 +637,6 @@ mod tests {
Description::parse(&desc_44).unwrap(),
BreakingChange::No,
Body::default(),
References::default(),
);
assert!(result.is_ok());
let commit = result.unwrap();
@@ -675,7 +667,6 @@ mod tests {
Description::parse(&desc_31).unwrap(),
BreakingChange::No,
Body::default(),
References::default(),
);
assert!(result.is_err());
assert_eq!(
@@ -700,7 +691,6 @@ mod tests {
Description::parse(&desc_40).unwrap(),
BreakingChange::No,
Body::default(),
References::default(),
);
assert!(result.is_err());
assert_eq!(
@@ -721,7 +711,6 @@ mod tests {
test_description("quick fix"),
BreakingChange::No,
Body::default(),
References::default(),
);
assert!(result.is_ok());
}
@@ -735,7 +724,6 @@ mod tests {
test_description("add feature"),
BreakingChange::No,
Body::default(),
References::default(),
);
assert!(result.is_ok());
}
@@ -762,7 +750,6 @@ mod tests {
test_description("test"),
BreakingChange::No,
Body::default(),
References::default(),
);
// Just verify it's a Result by using is_ok()
assert!(result.is_ok());
@@ -794,7 +781,6 @@ mod tests {
desc,
BreakingChange::No,
Body::default(),
References::default(),
);
// new() itself calls git_conventional::Commit::parse internally, so
// if this is Ok, SC-002 is satisfied for this case.
@@ -932,7 +918,6 @@ mod tests {
Description::parse(&desc_44).unwrap(),
BreakingChange::Yes,
Body::default(),
References::default(),
);
assert!(result.is_err());
assert_eq!(
@@ -955,7 +940,6 @@ mod tests {
test_description("quick fix"),
long_note.into(),
Body::default(),
References::default(),
);
assert!(result.is_ok());
}
@@ -975,7 +959,6 @@ mod tests {
&commit.description,
&BreakingChange::No,
&Body::default(),
&References::default(),
);
assert_eq!(preview, commit.format());
}
@@ -989,7 +972,6 @@ mod tests {
&test_description("drop legacy API"),
&"removes legacy endpoint".into(),
&Body::default(),
&References::default(),
);
assert_eq!(
preview,
@@ -1006,7 +988,6 @@ mod tests {
&test_description("drop Node 6"),
&"Node 6 is no longer supported".into(),
&Body::default(),
&References::default(),
);
assert_eq!(
preview,
@@ -1112,7 +1093,6 @@ mod tests {
test_description("add feature"),
BreakingChange::No,
Body::from("This explains the change."),
References::default(),
)
.unwrap();
assert_eq!(
@@ -1130,7 +1110,6 @@ mod tests {
test_description("handle null response"),
BreakingChange::No,
Body::from("Null responses were previously unhandled."),
References::default(),
)
.unwrap();
assert_eq!(
@@ -1148,7 +1127,6 @@ mod tests {
test_description("update README"),
BreakingChange::No,
Body::from("First paragraph.\n\nSecond paragraph."),
References::default(),
)
.unwrap();
assert_eq!(
@@ -1168,7 +1146,6 @@ mod tests {
test_description("drop legacy API"),
"removes legacy endpoint".into(),
Body::from("The endpoint was deprecated in v2."),
References::default(),
)
.unwrap();
assert_eq!(
@@ -1186,7 +1163,6 @@ mod tests {
&test_description("add feature"),
&BreakingChange::No,
&Body::from("This explains the change."),
&References::default(),
);
assert_eq!(preview, "feat: add feature\n\nThis explains the change.");
}
@@ -1202,7 +1178,6 @@ mod tests {
&test_description("drop old API"),
&"old API removed".into(),
&Body::from("Migration guide: see CHANGELOG."),
&References::default(),
);
assert_eq!(
preview,
-3
View File
@@ -18,6 +18,3 @@ pub use body::Body;
mod message;
pub use message::{CommitMessageError, ConventionalCommit};
mod references;
pub use references::References;
-186
View File
@@ -1,186 +0,0 @@
use super::Footer;
#[repr(transparent)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct References(Vec<String>);
impl<T> From<T> for References
where
T: ToString,
{
fn from(value: T) -> Self {
let references: Vec<String> = value
.to_string()
.split(",")
.flat_map(|e| match e.trim() {
"" => None,
e => Some(e.to_string()),
})
.collect();
Self(references)
}
}
impl Footer for References {
fn prefix(&self) -> &str {
"Refs: "
}
fn note(&self) -> &str {
""
}
fn as_footer(&self) -> String {
if self.0.is_empty() {
String::new()
} else {
let footers: Vec<String> = self
.0
.iter()
.map(|r| format!("{}{r}\n", self.prefix()))
.collect();
footers.join("")
}
}
}
#[cfg(test)]
mod tests {
use super::*;
/// Default is empty
#[test]
fn default_is_empty() {
let refs = References::default();
assert!(refs.0.is_empty());
}
/// Empty input produces empty references
#[test]
fn from_empty_string() {
assert_eq!(References::from(""), References::default());
}
/// Whitespace-only input produces empty references
#[test]
fn from_whitespace_only() {
assert_eq!(References::from(" "), References::default());
}
/// Single reference without commas
#[test]
fn from_single_reference() {
let refs = References::from("#123");
assert_eq!(refs.0, vec!["#123".to_string()]);
}
/// Comma-separated references are split and trimmed
#[test]
fn from_comma_separated() {
let refs = References::from("#123, #456");
assert_eq!(refs.0, vec!["#123".to_string(), "#456".to_string()]);
}
/// Leading whitespace around references is trimmed
#[test]
fn from_trims_leading_whitespace() {
let refs = References::from(" #123, #456");
assert_eq!(refs.0, vec!["#123".to_string(), "#456".to_string()]);
}
/// Trailing whitespace around references is trimmed
#[test]
fn from_trims_trailing_whitespace() {
let refs = References::from("#123 , #456 ");
assert_eq!(refs.0, vec!["#123".to_string(), "#456".to_string()]);
}
/// Empty segments from consecutive commas are filtered out
#[test]
fn from_filters_empty_segments() {
let refs = References::from("#123,,, #456");
assert_eq!(refs.0, vec!["#123".to_string(), "#456".to_string()]);
}
/// From works with owned String
#[test]
fn from_owned_string() {
let input = "#123, #456".to_string();
let refs = References::from(input);
assert_eq!(refs.0, vec!["#123".to_string(), "#456".to_string()]);
}
/// as_footer returns empty string for empty references
#[test]
fn as_footer_empty() {
let refs = References::default();
assert_eq!(refs.as_footer(), "");
}
/// as_footer returns single line for one reference
#[test]
fn as_footer_single() {
let refs = References::from("#123");
assert_eq!(refs.as_footer(), "Refs: #123\n");
}
/// as_footer returns multiple lines for multiple references
#[test]
fn as_footer_multiple() {
let refs = References::from("#123, #456");
assert_eq!(refs.as_footer(), "Refs: #123\nRefs: #456\n");
}
/// as_footer handles Jira-style references
#[test]
fn as_footer_jira_style() {
let refs = References::from("OPS-456, PROJ-789");
assert_eq!(refs.as_footer(), "Refs: OPS-456\nRefs: PROJ-789\n");
}
/// Footer trait prefix returns correct value
#[test]
fn footer_prefix() {
let refs = References::default();
assert_eq!(refs.prefix(), "Refs: ");
}
/// Footer trait note returns empty string
#[test]
fn footer_note() {
let refs = References::default();
assert_eq!(refs.note(), "");
}
/// Clone produces equal value
#[test]
fn clone_equality() {
let refs = References::from("#123, #456");
let cloned = refs.clone();
assert_eq!(refs, cloned);
}
/// Debug output is available
#[test]
fn debug_output() {
let refs = References::from("#123");
let debug = format!("{:?}", refs);
assert!(debug.contains("References"));
}
/// Different references are not equal
#[test]
fn inequality_different_refs() {
let a = References::from("#123");
let b = References::from("#456");
assert_ne!(a, b);
}
/// Empty vs non-empty are not equal
#[test]
fn inequality_empty_vs_non_empty() {
let empty = References::default();
let non_empty = References::from("#123");
assert_ne!(empty, non_empty);
}
}
-2
View File
@@ -31,8 +31,6 @@ pub enum Error {
RevsetResolutionError { revset: String, context: String },
#[error("Revision set '{revset}' resolves to multiple commits; specify a single revision")]
MultipleRevisions { revset: String },
#[error("--new cannot be used with multiple revisions")]
NewFlagWithMultipleRevisions,
}
impl From<ScopeError> for Error {
+4 -33
View File
@@ -10,7 +10,6 @@ use std::{
};
use etcetera::BaseStrategy;
use futures_util::StreamExt;
use jj_lib::{
backend::CommitId,
config::{ConfigSource, StackedConfig},
@@ -152,7 +151,7 @@ impl JjLib {
}
/// Resolve a revset string to a commit ID
async fn get_commit_id(&self, revset: &str) -> Result<CommitId, Error> {
fn get_commit_id(&self, revset: &str) -> Result<CommitId, Error> {
let context = RevsetParseContext {
workspace: Some(RevsetWorkspaceContext {
workspace_name: &self.workspace_name,
@@ -183,13 +182,12 @@ impl JjLib {
let mut all_ids = revision.commit_change_ids();
let commit_id = all_ids
.next()
.await
.ok_or(Error::RevsetResolutionError {
revset: revset.into(),
context: "No matching revision".to_string(),
})?
.map_err(|e| Error::from_revset_evaluation_error(revset, e))?;
match all_ids.next().await {
match all_ids.next() {
None => Ok(commit_id.0),
Some(_) => Err(Error::MultipleRevisions {
revset: revset.to_string(),
@@ -214,7 +212,7 @@ impl JjExecutor for JjLib {
}
async fn describe(&self, revset: &str, message: &str) -> Result<(), Error> {
let commit_id = self.get_commit_id(revset).await?;
let commit_id = self.get_commit_id(revset)?;
let repo = self.repo.lock()?.clone();
let mut tx = repo.start_transaction();
let commit = tx
@@ -253,7 +251,7 @@ impl JjExecutor for JjLib {
}
async fn get_description(&self, revset: &str) -> Result<String, Error> {
let commit_id = self.get_commit_id(revset).await?;
let commit_id = self.get_commit_id(revset)?;
let repo = self.repo.lock()?.clone();
let commit = repo
.store()
@@ -263,33 +261,6 @@ impl JjExecutor for JjLib {
})?;
Ok(commit.description().trim_end().to_string())
}
async fn new_revision(&self, revset: &str) -> Result<(), Error> {
let commit_id = self.get_commit_id(revset).await?;
let repo = self.repo.lock()?.clone();
let mut tx = repo.start_transaction();
let parent_commit =
tx.repo()
.store()
.get_commit(&commit_id)
.map_err(|e| Error::JjOperation {
context: e.to_string(),
})?;
tx.repo_mut()
.check_out(self.workspace_name.clone(), &parent_commit)
.await
.map_err(|e| Error::JjOperation {
context: e.to_string(),
})?;
let new_repo =
tx.commit("jj-cz: create new revision")
.await
.map_err(|e| Error::JjOperation {
context: e.to_string(),
})?;
*self.repo.lock()? = new_repo;
Ok(())
}
}
#[cfg(test)]
+5 -88
View File
@@ -11,22 +11,18 @@ use std::sync::{Mutex, atomic::AtomicBool};
/// Mock implementation of JjExecutor for testing
#[derive(Debug)]
pub struct MockJjExecutor {
/// Response to return from `is_repository()`
/// Response to return from is_repository()
is_repo_response: Result<bool, Error>,
/// Response to return from `describe()`
/// Response to return from describe()
describe_response: Result<(), Error>,
/// Track described revsets
described_revsets: Mutex<Vec<String>>,
/// Track response to return from `get_description()`
/// Track response to return from get_description()
get_description_response: Result<String, Error>,
/// Track calls to `is_repository()`
/// Track calls to is_repository()
is_repo_called: AtomicBool,
/// Track calls to `describe()` with the message passed
/// Track calls to describe() with the message passed
describe_calls: Mutex<Vec<String>>,
/// Track response to return from `new_revision()`
new_revision_response: Result<(), Error>,
/// Track calls to `new_revision()`
new_revision_calls: Mutex<Vec<String>>,
}
impl Default for MockJjExecutor {
@@ -38,8 +34,6 @@ impl Default for MockJjExecutor {
get_description_response: Ok(String::new()),
is_repo_called: AtomicBool::new(false),
describe_calls: Mutex::new(Vec::new()),
new_revision_response: Ok(()),
new_revision_calls: Mutex::new(Vec::new()),
}
}
}
@@ -72,15 +66,6 @@ impl MockJjExecutor {
pub fn describe_messages(&self) -> Vec<String> {
self.describe_calls.lock().unwrap().clone()
}
pub fn with_new_revision_response(mut self, response: Result<(), Error>) -> Self {
self.new_revision_response = response;
self
}
pub fn new_revision_calls(&self) -> Vec<String> {
self.new_revision_calls.lock().unwrap().clone()
}
}
#[async_trait(?Send)]
@@ -112,17 +97,6 @@ impl JjExecutor for MockJjExecutor {
async fn get_description(&self, _revset: &str) -> Result<String, Error> {
self.get_description_response.clone()
}
async fn new_revision(&self, revset: &str) -> Result<(), Error> {
self.new_revision_calls
.lock()
.unwrap()
.push(revset.to_string());
match &self.new_revision_response {
Ok(()) => Ok(()),
Err(e) => Err(e.clone()),
}
}
}
#[cfg(test)]
@@ -271,61 +245,4 @@ mod tests {
mock.is_repository().await.unwrap();
assert!(mock.was_is_repo_called());
}
/// Test mock new_revision() records the revset
#[tokio::test]
async fn mock_new_revision_records_revset() {
let mock = MockJjExecutor::new();
let result = mock.new_revision("@").await;
assert!(result.is_ok());
let calls = mock.new_revision_calls();
assert_eq!(calls.len(), 1);
assert_eq!(calls[0], "@");
}
/// Test mock new_revision() records multiple calls
#[tokio::test]
async fn mock_new_revision_records_multiple_calls() {
let mock = MockJjExecutor::new();
mock.new_revision("@").await.unwrap();
mock.new_revision("abc").await.unwrap();
mock.new_revision("xyz").await.unwrap();
let calls = mock.new_revision_calls();
assert_eq!(calls.len(), 3);
assert_eq!(calls[0], "@");
assert_eq!(calls[1], "abc");
assert_eq!(calls[2], "xyz");
}
/// Test mock new_revision() returns configured error
#[tokio::test]
async fn mock_new_revision_returns_error() {
let mock = MockJjExecutor::new().with_new_revision_response(Err(Error::RepositoryLocked));
let result = mock.new_revision("@").await;
assert!(result.is_err());
assert!(matches!(result.unwrap_err(), Error::RepositoryLocked));
}
/// Test mock new_revision() records revset even on error
#[tokio::test]
async fn mock_new_revision_records_revset_on_error() {
let mock = MockJjExecutor::new().with_new_revision_response(Err(Error::JjOperation {
context: "failed".to_string(),
}));
let result = mock.new_revision("abc").await;
assert!(result.is_err());
let calls = mock.new_revision_calls();
assert_eq!(calls.len(), 1);
assert_eq!(calls[0], "abc");
}
/// Test mock new_revision() can be inspected after success
#[tokio::test]
async fn mock_new_revision_returns_ok_and_tracks_revset() {
let mock = MockJjExecutor::new();
let result = mock.new_revision("my-feature").await;
assert!(result.is_ok());
let calls = mock.new_revision_calls();
assert_eq!(calls, vec!["my-feature"]);
}
}
-5
View File
@@ -21,11 +21,6 @@ pub trait JjExecutor: Send + Sync {
/// Get the current description of a specific revision
async fn get_description(&self, revset: &str) -> Result<String, Error>;
/// Create a new empty child revision parented on `revset`.
///
/// Equivalent to `jj new <revset>`
async fn new_revision(&self, revset: &str) -> Result<(), Error>;
}
#[cfg(test)]
+1 -1
View File
@@ -1,5 +1,5 @@
mod commit;
pub mod error;
mod error;
mod jj;
mod prompts;
+13 -17
View File
@@ -10,7 +10,7 @@ const EXIT_CANCELLED: i32 = 130; // Same as SIGINT (Ctrl+C)
const EXIT_ERROR: i32 = 1;
/// Map application errors to appropriate exit codes
fn error_to_exit_code(error: Error) -> i32 {
fn error_to_exit_code(error: &Error) -> i32 {
match error {
Error::Cancelled => EXIT_CANCELLED,
Error::NotARepository => EXIT_ERROR,
@@ -24,7 +24,6 @@ fn error_to_exit_code(error: Error) -> i32 {
Error::FailedReadingConfig { .. } => EXIT_ERROR,
Error::RevsetResolutionError { .. } => EXIT_ERROR,
Error::MultipleRevisions { .. } => EXIT_ERROR,
Error::NewFlagWithMultipleRevisions => EXIT_ERROR,
}
}
@@ -35,26 +34,25 @@ fn is_interactive_terminal() -> bool {
}
#[tokio::main]
async fn main() -> Result<(), ()> {
async fn main() {
let cli = cli::Cli::parse();
cli.validate().map_err(exit_on_error)?;
if !is_interactive_terminal() {
eprintln!("❌ Error: jj-cz requires an interactive terminal (TTY)");
eprintln!(" This tool cannot be used in non-interactive mode or when piping input.");
eprintln!(" Use --help for usage information.");
process::exit(EXIT_ERROR);
}
let executor = JjLib::new().await.map_err(exit_on_error)?;
let executor = match JjLib::new().await {
Ok(e) => e,
Err(e) => {
eprintln!("❌ Error: {}", e);
process::exit(EXIT_ERROR);
}
};
let workflow = CommitWorkflow::new(executor);
for revset in cli.revsets() {
let result = workflow.run_for_revset(revset).await;
handle_result(result);
if cli.create_new() {
println!("Creating a new revision after {revset}");
workflow.new_revision(revset).await.map_err(exit_on_error)?;
}
}
fn handle_result(result: Result<(), Error>) {
@@ -64,13 +62,11 @@ async fn main() -> Result<(), ()> {
println!("🟡 Operation cancelled by user.");
process::exit(EXIT_CANCELLED);
}
Err(e) => exit_on_error(e),
Err(e) => {
eprintln!("❌ Error: {}", e);
process::exit(error_to_exit_code(&e));
}
}
}
process::exit(EXIT_SUCCESS);
}
fn exit_on_error(e: Error) {
eprintln!("❌ Error: {}", e);
process::exit(error_to_exit_code(e));
}
+1 -59
View File
@@ -8,7 +8,7 @@
use std::sync::{Arc, Mutex};
use crate::{
commit::types::{Body, BreakingChange, CommitType, Description, References, Scope},
commit::types::{Body, BreakingChange, CommitType, Description, Scope},
error::Error,
prompts::prompter::Prompter,
};
@@ -20,7 +20,6 @@ enum MockResponse {
Scope(Scope),
Description(Description),
BreakingChange(BreakingChange),
References(References),
Body(Body),
Confirm(bool),
Error(Error),
@@ -82,15 +81,6 @@ impl MockPrompts {
self
}
/// Configure the mock to return specific references
pub fn with_references(self, references: References) -> Self {
self.responses
.lock()
.unwrap()
.push(MockResponse::References(references));
self
}
/// Configure the mock to return a specific body response
pub fn with_body(self, body: Body) -> Self {
self.responses
@@ -150,14 +140,6 @@ impl MockPrompts {
.contains(&"input_breaking_change".to_string())
}
/// Check if input_references was called
pub fn was_references_called(&self) -> bool {
self.prompts_called
.lock()
.unwrap()
.contains(&"input_references".to_string())
}
/// Check if confirm_apply was called
pub fn was_confirm_called(&self) -> bool {
self.prompts_called
@@ -225,18 +207,6 @@ impl Prompter for MockPrompts {
}
}
fn input_references(&self) -> Result<References, Error> {
self.prompts_called
.lock()
.unwrap()
.push("input_references".to_string());
match self.responses.lock().unwrap().remove(0) {
MockResponse::References(r) => Ok(r),
MockResponse::Error(e) => Err(e),
_ => panic!("MockPrompts: Expected References response, got different type"),
}
}
fn input_body(&self) -> Result<Body, Error> {
self.prompts_called
.lock()
@@ -366,34 +336,6 @@ mod tests {
assert!(mock.emitted_messages().is_empty());
}
#[test]
fn mock_input_references() {
let refs = References::from("#123, #456");
let mock = MockPrompts::new().with_references(refs.clone());
let result = mock.input_references();
assert!(result.is_ok());
assert_eq!(result.unwrap(), refs);
assert!(mock.was_references_called());
}
#[test]
fn mock_input_references_default() {
let mock = MockPrompts::new().with_references(References::default());
let result = mock.input_references();
assert!(result.is_ok());
assert_eq!(result.unwrap(), References::default());
assert!(mock.was_references_called());
}
#[test]
fn mock_input_references_error() {
let mock = MockPrompts::new().with_error(Error::Cancelled);
let result = mock.input_references();
assert!(result.is_err());
assert!(matches!(result.unwrap_err(), Error::Cancelled));
assert!(mock.was_references_called());
}
#[test]
fn mock_input_breaking_change_no() {
let mock = MockPrompts::new().with_breaking_change(BreakingChange::No);
+1 -17
View File
@@ -9,7 +9,7 @@ use inquire::{Confirm, Text};
use unicode_width::UnicodeWidthStr;
use crate::{
commit::types::{Body, BreakingChange, CommitType, Description, References, Scope},
commit::types::{Body, BreakingChange, CommitType, Description, Scope},
error::Error,
};
@@ -33,9 +33,6 @@ pub trait Prompter {
/// Prompt the user to optionally add a free-form body via an external editor
fn input_body(&self) -> Result<Body, Error>;
/// Prompt the user to optionally add comma-separated ticket references
fn input_references(&self) -> Result<References, Error>;
/// Prompt the user to confirm applying the commit message
fn confirm_apply(&self, message: &str) -> Result<bool, Error>;
@@ -94,19 +91,6 @@ impl Prompter for RealPrompts {
}
}
fn input_references(&self) -> Result<References, Error> {
let answer = inquire::Text::new("Enter comma-separated references (optional):")
.with_help_message("References are optional. If provided, will become footer(s) in the commit message. References must be comma-separated.")
.with_placeholder("Leave empty if no references")
.prompt_skippable()
.map_err(|_| Error::Cancelled)?;
match answer {
None => Ok(References::default()),
Some(s) if s.trim().is_empty() => Ok(References::default()),
Some(s) => Ok(References::from(s)),
}
}
fn input_description(&self) -> Result<Description, Error> {
loop {
let answer = Text::new("Enter description (required):")
+4 -101
View File
@@ -6,7 +6,7 @@
use crate::{
commit::types::{
Body, BreakingChange, CommitMessageError, CommitType, ConventionalCommit, Description,
References, Scope,
Scope,
},
error::Error,
jj::JjExecutor,
@@ -65,16 +65,8 @@ impl<J: JjExecutor, P: Prompter> CommitWorkflow<J, P> {
let scope = self.scope_input()?;
let description = self.description_input()?;
let breaking_change = self.breaking_change_input()?;
let references = self.references_input()?;
let body = self.body_input()?;
match self.preview_and_confirm(
commit_type,
scope,
description,
breaking_change,
body,
references,
) {
match self.preview_and_confirm(commit_type, scope, description, breaking_change, body) {
Ok(conventional_commit) => {
self.executor
.describe(revset, &conventional_commit.to_string())
@@ -121,11 +113,6 @@ impl<J: JjExecutor, P: Prompter> CommitWorkflow<J, P> {
self.prompts.input_breaking_change()
}
/// Prompt user for references
fn references_input(&self) -> Result<References, Error> {
self.prompts.input_references()
}
/// Prompt user to optionally add a free-form body via an external editor
fn body_input(&self) -> Result<Body, Error> {
self.prompts.input_body()
@@ -142,7 +129,6 @@ impl<J: JjExecutor, P: Prompter> CommitWorkflow<J, P> {
description: Description,
breaking_change: BreakingChange,
body: Body,
references: References,
) -> Result<ConventionalCommit, Error> {
// Format the message for preview
let message = ConventionalCommit::format_preview(
@@ -151,7 +137,6 @@ impl<J: JjExecutor, P: Prompter> CommitWorkflow<J, P> {
&description,
&breaking_change,
&body,
&references,
);
// Try to build the conventional commit (this validates the 72-char limit)
@@ -161,7 +146,6 @@ impl<J: JjExecutor, P: Prompter> CommitWorkflow<J, P> {
description.clone(),
breaking_change,
body,
references,
) {
Ok(cc) => cc,
Err(CommitMessageError::FirstLineTooLong { actual, max }) => {
@@ -200,10 +184,6 @@ impl<J: JjExecutor, P: Prompter> CommitWorkflow<J, P> {
Err(Error::Cancelled)
}
}
pub async fn new_revision(&self, revset: &str) -> Result<(), Error> {
self.executor.new_revision(revset).await
}
}
#[cfg(test)]
@@ -292,15 +272,8 @@ mod tests {
let description = Description::parse("test description").unwrap();
let breaking_change = BreakingChange::No;
let body = Body::default();
let references = References::default();
let result = workflow.preview_and_confirm(
commit_type,
scope,
description,
breaking_change,
body,
references,
);
let result =
workflow.preview_and_confirm(commit_type, scope, description, breaking_change, body);
assert!(result.is_ok());
}
@@ -345,7 +318,6 @@ mod tests {
.with_scope(Scope::empty())
.with_description(Description::parse("add new feature").unwrap())
.with_breaking_change(BreakingChange::Yes)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(true);
@@ -379,7 +351,6 @@ mod tests {
.with_scope(Scope::parse("api").unwrap())
.with_description(Description::parse("fix bug").unwrap())
.with_breaking_change(BreakingChange::No)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(false); // User cancels at confirmation
@@ -404,13 +375,11 @@ mod tests {
.with_scope(Scope::parse("very-long-scope-name").unwrap())
.with_description(Description::parse("a".repeat(45)).unwrap())
.with_breaking_change(BreakingChange::No)
.with_references(References::default())
.with_body(Body::default())
// Second iteration: short enough to succeed
.with_scope(Scope::empty())
.with_description(Description::parse("short description").unwrap())
.with_breaking_change(BreakingChange::No)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(true);
@@ -505,7 +474,6 @@ mod tests {
.with_scope(Scope::empty())
.with_description(Description::parse("test").unwrap())
.with_breaking_change(BreakingChange::Yes)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(true);
@@ -529,7 +497,6 @@ mod tests {
.with_scope(Scope::empty())
.with_description(Description::parse("test").unwrap())
.with_breaking_change(BreakingChange::Yes)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(true);
@@ -548,7 +515,6 @@ mod tests {
.with_scope(Scope::parse("api").unwrap())
.with_description(Description::parse("test").unwrap())
.with_breaking_change(BreakingChange::No)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(true);
@@ -596,7 +562,6 @@ mod tests {
Description::parse("remove old API").unwrap(),
BreakingChange::Yes,
Body::default(),
References::default(),
);
assert!(result.is_ok(), "expected Ok, got: {:?}", result);
@@ -624,7 +589,6 @@ mod tests {
Description::parse("drop legacy API").unwrap(),
breaking_change,
Body::default(),
References::default(),
);
assert!(result.is_ok(), "expected Ok, got: {:?}", result);
@@ -655,7 +619,6 @@ mod tests {
.with_scope(Scope::empty())
.with_description(Description::parse("remove old API").unwrap())
.with_breaking_change(BreakingChange::Yes)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(true);
@@ -698,7 +661,6 @@ mod tests {
Description::parse("add feature").unwrap(),
BreakingChange::No,
Body::from("This explains the change."),
References::default(),
);
assert!(result.is_ok(), "expected Ok, got: {:?}", result);
@@ -726,7 +688,6 @@ mod tests {
Description::parse("drop legacy API").unwrap(),
"removes legacy endpoint".into(),
Body::from("The endpoint was deprecated in v2."),
References::default(),
);
assert!(result.is_ok(), "expected Ok, got: {:?}", result);
@@ -753,7 +714,6 @@ mod tests {
.with_scope(Scope::empty())
.with_description(Description::parse("add feature").unwrap())
.with_breaking_change(BreakingChange::No)
.with_references(References::default())
.with_body(Body::from("This explains the change."))
.with_confirm(true);
@@ -786,7 +746,6 @@ mod tests {
.with_scope(Scope::empty())
.with_description(Description::parse("fix crash").unwrap())
.with_breaking_change(BreakingChange::No)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(true);
@@ -803,60 +762,4 @@ mod tests {
assert_eq!(messages.len(), 1);
assert_eq!(messages[0], "fix: fix crash");
}
/// Test workflow new_revision() records the revset
#[tokio::test]
async fn workflow_new_revision_records_revset() {
let mock_executor = MockJjExecutor::new();
let workflow = CommitWorkflow::new(mock_executor);
let result = workflow.new_revision("@").await;
assert!(result.is_ok());
let calls = workflow.executor.new_revision_calls();
assert_eq!(calls, vec!["@"]);
}
/// Test workflow new_revision() propagates executor errors
#[tokio::test]
async fn workflow_new_revision_propagates_error() {
let mock_executor =
MockJjExecutor::new().with_new_revision_response(Err(Error::RepositoryLocked));
let workflow = CommitWorkflow::new(mock_executor);
let result = workflow.new_revision("@").await;
assert!(result.is_err());
assert!(matches!(result.unwrap_err(), Error::RepositoryLocked));
}
/// Test workflow run_for_revset() followed by new_revision() records both
///
/// This mirrors the actual usage pattern in main.rs.
#[tokio::test]
async fn workflow_describe_then_new_revision() {
let mock_executor = MockJjExecutor::new().with_is_repo_response(Ok(true));
let mock_prompts = MockPrompts::new()
.with_commit_type(CommitType::Feat)
.with_scope(Scope::empty())
.with_description(Description::parse("add feature").unwrap())
.with_breaking_change(BreakingChange::No)
.with_references(References::default())
.with_body(Body::default())
.with_confirm(true);
let workflow = CommitWorkflow::with_prompts(mock_executor, mock_prompts);
workflow.run_for_revset("@").await.expect("describe failed");
workflow
.new_revision("@")
.await
.expect("new_revision failed");
let messages = workflow.executor.describe_messages();
assert_eq!(messages.len(), 1);
assert!(messages[0].contains("feat:"));
let calls = workflow.executor.new_revision_calls();
assert_eq!(calls, vec!["@"]);
}
}
-152
View File
@@ -135,155 +135,3 @@ fn test_jj_operation_context() {
panic!("Expected JjOperation variant");
}
}
/// Test conversion from std::io::Error
#[test]
fn test_from_io_error() {
let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "file not found");
let error: Error = io_err.into();
assert!(matches!(error, Error::FailedGettingCurrentDir));
}
/// Test conversion from std::sync::PoisonError
#[test]
fn test_from_poison_error() {
let mutex = std::sync::Mutex::new(());
// Poison the mutex by panicking while holding the lock
let poison_err = std::panic::catch_unwind(|| {
let _guard = mutex.lock().unwrap();
panic!("deliberate panic");
});
assert!(poison_err.is_err());
// Now lock should fail with PoisonError
let result = mutex.lock();
assert!(result.is_err());
let error: Error = result.unwrap_err().into();
assert!(matches!(error, Error::JjOperation { .. }));
assert_eq!(
format!("{}", error),
"Repository operation failed: internal lock poisoned"
);
}
/// Test from_revset_evaluation_error constructs RevsetResolutionError
#[test]
fn test_from_revset_evaluation_error() {
let underlying = std::io::Error::other("store failure");
let eval_err = jj_lib::revset::RevsetEvaluationError::Other(Box::new(underlying));
let error = Error::from_revset_evaluation_error("@", eval_err);
assert!(matches!(error, Error::RevsetResolutionError { .. }));
let description = format!("{}", error);
assert!(description.contains("@"));
assert!(description.contains("store failure"));
}
/// Test from_revset_resolution_error constructs RevsetResolutionError
#[test]
fn test_from_revset_resolution_error() {
let resolution_err = jj_lib::revset::RevsetResolutionError::NoSuchRevision {
name: "nonexistent".to_string(),
candidates: Vec::new(),
};
let error = Error::from_revset_resolution_error("@", resolution_err);
assert!(matches!(error, Error::RevsetResolutionError { .. }));
let description = format!("{}", error);
assert!(description.contains("@"));
assert!(description.contains("nonexistent"));
}
/// Test NewFlagWithMultipleRevisions error display
#[test]
fn test_new_flag_with_multiple_revisions() {
let error = Error::NewFlagWithMultipleRevisions;
assert_eq!(
format!("{}", error),
"--new cannot be used with multiple revisions"
);
}
/// Test NonInteractive error display
#[test]
fn test_non_interactive() {
let error = Error::NonInteractive;
assert_eq!(format!("{}", error), "Non-interactive terminal detected");
}
/// Test FailedReadingConfig error display
#[test]
fn test_failed_reading_config() {
let error = Error::FailedReadingConfig {
context: "config parse error".to_string(),
};
let description = format!("{}", error);
assert!(description.contains("config parse error"));
}
/// Test MultipleRevisions error display
#[test]
fn test_multiple_revisions() {
let error = Error::MultipleRevisions {
revset: "abc | def".to_string(),
};
let description = format!("{}", error);
assert!(description.contains("abc | def"));
assert!(description.contains("multiple commits"));
}
/// Test RepositoryLocked error display
#[test]
fn test_repository_locked() {
let error = Error::RepositoryLocked;
assert_eq!(
format!("{}", error),
"Repository is locked by another process"
);
}
/// Test FailedGettingCurrentDir error display
#[test]
fn test_failed_getting_current_dir() {
let error = Error::FailedGettingCurrentDir;
assert_eq!(format!("{}", error), "Could not get current directory");
}
/// Test error matching on all variants
#[test]
fn test_error_matching_all_variants() {
let variants: Vec<Error> = vec![
Error::InvalidScope("s".into()),
Error::InvalidDescription("d".into()),
Error::InvalidCommitMessage("m".into()),
Error::NotARepository,
Error::JjOperation {
context: "c".into(),
},
Error::RepositoryLocked,
Error::FailedGettingCurrentDir,
Error::FailedReadingConfig {
context: "c".into(),
},
Error::Cancelled,
Error::NonInteractive,
Error::RevsetResolutionError {
revset: "@".into(),
context: "c".into(),
},
Error::MultipleRevisions { revset: "@".into() },
Error::NewFlagWithMultipleRevisions,
];
// All variants should be displayable without panicking
for variant in &variants {
let _ = format!("{}", variant);
let _ = format!("{:?}", variant);
}
// Verify all variants can be cloned
let cloned: Vec<Error> = variants.to_vec();
assert_eq!(variants.len(), cloned.len());
for (original, clone) in variants.iter().zip(cloned.iter()) {
assert_eq!(original, clone);
}
}