mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-17 17:55:29 +00:00
Add sapling graph formatters as an option.
This commit is contained in:
parent
cf809aefc4
commit
073505fc8e
6 changed files with 466 additions and 24 deletions
345
Cargo.lock
generated
345
Cargo.lock
generated
|
@ -2,13 +2,30 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "abomonation"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56e72913c99b1f927aa7bd59a41518fdd9995f63ffc8760f211609e0241c4fb2"
|
||||
|
||||
[[package]]
|
||||
name = "abomonation_derive"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e50e2a046af56a864c62d97b7153fda72c596e646be1b0c7963736821f6e1efa"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"getrandom 0.2.7",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
@ -39,9 +56,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.64"
|
||||
version = "1.0.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9a8f622bcf6ff3df478e9deba3e03e4e04b300f8e6a139e192c05fa3490afc7"
|
||||
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
|
||||
|
||||
[[package]]
|
||||
name = "assert_cmd"
|
||||
|
@ -65,9 +82,9 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9"
|
|||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.57"
|
||||
version = "0.1.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f"
|
||||
checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -97,9 +114,9 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"getrandom 0.2.7",
|
||||
"instant",
|
||||
"rand",
|
||||
"rand 0.8.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -459,6 +476,43 @@ dependencies = [
|
|||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dag"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/facebook/sapling#fcacb0ad73e91ff899ab6fc34787dce1da884250"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"dag-types",
|
||||
"drawdag",
|
||||
"fail",
|
||||
"futures 0.3.25",
|
||||
"indexmap",
|
||||
"itertools",
|
||||
"mincode",
|
||||
"minibytes",
|
||||
"nonblocking",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"vlqencoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dag-types"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/facebook/sapling#fcacb0ad73e91ff899ab6fc34787dce1da884250"
|
||||
dependencies = [
|
||||
"abomonation",
|
||||
"abomonation_derive",
|
||||
"minibytes",
|
||||
"quickcheck_arbitrary_derive",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "difflib"
|
||||
version = "0.4.0"
|
||||
|
@ -502,6 +556,11 @@ version = "0.3.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "drawdag"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/facebook/sapling#fcacb0ad73e91ff899ab6fc34787dce1da884250"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.8.0"
|
||||
|
@ -514,6 +573,16 @@ version = "0.3.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
|
||||
dependencies = [
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.2.8"
|
||||
|
@ -535,6 +604,17 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fail"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3be3c61c59fdc91f5dbc3ea31ee8623122ce80057058be560654c5d410d181a6"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"rand 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.8.0"
|
||||
|
@ -569,6 +649,102 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.1.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-executor",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
|
||||
dependencies = [
|
||||
"futures 0.1.31",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gen-protos"
|
||||
version = "0.1.0"
|
||||
|
@ -586,6 +762,17 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.9.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.7"
|
||||
|
@ -594,7 +781,7 @@ checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -696,6 +883,8 @@ checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
|
|||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
"rayon",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -795,6 +984,7 @@ dependencies = [
|
|||
"criterion",
|
||||
"criterion_bencher_compat",
|
||||
"crossterm",
|
||||
"dag",
|
||||
"dirs",
|
||||
"git2",
|
||||
"glob",
|
||||
|
@ -844,8 +1034,8 @@ dependencies = [
|
|||
"pest",
|
||||
"pest_derive",
|
||||
"prost",
|
||||
"rand",
|
||||
"rand_chacha",
|
||||
"rand 0.8.5",
|
||||
"rand_chacha 0.3.1",
|
||||
"regex",
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
|
@ -978,6 +1168,24 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mincode"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/facebook/sapling#fcacb0ad73e91ff899ab6fc34787dce1da884250"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"serde",
|
||||
"vlqencoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minibytes"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/facebook/sapling#fcacb0ad73e91ff899ab6fc34787dce1da884250"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
|
@ -992,7 +1200,7 @@ checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
|
@ -1012,6 +1220,11 @@ dependencies = [
|
|||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nonblocking"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/facebook/sapling#fcacb0ad73e91ff899ab6fc34787dce1da884250"
|
||||
|
||||
[[package]]
|
||||
name = "normalize-line-endings"
|
||||
version = "0.3.0"
|
||||
|
@ -1214,6 +1427,12 @@ version = "0.2.9"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.25"
|
||||
|
@ -1382,6 +1601,28 @@ dependencies = [
|
|||
"prost",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quickcheck"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"log",
|
||||
"rand 0.8.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quickcheck_arbitrary_derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/facebookexperimental/rust-shed.git?branch=main#e7b4df4635511dcdef872d41a6d7e64f3e56ec32"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quickcheck",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.21"
|
||||
|
@ -1391,6 +1632,19 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
|
@ -1398,8 +1652,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1409,7 +1673,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1418,7 +1691,16 @@ version = "0.6.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"getrandom 0.2.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1460,7 +1742,7 @@ version = "0.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"getrandom 0.2.7",
|
||||
"redox_syscall",
|
||||
"thiserror",
|
||||
]
|
||||
|
@ -1693,6 +1975,18 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "synstructure"
|
||||
version = "0.12.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.3.0"
|
||||
|
@ -1752,7 +2046,7 @@ dependencies = [
|
|||
"git2",
|
||||
"itertools",
|
||||
"jujutsu-lib",
|
||||
"rand",
|
||||
"rand 0.8.5",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
|
@ -1950,6 +2244,12 @@ version = "0.1.10"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.2.2"
|
||||
|
@ -1974,6 +2274,11 @@ version = "0.9.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "vlqencoding"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/facebook/sapling#fcacb0ad73e91ff899ab6fc34787dce1da884250"
|
||||
|
||||
[[package]]
|
||||
name = "wait-timeout"
|
||||
version = "0.2.0"
|
||||
|
@ -1994,6 +2299,12 @@ dependencies = [
|
|||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.9.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
|
|
|
@ -40,6 +40,7 @@ clap_complete = "4.0.7"
|
|||
clap_mangen = "0.2.6"
|
||||
config = { version = "0.13.3", default-features = false, features = ["toml"] }
|
||||
crossterm = { version = "0.25", default-features = false }
|
||||
dag = { git = "https://github.com/facebook/sapling", optional = true, default-features = false }
|
||||
dirs = "4.0.0"
|
||||
git2 = "0.16.0"
|
||||
glob = "0.3.1"
|
||||
|
@ -75,5 +76,6 @@ test-case = "2.2.2"
|
|||
testutils = { path = "lib/testutils" }
|
||||
|
||||
[features]
|
||||
sapling = ["dag"]
|
||||
default = ["jujutsu-lib/legacy-thrift"]
|
||||
vendored-openssl = ["git2/vendored-openssl", "jujutsu-lib/vendored-openssl"]
|
||||
|
|
|
@ -44,6 +44,10 @@
|
|||
|
||||
cargoLock = {
|
||||
lockFile = "${self}/Cargo.lock";
|
||||
outputHashes = {
|
||||
"dag-0.1.0" = "sha256-Tbta3hkBMvovqz84cu++inVDqrEB2vCGcwTaErOczRw=";
|
||||
"quickcheck_arbitrary_derive-0.1.0" = "sha256-kUgApls8Uq07QcDrgOLXmAk08fNaEdQtDrnGhP6ff6w=";
|
||||
};
|
||||
};
|
||||
nativeBuildInputs = [
|
||||
pkg-config gzip makeWrapper
|
||||
|
|
|
@ -146,6 +146,12 @@ impl UserSettings {
|
|||
pub fn config(&self) -> &config::Config {
|
||||
&self.config
|
||||
}
|
||||
|
||||
pub fn graph_format(&self) -> String {
|
||||
self.config
|
||||
.get_string("ui.graph.format")
|
||||
.unwrap_or_else(|_| "ascii".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// This Rng uses interior mutability to allow generating random values using an
|
||||
|
|
|
@ -58,7 +58,7 @@ use crate::cli_util::{
|
|||
use crate::config::config_path;
|
||||
use crate::diff_util::{self, DiffFormat, DiffFormatArgs};
|
||||
use crate::formatter::{Formatter, PlainTextFormatter};
|
||||
use crate::graphlog::{AsciiGraphDrawer, Edge};
|
||||
use crate::graphlog::{get_graphlog, Edge};
|
||||
use crate::progress::Progress;
|
||||
use crate::template_parser::TemplateParser;
|
||||
use crate::templater::Template;
|
||||
|
@ -1661,7 +1661,7 @@ fn cmd_log(ui: &mut Ui, command: &CommandHelper, args: &LogArgs) -> Result<(), C
|
|||
formatter.push_label("log")?;
|
||||
|
||||
if !args.no_graph {
|
||||
let mut graph = AsciiGraphDrawer::new(&mut formatter);
|
||||
let mut graph = get_graphlog(command.settings(), &mut formatter);
|
||||
let iter: Box<dyn Iterator<Item = (IndexEntry, Vec<RevsetGraphEdge>)>> =
|
||||
if args.reversed {
|
||||
Box::new(revset.iter().graph().reversed())
|
||||
|
@ -1800,7 +1800,7 @@ fn cmd_obslog(ui: &mut Ui, command: &CommandHelper, args: &ObslogArgs) -> Result
|
|||
Box::new(|commit: &Commit| commit.predecessors()),
|
||||
);
|
||||
if !args.no_graph {
|
||||
let mut graph = AsciiGraphDrawer::new(&mut formatter);
|
||||
let mut graph = get_graphlog(command.settings(), &mut formatter);
|
||||
for commit in commits {
|
||||
let mut edges = vec![];
|
||||
for predecessor in &commit.predecessors() {
|
||||
|
@ -3486,7 +3486,7 @@ fn cmd_op_log(
|
|||
relative_timestamps: command.settings().relative_timestamps(),
|
||||
};
|
||||
|
||||
let mut graph = AsciiGraphDrawer::new(&mut formatter);
|
||||
let mut graph = get_graphlog(command.settings(), &mut formatter);
|
||||
for op in topo_order_reverse(
|
||||
vec![head_op],
|
||||
Box::new(|op: &Operation| op.id().clone()),
|
||||
|
|
125
src/graphlog.rs
125
src/graphlog.rs
|
@ -16,6 +16,8 @@ use std::hash::Hash;
|
|||
use std::io;
|
||||
use std::io::Write;
|
||||
|
||||
use jujutsu_lib::settings::UserSettings;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
// An edge to another node in the graph
|
||||
pub enum Edge<T> {
|
||||
|
@ -43,6 +45,119 @@ impl<T> Edge<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait GraphLog<K: Clone + Eq + Hash> {
|
||||
fn add_node(
|
||||
&mut self,
|
||||
id: &K,
|
||||
edges: &[Edge<K>],
|
||||
node_symbol: &str,
|
||||
text: &str,
|
||||
) -> io::Result<()>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "sapling")]
|
||||
mod sapling {
|
||||
use std::hash::Hash;
|
||||
use std::io::{self, Write};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use dag::render::{Ancestor, Renderer};
|
||||
use itertools::Itertools;
|
||||
|
||||
use super::{Edge, GraphLog};
|
||||
|
||||
pub struct SaplingGraphLog<'writer, K, R: Renderer<K, Output = String>> {
|
||||
renderer: R,
|
||||
writer: &'writer mut dyn Write,
|
||||
phantom: PhantomData<K>,
|
||||
}
|
||||
|
||||
impl<K: Clone> From<&Edge<K>> for Ancestor<K> {
|
||||
fn from(e: &Edge<K>) -> Self {
|
||||
match e {
|
||||
Edge::Present {
|
||||
target,
|
||||
direct: true,
|
||||
} => Ancestor::Parent(target.clone()),
|
||||
Edge::Present { target, .. } => Ancestor::Ancestor(target.clone()),
|
||||
Edge::Missing => Ancestor::Anonymous,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'writer, K, R> GraphLog<K> for SaplingGraphLog<'writer, K, R>
|
||||
where
|
||||
K: Clone + Eq + Hash,
|
||||
R: Renderer<K, Output = String>,
|
||||
{
|
||||
fn add_node(
|
||||
&mut self,
|
||||
id: &K,
|
||||
edges: &[Edge<K>],
|
||||
node_symbol: &str,
|
||||
text: &str,
|
||||
) -> io::Result<()> {
|
||||
let row = self.renderer.next_row(
|
||||
id.clone(),
|
||||
edges.iter().map_into().collect(),
|
||||
node_symbol.into(),
|
||||
text.into(),
|
||||
);
|
||||
|
||||
write!(self.writer, "{row}")
|
||||
}
|
||||
}
|
||||
|
||||
impl<'writer, K, R> SaplingGraphLog<'writer, K, R>
|
||||
where
|
||||
K: Clone + Eq + Hash + 'writer,
|
||||
R: Renderer<K, Output = String> + 'writer,
|
||||
{
|
||||
pub fn create(
|
||||
renderer: R,
|
||||
formatter: &'writer mut dyn Write,
|
||||
) -> Box<dyn GraphLog<K> + 'writer> {
|
||||
Box::new(SaplingGraphLog {
|
||||
renderer,
|
||||
writer: formatter,
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_graphlog<'a, K: Clone + Eq + Hash + 'a>(
|
||||
#[allow(unused)] settings: &UserSettings,
|
||||
formatter: &'a mut dyn Write,
|
||||
) -> Box<dyn GraphLog<K> + 'a> {
|
||||
#[cfg(feature = "sapling")]
|
||||
{
|
||||
use dag::render::GraphRowRenderer;
|
||||
use sapling::SaplingGraphLog;
|
||||
|
||||
let builder = GraphRowRenderer::new().output().with_min_row_height(0);
|
||||
|
||||
match settings.graph_format().as_str() {
|
||||
"curved" => return SaplingGraphLog::create(builder.build_box_drawing(), formatter),
|
||||
"square" => {
|
||||
return SaplingGraphLog::create(
|
||||
builder.build_box_drawing().with_square_glyphs(),
|
||||
formatter,
|
||||
);
|
||||
}
|
||||
"ascii-alternative" => {
|
||||
return SaplingGraphLog::create(builder.build_ascii(), formatter)
|
||||
}
|
||||
"ascii-large" => {
|
||||
return SaplingGraphLog::create(builder.build_ascii_large(), formatter)
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
};
|
||||
|
||||
Box::new(AsciiGraphDrawer::new(formatter))
|
||||
}
|
||||
|
||||
pub struct AsciiGraphDrawer<'writer, K> {
|
||||
writer: &'writer mut dyn Write,
|
||||
edges: Vec<Edge<K>>,
|
||||
|
@ -60,8 +175,10 @@ where
|
|||
pending_text: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_node(
|
||||
impl<'writer, K: Clone + Eq + Hash> GraphLog<K> for AsciiGraphDrawer<'writer, K> {
|
||||
fn add_node(
|
||||
&mut self,
|
||||
id: &K,
|
||||
edges: &[Edge<K>],
|
||||
|
@ -96,7 +213,7 @@ where
|
|||
for _ in edge_index + 1..self.edges.len() {
|
||||
write!(self.writer, " \\")?;
|
||||
}
|
||||
write!(self.writer, "\n")?;
|
||||
writeln!(self.writer)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +308,9 @@ where
|
|||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'writer, K: Clone + Eq + Hash> AsciiGraphDrawer<'writer, K> {
|
||||
fn index_by_target(&self, id: &K) -> Option<usize> {
|
||||
for (i, edge) in self.edges.iter().enumerate() {
|
||||
match edge {
|
||||
|
@ -313,7 +432,7 @@ where
|
|||
if let Some(text) = self.pending_text.pop() {
|
||||
write!(self.writer, "{text}")?;
|
||||
}
|
||||
write!(self.writer, "\n")
|
||||
writeln!(self.writer)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue