##// END OF EJS Templates
rust: Use a maintained crate for SHA-1 hashing...
Simon Sapin -
r48171:fad504cf default
parent child Browse files
Show More
@@ -1,1105 +1,1083
1 # This file is automatically @generated by Cargo.
1 # This file is automatically @generated by Cargo.
2 # It is not intended for manual editing.
2 # It is not intended for manual editing.
3 [[package]]
3 [[package]]
4 name = "adler"
4 name = "adler"
5 version = "0.2.3"
5 version = "0.2.3"
6 source = "registry+https://github.com/rust-lang/crates.io-index"
6 source = "registry+https://github.com/rust-lang/crates.io-index"
7 checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
7 checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
8
8
9 [[package]]
9 [[package]]
10 name = "aho-corasick"
10 name = "aho-corasick"
11 version = "0.7.15"
11 version = "0.7.15"
12 source = "registry+https://github.com/rust-lang/crates.io-index"
12 source = "registry+https://github.com/rust-lang/crates.io-index"
13 checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
13 checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
14 dependencies = [
14 dependencies = [
15 "memchr",
15 "memchr",
16 ]
16 ]
17
17
18 [[package]]
18 [[package]]
19 name = "ansi_term"
19 name = "ansi_term"
20 version = "0.11.0"
20 version = "0.11.0"
21 source = "registry+https://github.com/rust-lang/crates.io-index"
21 source = "registry+https://github.com/rust-lang/crates.io-index"
22 checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
22 checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
23 dependencies = [
23 dependencies = [
24 "winapi",
24 "winapi",
25 ]
25 ]
26
26
27 [[package]]
27 [[package]]
28 name = "atty"
28 name = "atty"
29 version = "0.2.14"
29 version = "0.2.14"
30 source = "registry+https://github.com/rust-lang/crates.io-index"
30 source = "registry+https://github.com/rust-lang/crates.io-index"
31 checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
31 checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
32 dependencies = [
32 dependencies = [
33 "hermit-abi",
33 "hermit-abi",
34 "libc",
34 "libc",
35 "winapi",
35 "winapi",
36 ]
36 ]
37
37
38 [[package]]
38 [[package]]
39 name = "autocfg"
39 name = "autocfg"
40 version = "1.0.1"
40 version = "1.0.1"
41 source = "registry+https://github.com/rust-lang/crates.io-index"
41 source = "registry+https://github.com/rust-lang/crates.io-index"
42 checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
42 checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
43
43
44 [[package]]
44 [[package]]
45 name = "bitflags"
45 name = "bitflags"
46 version = "1.2.1"
46 version = "1.2.1"
47 source = "registry+https://github.com/rust-lang/crates.io-index"
47 source = "registry+https://github.com/rust-lang/crates.io-index"
48 checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
48 checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
49
49
50 [[package]]
50 [[package]]
51 name = "bitmaps"
51 name = "bitmaps"
52 version = "2.1.0"
52 version = "2.1.0"
53 source = "registry+https://github.com/rust-lang/crates.io-index"
53 source = "registry+https://github.com/rust-lang/crates.io-index"
54 checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
54 checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
55 dependencies = [
55 dependencies = [
56 "typenum",
56 "typenum",
57 ]
57 ]
58
58
59 [[package]]
59 [[package]]
60 name = "block-buffer"
61 version = "0.9.0"
62 source = "registry+https://github.com/rust-lang/crates.io-index"
63 checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
64 dependencies = [
65 "generic-array",
66 ]
67
68 [[package]]
60 name = "byteorder"
69 name = "byteorder"
61 version = "1.3.4"
70 version = "1.3.4"
62 source = "registry+https://github.com/rust-lang/crates.io-index"
71 source = "registry+https://github.com/rust-lang/crates.io-index"
63 checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
72 checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
64
73
65 [[package]]
74 [[package]]
66 name = "bytes-cast"
75 name = "bytes-cast"
67 version = "0.2.0"
76 version = "0.2.0"
68 source = "registry+https://github.com/rust-lang/crates.io-index"
77 source = "registry+https://github.com/rust-lang/crates.io-index"
69 checksum = "0d434f9a4ecbe987e7ccfda7274b6f82ea52c9b63742565a65cb5e8ba0f2c452"
78 checksum = "0d434f9a4ecbe987e7ccfda7274b6f82ea52c9b63742565a65cb5e8ba0f2c452"
70 dependencies = [
79 dependencies = [
71 "bytes-cast-derive",
80 "bytes-cast-derive",
72 ]
81 ]
73
82
74 [[package]]
83 [[package]]
75 name = "bytes-cast-derive"
84 name = "bytes-cast-derive"
76 version = "0.1.0"
85 version = "0.1.0"
77 source = "registry+https://github.com/rust-lang/crates.io-index"
86 source = "registry+https://github.com/rust-lang/crates.io-index"
78 checksum = "cb936af9de38476664d6b58e529aff30d482e4ce1c5e150293d00730b0d81fdb"
87 checksum = "cb936af9de38476664d6b58e529aff30d482e4ce1c5e150293d00730b0d81fdb"
79 dependencies = [
88 dependencies = [
80 "proc-macro2",
89 "proc-macro2",
81 "quote",
90 "quote",
82 "syn",
91 "syn",
83 ]
92 ]
84
93
85 [[package]]
94 [[package]]
86 name = "cc"
95 name = "cc"
87 version = "1.0.66"
96 version = "1.0.66"
88 source = "registry+https://github.com/rust-lang/crates.io-index"
97 source = "registry+https://github.com/rust-lang/crates.io-index"
89 checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
98 checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
90 dependencies = [
99 dependencies = [
91 "jobserver",
100 "jobserver",
92 ]
101 ]
93
102
94 [[package]]
103 [[package]]
95 name = "cfg-if"
104 name = "cfg-if"
96 version = "0.1.10"
105 version = "0.1.10"
97 source = "registry+https://github.com/rust-lang/crates.io-index"
106 source = "registry+https://github.com/rust-lang/crates.io-index"
98 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
107 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
99
108
100 [[package]]
109 [[package]]
101 name = "cfg-if"
110 name = "cfg-if"
102 version = "1.0.0"
111 version = "1.0.0"
103 source = "registry+https://github.com/rust-lang/crates.io-index"
112 source = "registry+https://github.com/rust-lang/crates.io-index"
104 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
113 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
105
114
106 [[package]]
115 [[package]]
107 name = "chrono"
116 name = "chrono"
108 version = "0.4.19"
117 version = "0.4.19"
109 source = "registry+https://github.com/rust-lang/crates.io-index"
118 source = "registry+https://github.com/rust-lang/crates.io-index"
110 checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
119 checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
111 dependencies = [
120 dependencies = [
112 "libc",
121 "libc",
113 "num-integer",
122 "num-integer",
114 "num-traits",
123 "num-traits",
115 "time",
124 "time",
116 "winapi",
125 "winapi",
117 ]
126 ]
118
127
119 [[package]]
128 [[package]]
120 name = "clap"
129 name = "clap"
121 version = "2.33.3"
130 version = "2.33.3"
122 source = "registry+https://github.com/rust-lang/crates.io-index"
131 source = "registry+https://github.com/rust-lang/crates.io-index"
123 checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
132 checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
124 dependencies = [
133 dependencies = [
125 "ansi_term",
134 "ansi_term",
126 "atty",
135 "atty",
127 "bitflags",
136 "bitflags",
128 "strsim",
137 "strsim",
129 "textwrap",
138 "textwrap",
130 "unicode-width",
139 "unicode-width",
131 "vec_map",
140 "vec_map",
132 ]
141 ]
133
142
134 [[package]]
143 [[package]]
135 name = "const_fn"
144 name = "const_fn"
136 version = "0.4.4"
145 version = "0.4.4"
137 source = "registry+https://github.com/rust-lang/crates.io-index"
146 source = "registry+https://github.com/rust-lang/crates.io-index"
138 checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
147 checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
139
148
140 [[package]]
149 [[package]]
150 name = "cpufeatures"
151 version = "0.1.4"
152 source = "registry+https://github.com/rust-lang/crates.io-index"
153 checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8"
154 dependencies = [
155 "libc",
156 ]
157
158 [[package]]
141 name = "cpython"
159 name = "cpython"
142 version = "0.5.2"
160 version = "0.5.2"
143 source = "registry+https://github.com/rust-lang/crates.io-index"
161 source = "registry+https://github.com/rust-lang/crates.io-index"
144 checksum = "0f11357af68648b6a227e7e2384d439cec8595de65970f45e3f7f4b2600be472"
162 checksum = "0f11357af68648b6a227e7e2384d439cec8595de65970f45e3f7f4b2600be472"
145 dependencies = [
163 dependencies = [
146 "libc",
164 "libc",
147 "num-traits",
165 "num-traits",
148 "paste",
166 "paste",
149 "python27-sys",
167 "python27-sys",
150 "python3-sys",
168 "python3-sys",
151 ]
169 ]
152
170
153 [[package]]
171 [[package]]
154 name = "crc32fast"
172 name = "crc32fast"
155 version = "1.2.1"
173 version = "1.2.1"
156 source = "registry+https://github.com/rust-lang/crates.io-index"
174 source = "registry+https://github.com/rust-lang/crates.io-index"
157 checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
175 checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
158 dependencies = [
176 dependencies = [
159 "cfg-if 1.0.0",
177 "cfg-if 1.0.0",
160 ]
178 ]
161
179
162 [[package]]
180 [[package]]
163 name = "crossbeam-channel"
181 name = "crossbeam-channel"
164 version = "0.4.4"
182 version = "0.4.4"
165 source = "registry+https://github.com/rust-lang/crates.io-index"
183 source = "registry+https://github.com/rust-lang/crates.io-index"
166 checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
184 checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
167 dependencies = [
185 dependencies = [
168 "crossbeam-utils 0.7.2",
186 "crossbeam-utils 0.7.2",
169 "maybe-uninit",
187 "maybe-uninit",
170 ]
188 ]
171
189
172 [[package]]
190 [[package]]
173 name = "crossbeam-channel"
191 name = "crossbeam-channel"
174 version = "0.5.0"
192 version = "0.5.0"
175 source = "registry+https://github.com/rust-lang/crates.io-index"
193 source = "registry+https://github.com/rust-lang/crates.io-index"
176 checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
194 checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
177 dependencies = [
195 dependencies = [
178 "cfg-if 1.0.0",
196 "cfg-if 1.0.0",
179 "crossbeam-utils 0.8.1",
197 "crossbeam-utils 0.8.1",
180 ]
198 ]
181
199
182 [[package]]
200 [[package]]
183 name = "crossbeam-deque"
201 name = "crossbeam-deque"
184 version = "0.8.0"
202 version = "0.8.0"
185 source = "registry+https://github.com/rust-lang/crates.io-index"
203 source = "registry+https://github.com/rust-lang/crates.io-index"
186 checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
204 checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
187 dependencies = [
205 dependencies = [
188 "cfg-if 1.0.0",
206 "cfg-if 1.0.0",
189 "crossbeam-epoch",
207 "crossbeam-epoch",
190 "crossbeam-utils 0.8.1",
208 "crossbeam-utils 0.8.1",
191 ]
209 ]
192
210
193 [[package]]
211 [[package]]
194 name = "crossbeam-epoch"
212 name = "crossbeam-epoch"
195 version = "0.9.1"
213 version = "0.9.1"
196 source = "registry+https://github.com/rust-lang/crates.io-index"
214 source = "registry+https://github.com/rust-lang/crates.io-index"
197 checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
215 checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
198 dependencies = [
216 dependencies = [
199 "cfg-if 1.0.0",
217 "cfg-if 1.0.0",
200 "const_fn",
218 "const_fn",
201 "crossbeam-utils 0.8.1",
219 "crossbeam-utils 0.8.1",
202 "lazy_static",
220 "lazy_static",
203 "memoffset",
221 "memoffset",
204 "scopeguard",
222 "scopeguard",
205 ]
223 ]
206
224
207 [[package]]
225 [[package]]
208 name = "crossbeam-utils"
226 name = "crossbeam-utils"
209 version = "0.7.2"
227 version = "0.7.2"
210 source = "registry+https://github.com/rust-lang/crates.io-index"
228 source = "registry+https://github.com/rust-lang/crates.io-index"
211 checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
229 checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
212 dependencies = [
230 dependencies = [
213 "autocfg",
231 "autocfg",
214 "cfg-if 0.1.10",
232 "cfg-if 0.1.10",
215 "lazy_static",
233 "lazy_static",
216 ]
234 ]
217
235
218 [[package]]
236 [[package]]
219 name = "crossbeam-utils"
237 name = "crossbeam-utils"
220 version = "0.8.1"
238 version = "0.8.1"
221 source = "registry+https://github.com/rust-lang/crates.io-index"
239 source = "registry+https://github.com/rust-lang/crates.io-index"
222 checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
240 checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
223 dependencies = [
241 dependencies = [
224 "autocfg",
242 "autocfg",
225 "cfg-if 1.0.0",
243 "cfg-if 1.0.0",
226 "lazy_static",
244 "lazy_static",
227 ]
245 ]
228
246
229 [[package]]
247 [[package]]
230 name = "ctor"
248 name = "ctor"
231 version = "0.1.16"
249 version = "0.1.16"
232 source = "registry+https://github.com/rust-lang/crates.io-index"
250 source = "registry+https://github.com/rust-lang/crates.io-index"
233 checksum = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
251 checksum = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
234 dependencies = [
252 dependencies = [
235 "quote",
253 "quote",
236 "syn",
254 "syn",
237 ]
255 ]
238
256
239 [[package]]
257 [[package]]
240 name = "derive_more"
258 name = "derive_more"
241 version = "0.99.11"
259 version = "0.99.11"
242 source = "registry+https://github.com/rust-lang/crates.io-index"
260 source = "registry+https://github.com/rust-lang/crates.io-index"
243 checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
261 checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
244 dependencies = [
262 dependencies = [
245 "proc-macro2",
263 "proc-macro2",
246 "quote",
264 "quote",
247 "syn",
265 "syn",
248 ]
266 ]
249
267
250 [[package]]
268 [[package]]
251 name = "difference"
269 name = "difference"
252 version = "2.0.0"
270 version = "2.0.0"
253 source = "registry+https://github.com/rust-lang/crates.io-index"
271 source = "registry+https://github.com/rust-lang/crates.io-index"
254 checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
272 checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
255
273
256 [[package]]
274 [[package]]
275 name = "digest"
276 version = "0.9.0"
277 source = "registry+https://github.com/rust-lang/crates.io-index"
278 checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
279 dependencies = [
280 "generic-array",
281 ]
282
283 [[package]]
257 name = "either"
284 name = "either"
258 version = "1.6.1"
285 version = "1.6.1"
259 source = "registry+https://github.com/rust-lang/crates.io-index"
286 source = "registry+https://github.com/rust-lang/crates.io-index"
260 checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
287 checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
261
288
262 [[package]]
289 [[package]]
263 name = "env_logger"
290 name = "env_logger"
264 version = "0.7.1"
291 version = "0.7.1"
265 source = "registry+https://github.com/rust-lang/crates.io-index"
292 source = "registry+https://github.com/rust-lang/crates.io-index"
266 checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
293 checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
267 dependencies = [
294 dependencies = [
268 "atty",
295 "atty",
269 "humantime",
296 "humantime",
270 "log",
297 "log",
271 "regex",
298 "regex",
272 "termcolor",
299 "termcolor",
273 ]
300 ]
274
301
275 [[package]]
302 [[package]]
276 name = "flate2"
303 name = "flate2"
277 version = "1.0.19"
304 version = "1.0.19"
278 source = "registry+https://github.com/rust-lang/crates.io-index"
305 source = "registry+https://github.com/rust-lang/crates.io-index"
279 checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129"
306 checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129"
280 dependencies = [
307 dependencies = [
281 "cfg-if 1.0.0",
308 "cfg-if 1.0.0",
282 "crc32fast",
309 "crc32fast",
283 "libc",
310 "libc",
284 "libz-sys",
311 "libz-sys",
285 "miniz_oxide",
312 "miniz_oxide",
286 ]
313 ]
287
314
288 [[package]]
315 [[package]]
289 name = "format-bytes"
316 name = "format-bytes"
290 version = "0.2.2"
317 version = "0.2.2"
291 source = "registry+https://github.com/rust-lang/crates.io-index"
318 source = "registry+https://github.com/rust-lang/crates.io-index"
292 checksum = "1c4e89040c7fd7b4e6ba2820ac705a45def8a0c098ec78d170ae88f1ef1d5762"
319 checksum = "1c4e89040c7fd7b4e6ba2820ac705a45def8a0c098ec78d170ae88f1ef1d5762"
293 dependencies = [
320 dependencies = [
294 "format-bytes-macros",
321 "format-bytes-macros",
295 "proc-macro-hack",
322 "proc-macro-hack",
296 ]
323 ]
297
324
298 [[package]]
325 [[package]]
299 name = "format-bytes-macros"
326 name = "format-bytes-macros"
300 version = "0.3.0"
327 version = "0.3.0"
301 source = "registry+https://github.com/rust-lang/crates.io-index"
328 source = "registry+https://github.com/rust-lang/crates.io-index"
302 checksum = "b05089e341a0460449e2210c3bf7b61597860b07f0deae58da38dbed0a4c6b6d"
329 checksum = "b05089e341a0460449e2210c3bf7b61597860b07f0deae58da38dbed0a4c6b6d"
303 dependencies = [
330 dependencies = [
304 "proc-macro-hack",
331 "proc-macro-hack",
305 "proc-macro2",
332 "proc-macro2",
306 "quote",
333 "quote",
307 "syn",
334 "syn",
308 ]
335 ]
309
336
310 [[package]]
337 [[package]]
311 name = "fuchsia-cprng"
338 name = "generic-array"
312 version = "0.1.1"
339 version = "0.14.4"
313 source = "registry+https://github.com/rust-lang/crates.io-index"
340 source = "registry+https://github.com/rust-lang/crates.io-index"
314 checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
341 checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
315
342 dependencies = [
316 [[package]]
343 "typenum",
317 name = "gcc"
344 "version_check",
318 version = "0.3.55"
345 ]
319 source = "registry+https://github.com/rust-lang/crates.io-index"
320 checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
321
346
322 [[package]]
347 [[package]]
323 name = "getrandom"
348 name = "getrandom"
324 version = "0.1.15"
349 version = "0.1.15"
325 source = "registry+https://github.com/rust-lang/crates.io-index"
350 source = "registry+https://github.com/rust-lang/crates.io-index"
326 checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
351 checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
327 dependencies = [
352 dependencies = [
328 "cfg-if 0.1.10",
353 "cfg-if 0.1.10",
329 "libc",
354 "libc",
330 "wasi 0.9.0+wasi-snapshot-preview1",
355 "wasi 0.9.0+wasi-snapshot-preview1",
331 ]
356 ]
332
357
333 [[package]]
358 [[package]]
334 name = "glob"
359 name = "glob"
335 version = "0.3.0"
360 version = "0.3.0"
336 source = "registry+https://github.com/rust-lang/crates.io-index"
361 source = "registry+https://github.com/rust-lang/crates.io-index"
337 checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
362 checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
338
363
339 [[package]]
364 [[package]]
340 name = "hermit-abi"
365 name = "hermit-abi"
341 version = "0.1.17"
366 version = "0.1.17"
342 source = "registry+https://github.com/rust-lang/crates.io-index"
367 source = "registry+https://github.com/rust-lang/crates.io-index"
343 checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
368 checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
344 dependencies = [
369 dependencies = [
345 "libc",
370 "libc",
346 ]
371 ]
347
372
348 [[package]]
373 [[package]]
349 name = "hg-core"
374 name = "hg-core"
350 version = "0.1.0"
375 version = "0.1.0"
351 dependencies = [
376 dependencies = [
352 "byteorder",
377 "byteorder",
353 "bytes-cast",
378 "bytes-cast",
354 "clap",
379 "clap",
355 "crossbeam-channel 0.4.4",
380 "crossbeam-channel 0.4.4",
356 "derive_more",
381 "derive_more",
357 "flate2",
382 "flate2",
358 "format-bytes",
383 "format-bytes",
359 "home",
384 "home",
360 "im-rc",
385 "im-rc",
361 "itertools",
386 "itertools",
362 "lazy_static",
387 "lazy_static",
363 "log",
388 "log",
364 "memmap",
389 "memmap",
365 "micro-timer",
390 "micro-timer",
366 "pretty_assertions",
391 "pretty_assertions",
367 "rand 0.7.3",
392 "rand",
368 "rand_distr",
393 "rand_distr",
369 "rand_pcg",
394 "rand_pcg",
370 "rayon",
395 "rayon",
371 "regex",
396 "regex",
372 "rust-crypto",
373 "same-file",
397 "same-file",
398 "sha-1",
374 "tempfile",
399 "tempfile",
375 "twox-hash",
400 "twox-hash",
376 "zstd",
401 "zstd",
377 ]
402 ]
378
403
379 [[package]]
404 [[package]]
380 name = "hg-cpython"
405 name = "hg-cpython"
381 version = "0.1.0"
406 version = "0.1.0"
382 dependencies = [
407 dependencies = [
383 "cpython",
408 "cpython",
384 "crossbeam-channel 0.4.4",
409 "crossbeam-channel 0.4.4",
385 "env_logger",
410 "env_logger",
386 "hg-core",
411 "hg-core",
387 "libc",
412 "libc",
388 "log",
413 "log",
389 ]
414 ]
390
415
391 [[package]]
416 [[package]]
392 name = "home"
417 name = "home"
393 version = "0.5.3"
418 version = "0.5.3"
394 source = "registry+https://github.com/rust-lang/crates.io-index"
419 source = "registry+https://github.com/rust-lang/crates.io-index"
395 checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654"
420 checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654"
396 dependencies = [
421 dependencies = [
397 "winapi",
422 "winapi",
398 ]
423 ]
399
424
400 [[package]]
425 [[package]]
401 name = "humantime"
426 name = "humantime"
402 version = "1.3.0"
427 version = "1.3.0"
403 source = "registry+https://github.com/rust-lang/crates.io-index"
428 source = "registry+https://github.com/rust-lang/crates.io-index"
404 checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
429 checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
405 dependencies = [
430 dependencies = [
406 "quick-error",
431 "quick-error",
407 ]
432 ]
408
433
409 [[package]]
434 [[package]]
410 name = "im-rc"
435 name = "im-rc"
411 version = "15.0.0"
436 version = "15.0.0"
412 source = "registry+https://github.com/rust-lang/crates.io-index"
437 source = "registry+https://github.com/rust-lang/crates.io-index"
413 checksum = "3ca8957e71f04a205cb162508f9326aea04676c8dfd0711220190d6b83664f3f"
438 checksum = "3ca8957e71f04a205cb162508f9326aea04676c8dfd0711220190d6b83664f3f"
414 dependencies = [
439 dependencies = [
415 "bitmaps",
440 "bitmaps",
416 "rand_core 0.5.1",
441 "rand_core",
417 "rand_xoshiro",
442 "rand_xoshiro",
418 "sized-chunks",
443 "sized-chunks",
419 "typenum",
444 "typenum",
420 "version_check",
445 "version_check",
421 ]
446 ]
422
447
423 [[package]]
448 [[package]]
424 name = "itertools"
449 name = "itertools"
425 version = "0.9.0"
450 version = "0.9.0"
426 source = "registry+https://github.com/rust-lang/crates.io-index"
451 source = "registry+https://github.com/rust-lang/crates.io-index"
427 checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
452 checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
428 dependencies = [
453 dependencies = [
429 "either",
454 "either",
430 ]
455 ]
431
456
432 [[package]]
457 [[package]]
433 name = "jobserver"
458 name = "jobserver"
434 version = "0.1.21"
459 version = "0.1.21"
435 source = "registry+https://github.com/rust-lang/crates.io-index"
460 source = "registry+https://github.com/rust-lang/crates.io-index"
436 checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
461 checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
437 dependencies = [
462 dependencies = [
438 "libc",
463 "libc",
439 ]
464 ]
440
465
441 [[package]]
466 [[package]]
442 name = "lazy_static"
467 name = "lazy_static"
443 version = "1.4.0"
468 version = "1.4.0"
444 source = "registry+https://github.com/rust-lang/crates.io-index"
469 source = "registry+https://github.com/rust-lang/crates.io-index"
445 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
470 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
446
471
447 [[package]]
472 [[package]]
448 name = "libc"
473 name = "libc"
449 version = "0.2.81"
474 version = "0.2.81"
450 source = "registry+https://github.com/rust-lang/crates.io-index"
475 source = "registry+https://github.com/rust-lang/crates.io-index"
451 checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
476 checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
452
477
453 [[package]]
478 [[package]]
454 name = "libz-sys"
479 name = "libz-sys"
455 version = "1.1.2"
480 version = "1.1.2"
456 source = "registry+https://github.com/rust-lang/crates.io-index"
481 source = "registry+https://github.com/rust-lang/crates.io-index"
457 checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
482 checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
458 dependencies = [
483 dependencies = [
459 "cc",
484 "cc",
460 "pkg-config",
485 "pkg-config",
461 "vcpkg",
486 "vcpkg",
462 ]
487 ]
463
488
464 [[package]]
489 [[package]]
465 name = "log"
490 name = "log"
466 version = "0.4.11"
491 version = "0.4.11"
467 source = "registry+https://github.com/rust-lang/crates.io-index"
492 source = "registry+https://github.com/rust-lang/crates.io-index"
468 checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
493 checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
469 dependencies = [
494 dependencies = [
470 "cfg-if 0.1.10",
495 "cfg-if 0.1.10",
471 ]
496 ]
472
497
473 [[package]]
498 [[package]]
474 name = "maybe-uninit"
499 name = "maybe-uninit"
475 version = "2.0.0"
500 version = "2.0.0"
476 source = "registry+https://github.com/rust-lang/crates.io-index"
501 source = "registry+https://github.com/rust-lang/crates.io-index"
477 checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
502 checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
478
503
479 [[package]]
504 [[package]]
480 name = "memchr"
505 name = "memchr"
481 version = "2.3.4"
506 version = "2.3.4"
482 source = "registry+https://github.com/rust-lang/crates.io-index"
507 source = "registry+https://github.com/rust-lang/crates.io-index"
483 checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
508 checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
484
509
485 [[package]]
510 [[package]]
486 name = "memmap"
511 name = "memmap"
487 version = "0.7.0"
512 version = "0.7.0"
488 source = "registry+https://github.com/rust-lang/crates.io-index"
513 source = "registry+https://github.com/rust-lang/crates.io-index"
489 checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
514 checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
490 dependencies = [
515 dependencies = [
491 "libc",
516 "libc",
492 "winapi",
517 "winapi",
493 ]
518 ]
494
519
495 [[package]]
520 [[package]]
496 name = "memoffset"
521 name = "memoffset"
497 version = "0.6.1"
522 version = "0.6.1"
498 source = "registry+https://github.com/rust-lang/crates.io-index"
523 source = "registry+https://github.com/rust-lang/crates.io-index"
499 checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
524 checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
500 dependencies = [
525 dependencies = [
501 "autocfg",
526 "autocfg",
502 ]
527 ]
503
528
504 [[package]]
529 [[package]]
505 name = "micro-timer"
530 name = "micro-timer"
506 version = "0.3.1"
531 version = "0.3.1"
507 source = "registry+https://github.com/rust-lang/crates.io-index"
532 source = "registry+https://github.com/rust-lang/crates.io-index"
508 checksum = "2620153e1d903d26b72b89f0e9c48d8c4756cba941c185461dddc234980c298c"
533 checksum = "2620153e1d903d26b72b89f0e9c48d8c4756cba941c185461dddc234980c298c"
509 dependencies = [
534 dependencies = [
510 "micro-timer-macros",
535 "micro-timer-macros",
511 "scopeguard",
536 "scopeguard",
512 ]
537 ]
513
538
514 [[package]]
539 [[package]]
515 name = "micro-timer-macros"
540 name = "micro-timer-macros"
516 version = "0.3.1"
541 version = "0.3.1"
517 source = "registry+https://github.com/rust-lang/crates.io-index"
542 source = "registry+https://github.com/rust-lang/crates.io-index"
518 checksum = "e28a3473e6abd6e9aab36aaeef32ad22ae0bd34e79f376643594c2b152ec1c5d"
543 checksum = "e28a3473e6abd6e9aab36aaeef32ad22ae0bd34e79f376643594c2b152ec1c5d"
519 dependencies = [
544 dependencies = [
520 "proc-macro2",
545 "proc-macro2",
521 "quote",
546 "quote",
522 "scopeguard",
547 "scopeguard",
523 "syn",
548 "syn",
524 ]
549 ]
525
550
526 [[package]]
551 [[package]]
527 name = "miniz_oxide"
552 name = "miniz_oxide"
528 version = "0.4.3"
553 version = "0.4.3"
529 source = "registry+https://github.com/rust-lang/crates.io-index"
554 source = "registry+https://github.com/rust-lang/crates.io-index"
530 checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
555 checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
531 dependencies = [
556 dependencies = [
532 "adler",
557 "adler",
533 "autocfg",
558 "autocfg",
534 ]
559 ]
535
560
536 [[package]]
561 [[package]]
537 name = "num-integer"
562 name = "num-integer"
538 version = "0.1.44"
563 version = "0.1.44"
539 source = "registry+https://github.com/rust-lang/crates.io-index"
564 source = "registry+https://github.com/rust-lang/crates.io-index"
540 checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
565 checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
541 dependencies = [
566 dependencies = [
542 "autocfg",
567 "autocfg",
543 "num-traits",
568 "num-traits",
544 ]
569 ]
545
570
546 [[package]]
571 [[package]]
547 name = "num-traits"
572 name = "num-traits"
548 version = "0.2.14"
573 version = "0.2.14"
549 source = "registry+https://github.com/rust-lang/crates.io-index"
574 source = "registry+https://github.com/rust-lang/crates.io-index"
550 checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
575 checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
551 dependencies = [
576 dependencies = [
552 "autocfg",
577 "autocfg",
553 ]
578 ]
554
579
555 [[package]]
580 [[package]]
556 name = "num_cpus"
581 name = "num_cpus"
557 version = "1.13.0"
582 version = "1.13.0"
558 source = "registry+https://github.com/rust-lang/crates.io-index"
583 source = "registry+https://github.com/rust-lang/crates.io-index"
559 checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
584 checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
560 dependencies = [
585 dependencies = [
561 "hermit-abi",
586 "hermit-abi",
562 "libc",
587 "libc",
563 ]
588 ]
564
589
565 [[package]]
590 [[package]]
591 name = "opaque-debug"
592 version = "0.3.0"
593 source = "registry+https://github.com/rust-lang/crates.io-index"
594 checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
595
596 [[package]]
566 name = "output_vt100"
597 name = "output_vt100"
567 version = "0.1.2"
598 version = "0.1.2"
568 source = "registry+https://github.com/rust-lang/crates.io-index"
599 source = "registry+https://github.com/rust-lang/crates.io-index"
569 checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9"
600 checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9"
570 dependencies = [
601 dependencies = [
571 "winapi",
602 "winapi",
572 ]
603 ]
573
604
574 [[package]]
605 [[package]]
575 name = "paste"
606 name = "paste"
576 version = "0.1.18"
607 version = "0.1.18"
577 source = "registry+https://github.com/rust-lang/crates.io-index"
608 source = "registry+https://github.com/rust-lang/crates.io-index"
578 checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
609 checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
579 dependencies = [
610 dependencies = [
580 "paste-impl",
611 "paste-impl",
581 "proc-macro-hack",
612 "proc-macro-hack",
582 ]
613 ]
583
614
584 [[package]]
615 [[package]]
585 name = "paste-impl"
616 name = "paste-impl"
586 version = "0.1.18"
617 version = "0.1.18"
587 source = "registry+https://github.com/rust-lang/crates.io-index"
618 source = "registry+https://github.com/rust-lang/crates.io-index"
588 checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
619 checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
589 dependencies = [
620 dependencies = [
590 "proc-macro-hack",
621 "proc-macro-hack",
591 ]
622 ]
592
623
593 [[package]]
624 [[package]]
594 name = "pkg-config"
625 name = "pkg-config"
595 version = "0.3.19"
626 version = "0.3.19"
596 source = "registry+https://github.com/rust-lang/crates.io-index"
627 source = "registry+https://github.com/rust-lang/crates.io-index"
597 checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
628 checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
598
629
599 [[package]]
630 [[package]]
600 name = "ppv-lite86"
631 name = "ppv-lite86"
601 version = "0.2.10"
632 version = "0.2.10"
602 source = "registry+https://github.com/rust-lang/crates.io-index"
633 source = "registry+https://github.com/rust-lang/crates.io-index"
603 checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
634 checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
604
635
605 [[package]]
636 [[package]]
606 name = "pretty_assertions"
637 name = "pretty_assertions"
607 version = "0.6.1"
638 version = "0.6.1"
608 source = "registry+https://github.com/rust-lang/crates.io-index"
639 source = "registry+https://github.com/rust-lang/crates.io-index"
609 checksum = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427"
640 checksum = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427"
610 dependencies = [
641 dependencies = [
611 "ansi_term",
642 "ansi_term",
612 "ctor",
643 "ctor",
613 "difference",
644 "difference",
614 "output_vt100",
645 "output_vt100",
615 ]
646 ]
616
647
617 [[package]]
648 [[package]]
618 name = "proc-macro-hack"
649 name = "proc-macro-hack"
619 version = "0.5.19"
650 version = "0.5.19"
620 source = "registry+https://github.com/rust-lang/crates.io-index"
651 source = "registry+https://github.com/rust-lang/crates.io-index"
621 checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
652 checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
622
653
623 [[package]]
654 [[package]]
624 name = "proc-macro2"
655 name = "proc-macro2"
625 version = "1.0.24"
656 version = "1.0.24"
626 source = "registry+https://github.com/rust-lang/crates.io-index"
657 source = "registry+https://github.com/rust-lang/crates.io-index"
627 checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
658 checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
628 dependencies = [
659 dependencies = [
629 "unicode-xid",
660 "unicode-xid",
630 ]
661 ]
631
662
632 [[package]]
663 [[package]]
633 name = "python27-sys"
664 name = "python27-sys"
634 version = "0.5.2"
665 version = "0.5.2"
635 source = "registry+https://github.com/rust-lang/crates.io-index"
666 source = "registry+https://github.com/rust-lang/crates.io-index"
636 checksum = "f485897ed7048f5032317c4e427800ef9f2053355516524d73952b8b07032054"
667 checksum = "f485897ed7048f5032317c4e427800ef9f2053355516524d73952b8b07032054"
637 dependencies = [
668 dependencies = [
638 "libc",
669 "libc",
639 "regex",
670 "regex",
640 ]
671 ]
641
672
642 [[package]]
673 [[package]]
643 name = "python3-sys"
674 name = "python3-sys"
644 version = "0.5.2"
675 version = "0.5.2"
645 source = "registry+https://github.com/rust-lang/crates.io-index"
676 source = "registry+https://github.com/rust-lang/crates.io-index"
646 checksum = "5b29b99c6868eb02beb3bf6ed025c8bcdf02efc149b8e80347d3e5d059a806db"
677 checksum = "5b29b99c6868eb02beb3bf6ed025c8bcdf02efc149b8e80347d3e5d059a806db"
647 dependencies = [
678 dependencies = [
648 "libc",
679 "libc",
649 "regex",
680 "regex",
650 ]
681 ]
651
682
652 [[package]]
683 [[package]]
653 name = "quick-error"
684 name = "quick-error"
654 version = "1.2.3"
685 version = "1.2.3"
655 source = "registry+https://github.com/rust-lang/crates.io-index"
686 source = "registry+https://github.com/rust-lang/crates.io-index"
656 checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
687 checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
657
688
658 [[package]]
689 [[package]]
659 name = "quote"
690 name = "quote"
660 version = "1.0.7"
691 version = "1.0.7"
661 source = "registry+https://github.com/rust-lang/crates.io-index"
692 source = "registry+https://github.com/rust-lang/crates.io-index"
662 checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
693 checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
663 dependencies = [
694 dependencies = [
664 "proc-macro2",
695 "proc-macro2",
665 ]
696 ]
666
697
667 [[package]]
698 [[package]]
668 name = "rand"
699 name = "rand"
669 version = "0.3.23"
670 source = "registry+https://github.com/rust-lang/crates.io-index"
671 checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
672 dependencies = [
673 "libc",
674 "rand 0.4.6",
675 ]
676
677 [[package]]
678 name = "rand"
679 version = "0.4.6"
680 source = "registry+https://github.com/rust-lang/crates.io-index"
681 checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
682 dependencies = [
683 "fuchsia-cprng",
684 "libc",
685 "rand_core 0.3.1",
686 "rdrand",
687 "winapi",
688 ]
689
690 [[package]]
691 name = "rand"
692 version = "0.7.3"
700 version = "0.7.3"
693 source = "registry+https://github.com/rust-lang/crates.io-index"
701 source = "registry+https://github.com/rust-lang/crates.io-index"
694 checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
702 checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
695 dependencies = [
703 dependencies = [
696 "getrandom",
704 "getrandom",
697 "libc",
705 "libc",
698 "rand_chacha",
706 "rand_chacha",
699 "rand_core 0.5.1",
707 "rand_core",
700 "rand_hc",
708 "rand_hc",
701 ]
709 ]
702
710
703 [[package]]
711 [[package]]
704 name = "rand_chacha"
712 name = "rand_chacha"
705 version = "0.2.2"
713 version = "0.2.2"
706 source = "registry+https://github.com/rust-lang/crates.io-index"
714 source = "registry+https://github.com/rust-lang/crates.io-index"
707 checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
715 checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
708 dependencies = [
716 dependencies = [
709 "ppv-lite86",
717 "ppv-lite86",
710 "rand_core 0.5.1",
718 "rand_core",
711 ]
719 ]
712
720
713 [[package]]
721 [[package]]
714 name = "rand_core"
722 name = "rand_core"
715 version = "0.3.1"
716 source = "registry+https://github.com/rust-lang/crates.io-index"
717 checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
718 dependencies = [
719 "rand_core 0.4.2",
720 ]
721
722 [[package]]
723 name = "rand_core"
724 version = "0.4.2"
725 source = "registry+https://github.com/rust-lang/crates.io-index"
726 checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
727
728 [[package]]
729 name = "rand_core"
730 version = "0.5.1"
723 version = "0.5.1"
731 source = "registry+https://github.com/rust-lang/crates.io-index"
724 source = "registry+https://github.com/rust-lang/crates.io-index"
732 checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
725 checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
733 dependencies = [
726 dependencies = [
734 "getrandom",
727 "getrandom",
735 ]
728 ]
736
729
737 [[package]]
730 [[package]]
738 name = "rand_distr"
731 name = "rand_distr"
739 version = "0.2.2"
732 version = "0.2.2"
740 source = "registry+https://github.com/rust-lang/crates.io-index"
733 source = "registry+https://github.com/rust-lang/crates.io-index"
741 checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2"
734 checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2"
742 dependencies = [
735 dependencies = [
743 "rand 0.7.3",
736 "rand",
744 ]
737 ]
745
738
746 [[package]]
739 [[package]]
747 name = "rand_hc"
740 name = "rand_hc"
748 version = "0.2.0"
741 version = "0.2.0"
749 source = "registry+https://github.com/rust-lang/crates.io-index"
742 source = "registry+https://github.com/rust-lang/crates.io-index"
750 checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
743 checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
751 dependencies = [
744 dependencies = [
752 "rand_core 0.5.1",
745 "rand_core",
753 ]
746 ]
754
747
755 [[package]]
748 [[package]]
756 name = "rand_pcg"
749 name = "rand_pcg"
757 version = "0.2.1"
750 version = "0.2.1"
758 source = "registry+https://github.com/rust-lang/crates.io-index"
751 source = "registry+https://github.com/rust-lang/crates.io-index"
759 checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
752 checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
760 dependencies = [
753 dependencies = [
761 "rand_core 0.5.1",
754 "rand_core",
762 ]
755 ]
763
756
764 [[package]]
757 [[package]]
765 name = "rand_xoshiro"
758 name = "rand_xoshiro"
766 version = "0.4.0"
759 version = "0.4.0"
767 source = "registry+https://github.com/rust-lang/crates.io-index"
760 source = "registry+https://github.com/rust-lang/crates.io-index"
768 checksum = "a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004"
761 checksum = "a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004"
769 dependencies = [
762 dependencies = [
770 "rand_core 0.5.1",
763 "rand_core",
771 ]
764 ]
772
765
773 [[package]]
766 [[package]]
774 name = "rayon"
767 name = "rayon"
775 version = "1.5.0"
768 version = "1.5.0"
776 source = "registry+https://github.com/rust-lang/crates.io-index"
769 source = "registry+https://github.com/rust-lang/crates.io-index"
777 checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
770 checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
778 dependencies = [
771 dependencies = [
779 "autocfg",
772 "autocfg",
780 "crossbeam-deque",
773 "crossbeam-deque",
781 "either",
774 "either",
782 "rayon-core",
775 "rayon-core",
783 ]
776 ]
784
777
785 [[package]]
778 [[package]]
786 name = "rayon-core"
779 name = "rayon-core"
787 version = "1.9.0"
780 version = "1.9.0"
788 source = "registry+https://github.com/rust-lang/crates.io-index"
781 source = "registry+https://github.com/rust-lang/crates.io-index"
789 checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
782 checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
790 dependencies = [
783 dependencies = [
791 "crossbeam-channel 0.5.0",
784 "crossbeam-channel 0.5.0",
792 "crossbeam-deque",
785 "crossbeam-deque",
793 "crossbeam-utils 0.8.1",
786 "crossbeam-utils 0.8.1",
794 "lazy_static",
787 "lazy_static",
795 "num_cpus",
788 "num_cpus",
796 ]
789 ]
797
790
798 [[package]]
791 [[package]]
799 name = "rdrand"
800 version = "0.4.0"
801 source = "registry+https://github.com/rust-lang/crates.io-index"
802 checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
803 dependencies = [
804 "rand_core 0.3.1",
805 ]
806
807 [[package]]
808 name = "redox_syscall"
792 name = "redox_syscall"
809 version = "0.1.57"
793 version = "0.1.57"
810 source = "registry+https://github.com/rust-lang/crates.io-index"
794 source = "registry+https://github.com/rust-lang/crates.io-index"
811 checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
795 checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
812
796
813 [[package]]
797 [[package]]
814 name = "regex"
798 name = "regex"
815 version = "1.4.2"
799 version = "1.4.2"
816 source = "registry+https://github.com/rust-lang/crates.io-index"
800 source = "registry+https://github.com/rust-lang/crates.io-index"
817 checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
801 checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
818 dependencies = [
802 dependencies = [
819 "aho-corasick",
803 "aho-corasick",
820 "memchr",
804 "memchr",
821 "regex-syntax",
805 "regex-syntax",
822 "thread_local",
806 "thread_local",
823 ]
807 ]
824
808
825 [[package]]
809 [[package]]
826 name = "regex-syntax"
810 name = "regex-syntax"
827 version = "0.6.21"
811 version = "0.6.21"
828 source = "registry+https://github.com/rust-lang/crates.io-index"
812 source = "registry+https://github.com/rust-lang/crates.io-index"
829 checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
813 checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
830
814
831 [[package]]
815 [[package]]
832 name = "remove_dir_all"
816 name = "remove_dir_all"
833 version = "0.5.3"
817 version = "0.5.3"
834 source = "registry+https://github.com/rust-lang/crates.io-index"
818 source = "registry+https://github.com/rust-lang/crates.io-index"
835 checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
819 checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
836 dependencies = [
820 dependencies = [
837 "winapi",
821 "winapi",
838 ]
822 ]
839
823
840 [[package]]
824 [[package]]
841 name = "rhg"
825 name = "rhg"
842 version = "0.1.0"
826 version = "0.1.0"
843 dependencies = [
827 dependencies = [
844 "chrono",
828 "chrono",
845 "clap",
829 "clap",
846 "derive_more",
830 "derive_more",
847 "env_logger",
831 "env_logger",
848 "format-bytes",
832 "format-bytes",
849 "hg-core",
833 "hg-core",
850 "lazy_static",
834 "lazy_static",
851 "log",
835 "log",
852 "micro-timer",
836 "micro-timer",
853 "regex",
837 "regex",
854 "users",
838 "users",
855 ]
839 ]
856
840
857 [[package]]
841 [[package]]
858 name = "rust-crypto"
859 version = "0.2.36"
860 source = "registry+https://github.com/rust-lang/crates.io-index"
861 checksum = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a"
862 dependencies = [
863 "gcc",
864 "libc",
865 "rand 0.3.23",
866 "rustc-serialize",
867 "time",
868 ]
869
870 [[package]]
871 name = "rustc-serialize"
872 version = "0.3.24"
873 source = "registry+https://github.com/rust-lang/crates.io-index"
874 checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
875
876 [[package]]
877 name = "same-file"
842 name = "same-file"
878 version = "1.0.6"
843 version = "1.0.6"
879 source = "registry+https://github.com/rust-lang/crates.io-index"
844 source = "registry+https://github.com/rust-lang/crates.io-index"
880 checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
845 checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
881 dependencies = [
846 dependencies = [
882 "winapi-util",
847 "winapi-util",
883 ]
848 ]
884
849
885 [[package]]
850 [[package]]
886 name = "scopeguard"
851 name = "scopeguard"
887 version = "1.1.0"
852 version = "1.1.0"
888 source = "registry+https://github.com/rust-lang/crates.io-index"
853 source = "registry+https://github.com/rust-lang/crates.io-index"
889 checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
854 checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
890
855
891 [[package]]
856 [[package]]
857 name = "sha-1"
858 version = "0.9.6"
859 source = "registry+https://github.com/rust-lang/crates.io-index"
860 checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16"
861 dependencies = [
862 "block-buffer",
863 "cfg-if 1.0.0",
864 "cpufeatures",
865 "digest",
866 "opaque-debug",
867 ]
868
869 [[package]]
892 name = "sized-chunks"
870 name = "sized-chunks"
893 version = "0.6.2"
871 version = "0.6.2"
894 source = "registry+https://github.com/rust-lang/crates.io-index"
872 source = "registry+https://github.com/rust-lang/crates.io-index"
895 checksum = "1ec31ceca5644fa6d444cc77548b88b67f46db6f7c71683b0f9336e671830d2f"
873 checksum = "1ec31ceca5644fa6d444cc77548b88b67f46db6f7c71683b0f9336e671830d2f"
896 dependencies = [
874 dependencies = [
897 "bitmaps",
875 "bitmaps",
898 "typenum",
876 "typenum",
899 ]
877 ]
900
878
901 [[package]]
879 [[package]]
902 name = "static_assertions"
880 name = "static_assertions"
903 version = "1.1.0"
881 version = "1.1.0"
904 source = "registry+https://github.com/rust-lang/crates.io-index"
882 source = "registry+https://github.com/rust-lang/crates.io-index"
905 checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
883 checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
906
884
907 [[package]]
885 [[package]]
908 name = "strsim"
886 name = "strsim"
909 version = "0.8.0"
887 version = "0.8.0"
910 source = "registry+https://github.com/rust-lang/crates.io-index"
888 source = "registry+https://github.com/rust-lang/crates.io-index"
911 checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
889 checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
912
890
913 [[package]]
891 [[package]]
914 name = "syn"
892 name = "syn"
915 version = "1.0.54"
893 version = "1.0.54"
916 source = "registry+https://github.com/rust-lang/crates.io-index"
894 source = "registry+https://github.com/rust-lang/crates.io-index"
917 checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
895 checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
918 dependencies = [
896 dependencies = [
919 "proc-macro2",
897 "proc-macro2",
920 "quote",
898 "quote",
921 "unicode-xid",
899 "unicode-xid",
922 ]
900 ]
923
901
924 [[package]]
902 [[package]]
925 name = "tempfile"
903 name = "tempfile"
926 version = "3.1.0"
904 version = "3.1.0"
927 source = "registry+https://github.com/rust-lang/crates.io-index"
905 source = "registry+https://github.com/rust-lang/crates.io-index"
928 checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
906 checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
929 dependencies = [
907 dependencies = [
930 "cfg-if 0.1.10",
908 "cfg-if 0.1.10",
931 "libc",
909 "libc",
932 "rand 0.7.3",
910 "rand",
933 "redox_syscall",
911 "redox_syscall",
934 "remove_dir_all",
912 "remove_dir_all",
935 "winapi",
913 "winapi",
936 ]
914 ]
937
915
938 [[package]]
916 [[package]]
939 name = "termcolor"
917 name = "termcolor"
940 version = "1.1.2"
918 version = "1.1.2"
941 source = "registry+https://github.com/rust-lang/crates.io-index"
919 source = "registry+https://github.com/rust-lang/crates.io-index"
942 checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
920 checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
943 dependencies = [
921 dependencies = [
944 "winapi-util",
922 "winapi-util",
945 ]
923 ]
946
924
947 [[package]]
925 [[package]]
948 name = "textwrap"
926 name = "textwrap"
949 version = "0.11.0"
927 version = "0.11.0"
950 source = "registry+https://github.com/rust-lang/crates.io-index"
928 source = "registry+https://github.com/rust-lang/crates.io-index"
951 checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
929 checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
952 dependencies = [
930 dependencies = [
953 "unicode-width",
931 "unicode-width",
954 ]
932 ]
955
933
956 [[package]]
934 [[package]]
957 name = "thread_local"
935 name = "thread_local"
958 version = "1.0.1"
936 version = "1.0.1"
959 source = "registry+https://github.com/rust-lang/crates.io-index"
937 source = "registry+https://github.com/rust-lang/crates.io-index"
960 checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
938 checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
961 dependencies = [
939 dependencies = [
962 "lazy_static",
940 "lazy_static",
963 ]
941 ]
964
942
965 [[package]]
943 [[package]]
966 name = "time"
944 name = "time"
967 version = "0.1.44"
945 version = "0.1.44"
968 source = "registry+https://github.com/rust-lang/crates.io-index"
946 source = "registry+https://github.com/rust-lang/crates.io-index"
969 checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
947 checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
970 dependencies = [
948 dependencies = [
971 "libc",
949 "libc",
972 "wasi 0.10.0+wasi-snapshot-preview1",
950 "wasi 0.10.0+wasi-snapshot-preview1",
973 "winapi",
951 "winapi",
974 ]
952 ]
975
953
976 [[package]]
954 [[package]]
977 name = "twox-hash"
955 name = "twox-hash"
978 version = "1.6.0"
956 version = "1.6.0"
979 source = "registry+https://github.com/rust-lang/crates.io-index"
957 source = "registry+https://github.com/rust-lang/crates.io-index"
980 checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
958 checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
981 dependencies = [
959 dependencies = [
982 "cfg-if 0.1.10",
960 "cfg-if 0.1.10",
983 "rand 0.7.3",
961 "rand",
984 "static_assertions",
962 "static_assertions",
985 ]
963 ]
986
964
987 [[package]]
965 [[package]]
988 name = "typenum"
966 name = "typenum"
989 version = "1.12.0"
967 version = "1.12.0"
990 source = "registry+https://github.com/rust-lang/crates.io-index"
968 source = "registry+https://github.com/rust-lang/crates.io-index"
991 checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
969 checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
992
970
993 [[package]]
971 [[package]]
994 name = "unicode-width"
972 name = "unicode-width"
995 version = "0.1.8"
973 version = "0.1.8"
996 source = "registry+https://github.com/rust-lang/crates.io-index"
974 source = "registry+https://github.com/rust-lang/crates.io-index"
997 checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
975 checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
998
976
999 [[package]]
977 [[package]]
1000 name = "unicode-xid"
978 name = "unicode-xid"
1001 version = "0.2.1"
979 version = "0.2.1"
1002 source = "registry+https://github.com/rust-lang/crates.io-index"
980 source = "registry+https://github.com/rust-lang/crates.io-index"
1003 checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
981 checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
1004
982
1005 [[package]]
983 [[package]]
1006 name = "users"
984 name = "users"
1007 version = "0.11.0"
985 version = "0.11.0"
1008 source = "registry+https://github.com/rust-lang/crates.io-index"
986 source = "registry+https://github.com/rust-lang/crates.io-index"
1009 checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
987 checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
1010 dependencies = [
988 dependencies = [
1011 "libc",
989 "libc",
1012 "log",
990 "log",
1013 ]
991 ]
1014
992
1015 [[package]]
993 [[package]]
1016 name = "vcpkg"
994 name = "vcpkg"
1017 version = "0.2.11"
995 version = "0.2.11"
1018 source = "registry+https://github.com/rust-lang/crates.io-index"
996 source = "registry+https://github.com/rust-lang/crates.io-index"
1019 checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
997 checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
1020
998
1021 [[package]]
999 [[package]]
1022 name = "vec_map"
1000 name = "vec_map"
1023 version = "0.8.2"
1001 version = "0.8.2"
1024 source = "registry+https://github.com/rust-lang/crates.io-index"
1002 source = "registry+https://github.com/rust-lang/crates.io-index"
1025 checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
1003 checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
1026
1004
1027 [[package]]
1005 [[package]]
1028 name = "version_check"
1006 name = "version_check"
1029 version = "0.9.2"
1007 version = "0.9.2"
1030 source = "registry+https://github.com/rust-lang/crates.io-index"
1008 source = "registry+https://github.com/rust-lang/crates.io-index"
1031 checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
1009 checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
1032
1010
1033 [[package]]
1011 [[package]]
1034 name = "wasi"
1012 name = "wasi"
1035 version = "0.9.0+wasi-snapshot-preview1"
1013 version = "0.9.0+wasi-snapshot-preview1"
1036 source = "registry+https://github.com/rust-lang/crates.io-index"
1014 source = "registry+https://github.com/rust-lang/crates.io-index"
1037 checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
1015 checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
1038
1016
1039 [[package]]
1017 [[package]]
1040 name = "wasi"
1018 name = "wasi"
1041 version = "0.10.0+wasi-snapshot-preview1"
1019 version = "0.10.0+wasi-snapshot-preview1"
1042 source = "registry+https://github.com/rust-lang/crates.io-index"
1020 source = "registry+https://github.com/rust-lang/crates.io-index"
1043 checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
1021 checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
1044
1022
1045 [[package]]
1023 [[package]]
1046 name = "winapi"
1024 name = "winapi"
1047 version = "0.3.9"
1025 version = "0.3.9"
1048 source = "registry+https://github.com/rust-lang/crates.io-index"
1026 source = "registry+https://github.com/rust-lang/crates.io-index"
1049 checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
1027 checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
1050 dependencies = [
1028 dependencies = [
1051 "winapi-i686-pc-windows-gnu",
1029 "winapi-i686-pc-windows-gnu",
1052 "winapi-x86_64-pc-windows-gnu",
1030 "winapi-x86_64-pc-windows-gnu",
1053 ]
1031 ]
1054
1032
1055 [[package]]
1033 [[package]]
1056 name = "winapi-i686-pc-windows-gnu"
1034 name = "winapi-i686-pc-windows-gnu"
1057 version = "0.4.0"
1035 version = "0.4.0"
1058 source = "registry+https://github.com/rust-lang/crates.io-index"
1036 source = "registry+https://github.com/rust-lang/crates.io-index"
1059 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1037 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1060
1038
1061 [[package]]
1039 [[package]]
1062 name = "winapi-util"
1040 name = "winapi-util"
1063 version = "0.1.5"
1041 version = "0.1.5"
1064 source = "registry+https://github.com/rust-lang/crates.io-index"
1042 source = "registry+https://github.com/rust-lang/crates.io-index"
1065 checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
1043 checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
1066 dependencies = [
1044 dependencies = [
1067 "winapi",
1045 "winapi",
1068 ]
1046 ]
1069
1047
1070 [[package]]
1048 [[package]]
1071 name = "winapi-x86_64-pc-windows-gnu"
1049 name = "winapi-x86_64-pc-windows-gnu"
1072 version = "0.4.0"
1050 version = "0.4.0"
1073 source = "registry+https://github.com/rust-lang/crates.io-index"
1051 source = "registry+https://github.com/rust-lang/crates.io-index"
1074 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1052 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1075
1053
1076 [[package]]
1054 [[package]]
1077 name = "zstd"
1055 name = "zstd"
1078 version = "0.5.3+zstd.1.4.5"
1056 version = "0.5.3+zstd.1.4.5"
1079 source = "registry+https://github.com/rust-lang/crates.io-index"
1057 source = "registry+https://github.com/rust-lang/crates.io-index"
1080 checksum = "01b32eaf771efa709e8308605bbf9319bf485dc1503179ec0469b611937c0cd8"
1058 checksum = "01b32eaf771efa709e8308605bbf9319bf485dc1503179ec0469b611937c0cd8"
1081 dependencies = [
1059 dependencies = [
1082 "zstd-safe",
1060 "zstd-safe",
1083 ]
1061 ]
1084
1062
1085 [[package]]
1063 [[package]]
1086 name = "zstd-safe"
1064 name = "zstd-safe"
1087 version = "2.0.5+zstd.1.4.5"
1065 version = "2.0.5+zstd.1.4.5"
1088 source = "registry+https://github.com/rust-lang/crates.io-index"
1066 source = "registry+https://github.com/rust-lang/crates.io-index"
1089 checksum = "1cfb642e0d27f64729a639c52db457e0ae906e7bc6f5fe8f5c453230400f1055"
1067 checksum = "1cfb642e0d27f64729a639c52db457e0ae906e7bc6f5fe8f5c453230400f1055"
1090 dependencies = [
1068 dependencies = [
1091 "libc",
1069 "libc",
1092 "zstd-sys",
1070 "zstd-sys",
1093 ]
1071 ]
1094
1072
1095 [[package]]
1073 [[package]]
1096 name = "zstd-sys"
1074 name = "zstd-sys"
1097 version = "1.4.17+zstd.1.4.5"
1075 version = "1.4.17+zstd.1.4.5"
1098 source = "registry+https://github.com/rust-lang/crates.io-index"
1076 source = "registry+https://github.com/rust-lang/crates.io-index"
1099 checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b"
1077 checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b"
1100 dependencies = [
1078 dependencies = [
1101 "cc",
1079 "cc",
1102 "glob",
1080 "glob",
1103 "itertools",
1081 "itertools",
1104 "libc",
1082 "libc",
1105 ]
1083 ]
@@ -1,44 +1,44
1 [package]
1 [package]
2 name = "hg-core"
2 name = "hg-core"
3 version = "0.1.0"
3 version = "0.1.0"
4 authors = ["Georges Racinet <gracinet@anybox.fr>"]
4 authors = ["Georges Racinet <gracinet@anybox.fr>"]
5 description = "Mercurial pure Rust core library, with no assumption on Python bindings (FFI)"
5 description = "Mercurial pure Rust core library, with no assumption on Python bindings (FFI)"
6 edition = "2018"
6 edition = "2018"
7
7
8 [lib]
8 [lib]
9 name = "hg"
9 name = "hg"
10
10
11 [dependencies]
11 [dependencies]
12 bytes-cast = "0.2"
12 bytes-cast = "0.2"
13 byteorder = "1.3.4"
13 byteorder = "1.3.4"
14 derive_more = "0.99"
14 derive_more = "0.99"
15 home = "0.5"
15 home = "0.5"
16 im-rc = "15.0.*"
16 im-rc = "15.0.*"
17 itertools = "0.9"
17 itertools = "0.9"
18 lazy_static = "1.4.0"
18 lazy_static = "1.4.0"
19 rand = "0.7.3"
19 rand = "0.7.3"
20 rand_pcg = "0.2.1"
20 rand_pcg = "0.2.1"
21 rand_distr = "0.2.2"
21 rand_distr = "0.2.2"
22 rayon = "1.3.0"
22 rayon = "1.3.0"
23 regex = "1.3.9"
23 regex = "1.3.9"
24 sha-1 = "0.9.6"
24 twox-hash = "1.5.0"
25 twox-hash = "1.5.0"
25 same-file = "1.0.6"
26 same-file = "1.0.6"
26 tempfile = "3.1.0"
27 tempfile = "3.1.0"
27 crossbeam-channel = "0.4"
28 crossbeam-channel = "0.4"
28 micro-timer = "0.3.0"
29 micro-timer = "0.3.0"
29 log = "0.4.8"
30 log = "0.4.8"
30 memmap = "0.7.0"
31 memmap = "0.7.0"
31 zstd = "0.5.3"
32 zstd = "0.5.3"
32 rust-crypto = "0.2.36"
33 format-bytes = "0.2.2"
33 format-bytes = "0.2.2"
34
34
35 # We don't use the `miniz-oxide` backend to not change rhg benchmarks and until
35 # We don't use the `miniz-oxide` backend to not change rhg benchmarks and until
36 # we have a clearer view of which backend is the fastest.
36 # we have a clearer view of which backend is the fastest.
37 [dependencies.flate2]
37 [dependencies.flate2]
38 version = "1.0.16"
38 version = "1.0.16"
39 features = ["zlib"]
39 features = ["zlib"]
40 default-features = false
40 default-features = false
41
41
42 [dev-dependencies]
42 [dev-dependencies]
43 clap = "*"
43 clap = "*"
44 pretty_assertions = "0.6.1"
44 pretty_assertions = "0.6.1"
@@ -1,653 +1,646
1 use crypto::digest::Digest;
1 use sha1::{Digest, Sha1};
2 use crypto::sha1::Sha1;
3
2
4 #[derive(PartialEq, Debug)]
3 #[derive(PartialEq, Debug)]
5 #[allow(non_camel_case_types)]
4 #[allow(non_camel_case_types)]
6 enum path_state {
5 enum path_state {
7 START, /* first byte of a path component */
6 START, /* first byte of a path component */
8 A, /* "AUX" */
7 A, /* "AUX" */
9 AU,
8 AU,
10 THIRD, /* third of a 3-byte sequence, e.g. "AUX", "NUL" */
9 THIRD, /* third of a 3-byte sequence, e.g. "AUX", "NUL" */
11 C, /* "CON" or "COMn" */
10 C, /* "CON" or "COMn" */
12 CO,
11 CO,
13 COMLPT, /* "COM" or "LPT" */
12 COMLPT, /* "COM" or "LPT" */
14 COMLPTn,
13 COMLPTn,
15 L,
14 L,
16 LP,
15 LP,
17 N,
16 N,
18 NU,
17 NU,
19 P, /* "PRN" */
18 P, /* "PRN" */
20 PR,
19 PR,
21 LDOT, /* leading '.' */
20 LDOT, /* leading '.' */
22 DOT, /* '.' in a non-leading position */
21 DOT, /* '.' in a non-leading position */
23 H, /* ".h" */
22 H, /* ".h" */
24 HGDI, /* ".hg", ".d", or ".i" */
23 HGDI, /* ".hg", ".d", or ".i" */
25 SPACE,
24 SPACE,
26 DEFAULT, /* byte of a path component after the first */
25 DEFAULT, /* byte of a path component after the first */
27 }
26 }
28
27
29 /* state machine for dir-encoding */
28 /* state machine for dir-encoding */
30 #[allow(non_camel_case_types)]
29 #[allow(non_camel_case_types)]
31 enum dir_state {
30 enum dir_state {
32 DDOT,
31 DDOT,
33 DH,
32 DH,
34 DHGDI,
33 DHGDI,
35 DDEFAULT,
34 DDEFAULT,
36 }
35 }
37
36
38 fn inset(bitset: &[u32; 8], c: u8) -> bool {
37 fn inset(bitset: &[u32; 8], c: u8) -> bool {
39 bitset[(c as usize) >> 5] & (1 << (c & 31)) != 0
38 bitset[(c as usize) >> 5] & (1 << (c & 31)) != 0
40 }
39 }
41
40
42 fn charcopy(dest: Option<&mut [u8]>, destlen: &mut usize, c: u8) {
41 fn charcopy(dest: Option<&mut [u8]>, destlen: &mut usize, c: u8) {
43 if let Some(slice) = dest {
42 if let Some(slice) = dest {
44 slice[*destlen] = c
43 slice[*destlen] = c
45 }
44 }
46 *destlen += 1
45 *destlen += 1
47 }
46 }
48
47
49 fn memcopy(dest: Option<&mut [u8]>, destlen: &mut usize, src: &[u8]) {
48 fn memcopy(dest: Option<&mut [u8]>, destlen: &mut usize, src: &[u8]) {
50 if let Some(slice) = dest {
49 if let Some(slice) = dest {
51 slice[*destlen..*destlen + src.len()].copy_from_slice(src)
50 slice[*destlen..*destlen + src.len()].copy_from_slice(src)
52 }
51 }
53 *destlen += src.len();
52 *destlen += src.len();
54 }
53 }
55
54
56 fn rewrap_option<'a, 'b: 'a>(
55 fn rewrap_option<'a, 'b: 'a>(
57 x: &'a mut Option<&'b mut [u8]>,
56 x: &'a mut Option<&'b mut [u8]>,
58 ) -> Option<&'a mut [u8]> {
57 ) -> Option<&'a mut [u8]> {
59 match x {
58 match x {
60 None => None,
59 None => None,
61 Some(y) => Some(y),
60 Some(y) => Some(y),
62 }
61 }
63 }
62 }
64
63
65 fn hexencode<'a>(mut dest: Option<&'a mut [u8]>, destlen: &mut usize, c: u8) {
64 fn hexencode<'a>(mut dest: Option<&'a mut [u8]>, destlen: &mut usize, c: u8) {
66 let hexdigit = b"0123456789abcdef";
65 let hexdigit = b"0123456789abcdef";
67 charcopy(
66 charcopy(
68 rewrap_option(&mut dest),
67 rewrap_option(&mut dest),
69 destlen,
68 destlen,
70 hexdigit[(c as usize) >> 4],
69 hexdigit[(c as usize) >> 4],
71 );
70 );
72 charcopy(dest, destlen, hexdigit[(c as usize) & 15]);
71 charcopy(dest, destlen, hexdigit[(c as usize) & 15]);
73 }
72 }
74
73
75 /* 3-byte escape: tilde followed by two hex digits */
74 /* 3-byte escape: tilde followed by two hex digits */
76 fn escape3(mut dest: Option<&mut [u8]>, destlen: &mut usize, c: u8) {
75 fn escape3(mut dest: Option<&mut [u8]>, destlen: &mut usize, c: u8) {
77 charcopy(rewrap_option(&mut dest), destlen, b'~');
76 charcopy(rewrap_option(&mut dest), destlen, b'~');
78 hexencode(dest, destlen, c);
77 hexencode(dest, destlen, c);
79 }
78 }
80
79
81 fn encode_dir(mut dest: Option<&mut [u8]>, src: &[u8]) -> usize {
80 fn encode_dir(mut dest: Option<&mut [u8]>, src: &[u8]) -> usize {
82 let mut state = dir_state::DDEFAULT;
81 let mut state = dir_state::DDEFAULT;
83 let mut i = 0;
82 let mut i = 0;
84 let mut destlen = 0;
83 let mut destlen = 0;
85
84
86 while i < src.len() {
85 while i < src.len() {
87 match state {
86 match state {
88 dir_state::DDOT => match src[i] {
87 dir_state::DDOT => match src[i] {
89 b'd' | b'i' => {
88 b'd' | b'i' => {
90 state = dir_state::DHGDI;
89 state = dir_state::DHGDI;
91 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
90 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
92 i += 1;
91 i += 1;
93 }
92 }
94 b'h' => {
93 b'h' => {
95 state = dir_state::DH;
94 state = dir_state::DH;
96 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
95 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
97 i += 1;
96 i += 1;
98 }
97 }
99 _ => {
98 _ => {
100 state = dir_state::DDEFAULT;
99 state = dir_state::DDEFAULT;
101 }
100 }
102 },
101 },
103 dir_state::DH => {
102 dir_state::DH => {
104 if src[i] == b'g' {
103 if src[i] == b'g' {
105 state = dir_state::DHGDI;
104 state = dir_state::DHGDI;
106 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
105 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
107 i += 1;
106 i += 1;
108 } else {
107 } else {
109 state = dir_state::DDEFAULT;
108 state = dir_state::DDEFAULT;
110 }
109 }
111 }
110 }
112 dir_state::DHGDI => {
111 dir_state::DHGDI => {
113 if src[i] == b'/' {
112 if src[i] == b'/' {
114 memcopy(rewrap_option(&mut dest), &mut destlen, b".hg");
113 memcopy(rewrap_option(&mut dest), &mut destlen, b".hg");
115 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
114 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
116 i += 1;
115 i += 1;
117 }
116 }
118 state = dir_state::DDEFAULT;
117 state = dir_state::DDEFAULT;
119 }
118 }
120 dir_state::DDEFAULT => {
119 dir_state::DDEFAULT => {
121 if src[i] == b'.' {
120 if src[i] == b'.' {
122 state = dir_state::DDOT
121 state = dir_state::DDOT
123 }
122 }
124 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
123 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
125 i += 1;
124 i += 1;
126 }
125 }
127 }
126 }
128 }
127 }
129 destlen
128 destlen
130 }
129 }
131
130
132 fn _encode(
131 fn _encode(
133 twobytes: &[u32; 8],
132 twobytes: &[u32; 8],
134 onebyte: &[u32; 8],
133 onebyte: &[u32; 8],
135 mut dest: Option<&mut [u8]>,
134 mut dest: Option<&mut [u8]>,
136 src: &[u8],
135 src: &[u8],
137 encodedir: bool,
136 encodedir: bool,
138 ) -> usize {
137 ) -> usize {
139 let mut state = path_state::START;
138 let mut state = path_state::START;
140 let mut i = 0;
139 let mut i = 0;
141 let mut destlen = 0;
140 let mut destlen = 0;
142 let len = src.len();
141 let len = src.len();
143
142
144 while i < len {
143 while i < len {
145 match state {
144 match state {
146 path_state::START => match src[i] {
145 path_state::START => match src[i] {
147 b'/' => {
146 b'/' => {
148 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
147 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
149 i += 1;
148 i += 1;
150 }
149 }
151 b'.' => {
150 b'.' => {
152 state = path_state::LDOT;
151 state = path_state::LDOT;
153 escape3(rewrap_option(&mut dest), &mut destlen, src[i]);
152 escape3(rewrap_option(&mut dest), &mut destlen, src[i]);
154 i += 1;
153 i += 1;
155 }
154 }
156 b' ' => {
155 b' ' => {
157 state = path_state::DEFAULT;
156 state = path_state::DEFAULT;
158 escape3(rewrap_option(&mut dest), &mut destlen, src[i]);
157 escape3(rewrap_option(&mut dest), &mut destlen, src[i]);
159 i += 1;
158 i += 1;
160 }
159 }
161 b'a' => {
160 b'a' => {
162 state = path_state::A;
161 state = path_state::A;
163 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
162 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
164 i += 1;
163 i += 1;
165 }
164 }
166 b'c' => {
165 b'c' => {
167 state = path_state::C;
166 state = path_state::C;
168 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
167 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
169 i += 1;
168 i += 1;
170 }
169 }
171 b'l' => {
170 b'l' => {
172 state = path_state::L;
171 state = path_state::L;
173 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
172 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
174 i += 1;
173 i += 1;
175 }
174 }
176 b'n' => {
175 b'n' => {
177 state = path_state::N;
176 state = path_state::N;
178 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
177 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
179 i += 1;
178 i += 1;
180 }
179 }
181 b'p' => {
180 b'p' => {
182 state = path_state::P;
181 state = path_state::P;
183 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
182 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
184 i += 1;
183 i += 1;
185 }
184 }
186 _ => {
185 _ => {
187 state = path_state::DEFAULT;
186 state = path_state::DEFAULT;
188 }
187 }
189 },
188 },
190 path_state::A => {
189 path_state::A => {
191 if src[i] == b'u' {
190 if src[i] == b'u' {
192 state = path_state::AU;
191 state = path_state::AU;
193 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
192 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
194 i += 1;
193 i += 1;
195 } else {
194 } else {
196 state = path_state::DEFAULT;
195 state = path_state::DEFAULT;
197 }
196 }
198 }
197 }
199 path_state::AU => {
198 path_state::AU => {
200 if src[i] == b'x' {
199 if src[i] == b'x' {
201 state = path_state::THIRD;
200 state = path_state::THIRD;
202 i += 1;
201 i += 1;
203 } else {
202 } else {
204 state = path_state::DEFAULT;
203 state = path_state::DEFAULT;
205 }
204 }
206 }
205 }
207 path_state::THIRD => {
206 path_state::THIRD => {
208 state = path_state::DEFAULT;
207 state = path_state::DEFAULT;
209 match src[i] {
208 match src[i] {
210 b'.' | b'/' | b'\0' => escape3(
209 b'.' | b'/' | b'\0' => escape3(
211 rewrap_option(&mut dest),
210 rewrap_option(&mut dest),
212 &mut destlen,
211 &mut destlen,
213 src[i - 1],
212 src[i - 1],
214 ),
213 ),
215 _ => i -= 1,
214 _ => i -= 1,
216 }
215 }
217 }
216 }
218 path_state::C => {
217 path_state::C => {
219 if src[i] == b'o' {
218 if src[i] == b'o' {
220 state = path_state::CO;
219 state = path_state::CO;
221 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
220 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
222 i += 1;
221 i += 1;
223 } else {
222 } else {
224 state = path_state::DEFAULT;
223 state = path_state::DEFAULT;
225 }
224 }
226 }
225 }
227 path_state::CO => {
226 path_state::CO => {
228 if src[i] == b'm' {
227 if src[i] == b'm' {
229 state = path_state::COMLPT;
228 state = path_state::COMLPT;
230 i += 1;
229 i += 1;
231 } else if src[i] == b'n' {
230 } else if src[i] == b'n' {
232 state = path_state::THIRD;
231 state = path_state::THIRD;
233 i += 1;
232 i += 1;
234 } else {
233 } else {
235 state = path_state::DEFAULT;
234 state = path_state::DEFAULT;
236 }
235 }
237 }
236 }
238 path_state::COMLPT => {
237 path_state::COMLPT => {
239 if src[i] >= b'1' && src[i] <= b'9' {
238 if src[i] >= b'1' && src[i] <= b'9' {
240 state = path_state::COMLPTn;
239 state = path_state::COMLPTn;
241 i += 1;
240 i += 1;
242 } else {
241 } else {
243 state = path_state::DEFAULT;
242 state = path_state::DEFAULT;
244 charcopy(
243 charcopy(
245 rewrap_option(&mut dest),
244 rewrap_option(&mut dest),
246 &mut destlen,
245 &mut destlen,
247 src[i - 1],
246 src[i - 1],
248 );
247 );
249 }
248 }
250 }
249 }
251 path_state::COMLPTn => {
250 path_state::COMLPTn => {
252 state = path_state::DEFAULT;
251 state = path_state::DEFAULT;
253 match src[i] {
252 match src[i] {
254 b'.' | b'/' | b'\0' => {
253 b'.' | b'/' | b'\0' => {
255 escape3(
254 escape3(
256 rewrap_option(&mut dest),
255 rewrap_option(&mut dest),
257 &mut destlen,
256 &mut destlen,
258 src[i - 2],
257 src[i - 2],
259 );
258 );
260 charcopy(
259 charcopy(
261 rewrap_option(&mut dest),
260 rewrap_option(&mut dest),
262 &mut destlen,
261 &mut destlen,
263 src[i - 1],
262 src[i - 1],
264 );
263 );
265 }
264 }
266 _ => {
265 _ => {
267 memcopy(
266 memcopy(
268 rewrap_option(&mut dest),
267 rewrap_option(&mut dest),
269 &mut destlen,
268 &mut destlen,
270 &src[i - 2..i],
269 &src[i - 2..i],
271 );
270 );
272 }
271 }
273 }
272 }
274 }
273 }
275 path_state::L => {
274 path_state::L => {
276 if src[i] == b'p' {
275 if src[i] == b'p' {
277 state = path_state::LP;
276 state = path_state::LP;
278 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
277 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
279 i += 1;
278 i += 1;
280 } else {
279 } else {
281 state = path_state::DEFAULT;
280 state = path_state::DEFAULT;
282 }
281 }
283 }
282 }
284 path_state::LP => {
283 path_state::LP => {
285 if src[i] == b't' {
284 if src[i] == b't' {
286 state = path_state::COMLPT;
285 state = path_state::COMLPT;
287 i += 1;
286 i += 1;
288 } else {
287 } else {
289 state = path_state::DEFAULT;
288 state = path_state::DEFAULT;
290 }
289 }
291 }
290 }
292 path_state::N => {
291 path_state::N => {
293 if src[i] == b'u' {
292 if src[i] == b'u' {
294 state = path_state::NU;
293 state = path_state::NU;
295 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
294 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
296 i += 1;
295 i += 1;
297 } else {
296 } else {
298 state = path_state::DEFAULT;
297 state = path_state::DEFAULT;
299 }
298 }
300 }
299 }
301 path_state::NU => {
300 path_state::NU => {
302 if src[i] == b'l' {
301 if src[i] == b'l' {
303 state = path_state::THIRD;
302 state = path_state::THIRD;
304 i += 1;
303 i += 1;
305 } else {
304 } else {
306 state = path_state::DEFAULT;
305 state = path_state::DEFAULT;
307 }
306 }
308 }
307 }
309 path_state::P => {
308 path_state::P => {
310 if src[i] == b'r' {
309 if src[i] == b'r' {
311 state = path_state::PR;
310 state = path_state::PR;
312 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
311 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
313 i += 1;
312 i += 1;
314 } else {
313 } else {
315 state = path_state::DEFAULT;
314 state = path_state::DEFAULT;
316 }
315 }
317 }
316 }
318 path_state::PR => {
317 path_state::PR => {
319 if src[i] == b'n' {
318 if src[i] == b'n' {
320 state = path_state::THIRD;
319 state = path_state::THIRD;
321 i += 1;
320 i += 1;
322 } else {
321 } else {
323 state = path_state::DEFAULT;
322 state = path_state::DEFAULT;
324 }
323 }
325 }
324 }
326 path_state::LDOT => match src[i] {
325 path_state::LDOT => match src[i] {
327 b'd' | b'i' => {
326 b'd' | b'i' => {
328 state = path_state::HGDI;
327 state = path_state::HGDI;
329 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
328 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
330 i += 1;
329 i += 1;
331 }
330 }
332 b'h' => {
331 b'h' => {
333 state = path_state::H;
332 state = path_state::H;
334 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
333 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
335 i += 1;
334 i += 1;
336 }
335 }
337 _ => {
336 _ => {
338 state = path_state::DEFAULT;
337 state = path_state::DEFAULT;
339 }
338 }
340 },
339 },
341 path_state::DOT => match src[i] {
340 path_state::DOT => match src[i] {
342 b'/' | b'\0' => {
341 b'/' | b'\0' => {
343 state = path_state::START;
342 state = path_state::START;
344 memcopy(rewrap_option(&mut dest), &mut destlen, b"~2e");
343 memcopy(rewrap_option(&mut dest), &mut destlen, b"~2e");
345 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
344 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
346 i += 1;
345 i += 1;
347 }
346 }
348 b'd' | b'i' => {
347 b'd' | b'i' => {
349 state = path_state::HGDI;
348 state = path_state::HGDI;
350 charcopy(rewrap_option(&mut dest), &mut destlen, b'.');
349 charcopy(rewrap_option(&mut dest), &mut destlen, b'.');
351 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
350 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
352 i += 1;
351 i += 1;
353 }
352 }
354 b'h' => {
353 b'h' => {
355 state = path_state::H;
354 state = path_state::H;
356 memcopy(rewrap_option(&mut dest), &mut destlen, b".h");
355 memcopy(rewrap_option(&mut dest), &mut destlen, b".h");
357 i += 1;
356 i += 1;
358 }
357 }
359 _ => {
358 _ => {
360 state = path_state::DEFAULT;
359 state = path_state::DEFAULT;
361 charcopy(rewrap_option(&mut dest), &mut destlen, b'.');
360 charcopy(rewrap_option(&mut dest), &mut destlen, b'.');
362 }
361 }
363 },
362 },
364 path_state::H => {
363 path_state::H => {
365 if src[i] == b'g' {
364 if src[i] == b'g' {
366 state = path_state::HGDI;
365 state = path_state::HGDI;
367 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
366 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
368 i += 1;
367 i += 1;
369 } else {
368 } else {
370 state = path_state::DEFAULT;
369 state = path_state::DEFAULT;
371 }
370 }
372 }
371 }
373 path_state::HGDI => {
372 path_state::HGDI => {
374 if src[i] == b'/' {
373 if src[i] == b'/' {
375 state = path_state::START;
374 state = path_state::START;
376 if encodedir {
375 if encodedir {
377 memcopy(
376 memcopy(
378 rewrap_option(&mut dest),
377 rewrap_option(&mut dest),
379 &mut destlen,
378 &mut destlen,
380 b".hg",
379 b".hg",
381 );
380 );
382 }
381 }
383 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
382 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
384 i += 1
383 i += 1
385 } else {
384 } else {
386 state = path_state::DEFAULT;
385 state = path_state::DEFAULT;
387 }
386 }
388 }
387 }
389 path_state::SPACE => match src[i] {
388 path_state::SPACE => match src[i] {
390 b'/' | b'\0' => {
389 b'/' | b'\0' => {
391 state = path_state::START;
390 state = path_state::START;
392 memcopy(rewrap_option(&mut dest), &mut destlen, b"~20");
391 memcopy(rewrap_option(&mut dest), &mut destlen, b"~20");
393 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
392 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
394 i += 1;
393 i += 1;
395 }
394 }
396 _ => {
395 _ => {
397 state = path_state::DEFAULT;
396 state = path_state::DEFAULT;
398 charcopy(rewrap_option(&mut dest), &mut destlen, b' ');
397 charcopy(rewrap_option(&mut dest), &mut destlen, b' ');
399 }
398 }
400 },
399 },
401 path_state::DEFAULT => {
400 path_state::DEFAULT => {
402 while i != len && inset(onebyte, src[i]) {
401 while i != len && inset(onebyte, src[i]) {
403 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
402 charcopy(rewrap_option(&mut dest), &mut destlen, src[i]);
404 i += 1;
403 i += 1;
405 }
404 }
406 if i == len {
405 if i == len {
407 break;
406 break;
408 }
407 }
409 match src[i] {
408 match src[i] {
410 b'.' => {
409 b'.' => {
411 state = path_state::DOT;
410 state = path_state::DOT;
412 i += 1
411 i += 1
413 }
412 }
414 b' ' => {
413 b' ' => {
415 state = path_state::SPACE;
414 state = path_state::SPACE;
416 i += 1
415 i += 1
417 }
416 }
418 b'/' => {
417 b'/' => {
419 state = path_state::START;
418 state = path_state::START;
420 charcopy(rewrap_option(&mut dest), &mut destlen, b'/');
419 charcopy(rewrap_option(&mut dest), &mut destlen, b'/');
421 i += 1;
420 i += 1;
422 }
421 }
423 _ => {
422 _ => {
424 if inset(onebyte, src[i]) {
423 if inset(onebyte, src[i]) {
425 loop {
424 loop {
426 charcopy(
425 charcopy(
427 rewrap_option(&mut dest),
426 rewrap_option(&mut dest),
428 &mut destlen,
427 &mut destlen,
429 src[i],
428 src[i],
430 );
429 );
431 i += 1;
430 i += 1;
432 if !(i < len && inset(onebyte, src[i])) {
431 if !(i < len && inset(onebyte, src[i])) {
433 break;
432 break;
434 }
433 }
435 }
434 }
436 } else if inset(twobytes, src[i]) {
435 } else if inset(twobytes, src[i]) {
437 let c = src[i];
436 let c = src[i];
438 i += 1;
437 i += 1;
439 charcopy(
438 charcopy(
440 rewrap_option(&mut dest),
439 rewrap_option(&mut dest),
441 &mut destlen,
440 &mut destlen,
442 b'_',
441 b'_',
443 );
442 );
444 charcopy(
443 charcopy(
445 rewrap_option(&mut dest),
444 rewrap_option(&mut dest),
446 &mut destlen,
445 &mut destlen,
447 if c == b'_' { b'_' } else { c + 32 },
446 if c == b'_' { b'_' } else { c + 32 },
448 );
447 );
449 } else {
448 } else {
450 escape3(
449 escape3(
451 rewrap_option(&mut dest),
450 rewrap_option(&mut dest),
452 &mut destlen,
451 &mut destlen,
453 src[i],
452 src[i],
454 );
453 );
455 i += 1;
454 i += 1;
456 }
455 }
457 }
456 }
458 }
457 }
459 }
458 }
460 }
459 }
461 }
460 }
462 match state {
461 match state {
463 path_state::START => (),
462 path_state::START => (),
464 path_state::A => (),
463 path_state::A => (),
465 path_state::AU => (),
464 path_state::AU => (),
466 path_state::THIRD => {
465 path_state::THIRD => {
467 escape3(rewrap_option(&mut dest), &mut destlen, src[i - 1])
466 escape3(rewrap_option(&mut dest), &mut destlen, src[i - 1])
468 }
467 }
469 path_state::C => (),
468 path_state::C => (),
470 path_state::CO => (),
469 path_state::CO => (),
471 path_state::COMLPT => {
470 path_state::COMLPT => {
472 charcopy(rewrap_option(&mut dest), &mut destlen, src[i - 1])
471 charcopy(rewrap_option(&mut dest), &mut destlen, src[i - 1])
473 }
472 }
474 path_state::COMLPTn => {
473 path_state::COMLPTn => {
475 escape3(rewrap_option(&mut dest), &mut destlen, src[i - 2]);
474 escape3(rewrap_option(&mut dest), &mut destlen, src[i - 2]);
476 charcopy(rewrap_option(&mut dest), &mut destlen, src[i - 1]);
475 charcopy(rewrap_option(&mut dest), &mut destlen, src[i - 1]);
477 }
476 }
478 path_state::L => (),
477 path_state::L => (),
479 path_state::LP => (),
478 path_state::LP => (),
480 path_state::N => (),
479 path_state::N => (),
481 path_state::NU => (),
480 path_state::NU => (),
482 path_state::P => (),
481 path_state::P => (),
483 path_state::PR => (),
482 path_state::PR => (),
484 path_state::LDOT => (),
483 path_state::LDOT => (),
485 path_state::DOT => {
484 path_state::DOT => {
486 memcopy(rewrap_option(&mut dest), &mut destlen, b"~2e");
485 memcopy(rewrap_option(&mut dest), &mut destlen, b"~2e");
487 }
486 }
488 path_state::H => (),
487 path_state::H => (),
489 path_state::HGDI => (),
488 path_state::HGDI => (),
490 path_state::SPACE => {
489 path_state::SPACE => {
491 memcopy(rewrap_option(&mut dest), &mut destlen, b"~20");
490 memcopy(rewrap_option(&mut dest), &mut destlen, b"~20");
492 }
491 }
493 path_state::DEFAULT => (),
492 path_state::DEFAULT => (),
494 };
493 };
495 destlen
494 destlen
496 }
495 }
497
496
498 fn basic_encode(dest: Option<&mut [u8]>, src: &[u8]) -> usize {
497 fn basic_encode(dest: Option<&mut [u8]>, src: &[u8]) -> usize {
499 let twobytes: [u32; 8] = [0, 0, 0x87ff_fffe, 0, 0, 0, 0, 0];
498 let twobytes: [u32; 8] = [0, 0, 0x87ff_fffe, 0, 0, 0, 0, 0];
500 let onebyte: [u32; 8] =
499 let onebyte: [u32; 8] =
501 [1, 0x2bff_3bfa, 0x6800_0001, 0x2fff_ffff, 0, 0, 0, 0];
500 [1, 0x2bff_3bfa, 0x6800_0001, 0x2fff_ffff, 0, 0, 0, 0];
502 _encode(&twobytes, &onebyte, dest, src, true)
501 _encode(&twobytes, &onebyte, dest, src, true)
503 }
502 }
504
503
505 const MAXSTOREPATHLEN: usize = 120;
504 const MAXSTOREPATHLEN: usize = 120;
506
505
507 fn lower_encode(mut dest: Option<&mut [u8]>, src: &[u8]) -> usize {
506 fn lower_encode(mut dest: Option<&mut [u8]>, src: &[u8]) -> usize {
508 let onebyte: [u32; 8] =
507 let onebyte: [u32; 8] =
509 [1, 0x2bff_fbfb, 0xe800_0001, 0x2fff_ffff, 0, 0, 0, 0];
508 [1, 0x2bff_fbfb, 0xe800_0001, 0x2fff_ffff, 0, 0, 0, 0];
510 let lower: [u32; 8] = [0, 0, 0x07ff_fffe, 0, 0, 0, 0, 0];
509 let lower: [u32; 8] = [0, 0, 0x07ff_fffe, 0, 0, 0, 0, 0];
511 let mut destlen = 0;
510 let mut destlen = 0;
512 for c in src {
511 for c in src {
513 if inset(&onebyte, *c) {
512 if inset(&onebyte, *c) {
514 charcopy(rewrap_option(&mut dest), &mut destlen, *c)
513 charcopy(rewrap_option(&mut dest), &mut destlen, *c)
515 } else if inset(&lower, *c) {
514 } else if inset(&lower, *c) {
516 charcopy(rewrap_option(&mut dest), &mut destlen, *c + 32)
515 charcopy(rewrap_option(&mut dest), &mut destlen, *c + 32)
517 } else {
516 } else {
518 escape3(rewrap_option(&mut dest), &mut destlen, *c)
517 escape3(rewrap_option(&mut dest), &mut destlen, *c)
519 }
518 }
520 }
519 }
521 destlen
520 destlen
522 }
521 }
523
522
524 fn aux_encode(dest: Option<&mut [u8]>, src: &[u8]) -> usize {
523 fn aux_encode(dest: Option<&mut [u8]>, src: &[u8]) -> usize {
525 let twobytes = [0; 8];
524 let twobytes = [0; 8];
526 let onebyte: [u32; 8] = [!0, 0xffff_3ffe, !0, !0, !0, !0, !0, !0];
525 let onebyte: [u32; 8] = [!0, 0xffff_3ffe, !0, !0, !0, !0, !0, !0];
527 _encode(&twobytes, &onebyte, dest, src, false)
526 _encode(&twobytes, &onebyte, dest, src, false)
528 }
527 }
529
528
530 fn hash_mangle(src: &[u8], sha: &[u8]) -> Vec<u8> {
529 fn hash_mangle(src: &[u8], sha: &[u8]) -> Vec<u8> {
531 let dirprefixlen = 8;
530 let dirprefixlen = 8;
532 let maxshortdirslen = 68;
531 let maxshortdirslen = 68;
533 let mut destlen = 0;
532 let mut destlen = 0;
534
533
535 let last_slash = src.iter().rposition(|b| *b == b'/');
534 let last_slash = src.iter().rposition(|b| *b == b'/');
536 let last_dot: Option<usize> = {
535 let last_dot: Option<usize> = {
537 let s = last_slash.unwrap_or(0);
536 let s = last_slash.unwrap_or(0);
538 src[s..]
537 src[s..]
539 .iter()
538 .iter()
540 .rposition(|b| *b == b'.')
539 .rposition(|b| *b == b'.')
541 .and_then(|i| Some(i + s))
540 .and_then(|i| Some(i + s))
542 };
541 };
543
542
544 let mut dest = vec![0; MAXSTOREPATHLEN];
543 let mut dest = vec![0; MAXSTOREPATHLEN];
545 memcopy(Some(&mut dest), &mut destlen, b"dh/");
544 memcopy(Some(&mut dest), &mut destlen, b"dh/");
546
545
547 {
546 {
548 let mut first = true;
547 let mut first = true;
549 for slice in src[..last_slash.unwrap_or_else(|| src.len())]
548 for slice in src[..last_slash.unwrap_or_else(|| src.len())]
550 .split(|b| *b == b'/')
549 .split(|b| *b == b'/')
551 {
550 {
552 let slice = &slice[..std::cmp::min(slice.len(), dirprefixlen)];
551 let slice = &slice[..std::cmp::min(slice.len(), dirprefixlen)];
553 if destlen + (slice.len() + if first { 0 } else { 1 })
552 if destlen + (slice.len() + if first { 0 } else { 1 })
554 > maxshortdirslen + 3
553 > maxshortdirslen + 3
555 {
554 {
556 break;
555 break;
557 } else {
556 } else {
558 if !first {
557 if !first {
559 charcopy(Some(&mut dest), &mut destlen, b'/')
558 charcopy(Some(&mut dest), &mut destlen, b'/')
560 };
559 };
561 memcopy(Some(&mut dest), &mut destlen, slice);
560 memcopy(Some(&mut dest), &mut destlen, slice);
562 if dest[destlen - 1] == b'.' || dest[destlen - 1] == b' ' {
561 if dest[destlen - 1] == b'.' || dest[destlen - 1] == b' ' {
563 dest[destlen - 1] = b'_'
562 dest[destlen - 1] = b'_'
564 }
563 }
565 }
564 }
566 first = false;
565 first = false;
567 }
566 }
568 if !first {
567 if !first {
569 charcopy(Some(&mut dest), &mut destlen, b'/');
568 charcopy(Some(&mut dest), &mut destlen, b'/');
570 }
569 }
571 }
570 }
572
571
573 let used = destlen + 40 + {
572 let used = destlen + 40 + {
574 if let Some(l) = last_dot {
573 if let Some(l) = last_dot {
575 src.len() - l
574 src.len() - l
576 } else {
575 } else {
577 0
576 0
578 }
577 }
579 };
578 };
580
579
581 if MAXSTOREPATHLEN > used {
580 if MAXSTOREPATHLEN > used {
582 let slop = MAXSTOREPATHLEN - used;
581 let slop = MAXSTOREPATHLEN - used;
583 let basenamelen = match last_slash {
582 let basenamelen = match last_slash {
584 Some(l) => src.len() - l - 1,
583 Some(l) => src.len() - l - 1,
585 None => src.len(),
584 None => src.len(),
586 };
585 };
587 let basenamelen = std::cmp::min(basenamelen, slop);
586 let basenamelen = std::cmp::min(basenamelen, slop);
588 if basenamelen > 0 {
587 if basenamelen > 0 {
589 let start = match last_slash {
588 let start = match last_slash {
590 Some(l) => l + 1,
589 Some(l) => l + 1,
591 None => 0,
590 None => 0,
592 };
591 };
593 memcopy(
592 memcopy(
594 Some(&mut dest),
593 Some(&mut dest),
595 &mut destlen,
594 &mut destlen,
596 &src[start..][..basenamelen],
595 &src[start..][..basenamelen],
597 )
596 )
598 }
597 }
599 }
598 }
600 for c in sha {
599 for c in sha {
601 hexencode(Some(&mut dest), &mut destlen, *c);
600 hexencode(Some(&mut dest), &mut destlen, *c);
602 }
601 }
603 if let Some(l) = last_dot {
602 if let Some(l) = last_dot {
604 memcopy(Some(&mut dest), &mut destlen, &src[l..]);
603 memcopy(Some(&mut dest), &mut destlen, &src[l..]);
605 }
604 }
606 if destlen == dest.len() {
605 if destlen == dest.len() {
607 dest
606 dest
608 } else {
607 } else {
609 // sometimes the path are shorter than MAXSTOREPATHLEN
608 // sometimes the path are shorter than MAXSTOREPATHLEN
610 dest[..destlen].to_vec()
609 dest[..destlen].to_vec()
611 }
610 }
612 }
611 }
613
612
614 const MAXENCODE: usize = 4096 * 4;
613 const MAXENCODE: usize = 4096 * 4;
615 fn hash_encode(src: &[u8]) -> Vec<u8> {
614 fn hash_encode(src: &[u8]) -> Vec<u8> {
616 let dired = &mut [0; MAXENCODE];
615 let dired = &mut [0; MAXENCODE];
617 let lowered = &mut [0; MAXENCODE];
616 let lowered = &mut [0; MAXENCODE];
618 let auxed = &mut [0; MAXENCODE];
617 let auxed = &mut [0; MAXENCODE];
619 let baselen = (src.len() - 5) * 3;
618 let baselen = (src.len() - 5) * 3;
620 if baselen >= MAXENCODE {
619 if baselen >= MAXENCODE {
621 panic!("path_encode::hash_encore: string too long: {}", baselen)
620 panic!("path_encode::hash_encore: string too long: {}", baselen)
622 };
621 };
623 let dirlen = encode_dir(Some(&mut dired[..]), src);
622 let dirlen = encode_dir(Some(&mut dired[..]), src);
624 let sha = {
623 let sha = Sha1::digest(&dired[..dirlen]);
625 let mut hasher = Sha1::new();
626 hasher.input(&dired[..dirlen]);
627 let mut hash = vec![0; 20];
628 hasher.result(&mut hash);
629 hash
630 };
631 let lowerlen = lower_encode(Some(&mut lowered[..]), &dired[..dirlen][5..]);
624 let lowerlen = lower_encode(Some(&mut lowered[..]), &dired[..dirlen][5..]);
632 let auxlen = aux_encode(Some(&mut auxed[..]), &lowered[..lowerlen]);
625 let auxlen = aux_encode(Some(&mut auxed[..]), &lowered[..lowerlen]);
633 hash_mangle(&auxed[..auxlen], &sha)
626 hash_mangle(&auxed[..auxlen], &sha)
634 }
627 }
635
628
636 pub fn path_encode(path: &[u8]) -> Vec<u8> {
629 pub fn path_encode(path: &[u8]) -> Vec<u8> {
637 let newlen = if path.len() <= MAXSTOREPATHLEN {
630 let newlen = if path.len() <= MAXSTOREPATHLEN {
638 basic_encode(None, path)
631 basic_encode(None, path)
639 } else {
632 } else {
640 MAXSTOREPATHLEN + 1
633 MAXSTOREPATHLEN + 1
641 };
634 };
642 if newlen <= MAXSTOREPATHLEN {
635 if newlen <= MAXSTOREPATHLEN {
643 if newlen == path.len() {
636 if newlen == path.len() {
644 path.to_vec()
637 path.to_vec()
645 } else {
638 } else {
646 let mut res = vec![0; newlen];
639 let mut res = vec![0; newlen];
647 basic_encode(Some(&mut res), path);
640 basic_encode(Some(&mut res), path);
648 res
641 res
649 }
642 }
650 } else {
643 } else {
651 hash_encode(&path)
644 hash_encode(&path)
652 }
645 }
653 }
646 }
@@ -1,395 +1,396
1 use std::borrow::Cow;
1 use std::borrow::Cow;
2 use std::io::Read;
2 use std::io::Read;
3 use std::ops::Deref;
3 use std::ops::Deref;
4 use std::path::Path;
4 use std::path::Path;
5
5
6 use byteorder::{BigEndian, ByteOrder};
6 use byteorder::{BigEndian, ByteOrder};
7 use crypto::digest::Digest;
8 use crypto::sha1::Sha1;
9 use flate2::read::ZlibDecoder;
7 use flate2::read::ZlibDecoder;
10 use micro_timer::timed;
8 use micro_timer::timed;
9 use sha1::{Digest, Sha1};
11 use zstd;
10 use zstd;
12
11
13 use super::index::Index;
12 use super::index::Index;
14 use super::node::{NodePrefix, NODE_BYTES_LENGTH, NULL_NODE};
13 use super::node::{NodePrefix, NODE_BYTES_LENGTH, NULL_NODE};
15 use super::nodemap;
14 use super::nodemap;
16 use super::nodemap::{NodeMap, NodeMapError};
15 use super::nodemap::{NodeMap, NodeMapError};
17 use super::nodemap_docket::NodeMapDocket;
16 use super::nodemap_docket::NodeMapDocket;
18 use super::patch;
17 use super::patch;
19 use crate::errors::HgError;
18 use crate::errors::HgError;
20 use crate::repo::Repo;
19 use crate::repo::Repo;
21 use crate::revlog::Revision;
20 use crate::revlog::Revision;
22
21
23 #[derive(derive_more::From)]
22 #[derive(derive_more::From)]
24 pub enum RevlogError {
23 pub enum RevlogError {
25 InvalidRevision,
24 InvalidRevision,
26 /// Working directory is not supported
25 /// Working directory is not supported
27 WDirUnsupported,
26 WDirUnsupported,
28 /// Found more than one entry whose ID match the requested prefix
27 /// Found more than one entry whose ID match the requested prefix
29 AmbiguousPrefix,
28 AmbiguousPrefix,
30 #[from]
29 #[from]
31 Other(HgError),
30 Other(HgError),
32 }
31 }
33
32
34 impl From<NodeMapError> for RevlogError {
33 impl From<NodeMapError> for RevlogError {
35 fn from(error: NodeMapError) -> Self {
34 fn from(error: NodeMapError) -> Self {
36 match error {
35 match error {
37 NodeMapError::MultipleResults => RevlogError::AmbiguousPrefix,
36 NodeMapError::MultipleResults => RevlogError::AmbiguousPrefix,
38 NodeMapError::RevisionNotInIndex(_) => RevlogError::corrupted(),
37 NodeMapError::RevisionNotInIndex(_) => RevlogError::corrupted(),
39 }
38 }
40 }
39 }
41 }
40 }
42
41
43 impl RevlogError {
42 impl RevlogError {
44 fn corrupted() -> Self {
43 fn corrupted() -> Self {
45 RevlogError::Other(HgError::corrupted("corrupted revlog"))
44 RevlogError::Other(HgError::corrupted("corrupted revlog"))
46 }
45 }
47 }
46 }
48
47
49 /// Read only implementation of revlog.
48 /// Read only implementation of revlog.
50 pub struct Revlog {
49 pub struct Revlog {
51 /// When index and data are not interleaved: bytes of the revlog index.
50 /// When index and data are not interleaved: bytes of the revlog index.
52 /// When index and data are interleaved: bytes of the revlog index and
51 /// When index and data are interleaved: bytes of the revlog index and
53 /// data.
52 /// data.
54 pub(crate) index: Index,
53 pub(crate) index: Index,
55 /// When index and data are not interleaved: bytes of the revlog data
54 /// When index and data are not interleaved: bytes of the revlog data
56 data_bytes: Option<Box<dyn Deref<Target = [u8]> + Send>>,
55 data_bytes: Option<Box<dyn Deref<Target = [u8]> + Send>>,
57 /// When present on disk: the persistent nodemap for this revlog
56 /// When present on disk: the persistent nodemap for this revlog
58 nodemap: Option<nodemap::NodeTree>,
57 nodemap: Option<nodemap::NodeTree>,
59 }
58 }
60
59
61 impl Revlog {
60 impl Revlog {
62 /// Open a revlog index file.
61 /// Open a revlog index file.
63 ///
62 ///
64 /// It will also open the associated data file if index and data are not
63 /// It will also open the associated data file if index and data are not
65 /// interleaved.
64 /// interleaved.
66 #[timed]
65 #[timed]
67 pub fn open(
66 pub fn open(
68 repo: &Repo,
67 repo: &Repo,
69 index_path: impl AsRef<Path>,
68 index_path: impl AsRef<Path>,
70 data_path: Option<&Path>,
69 data_path: Option<&Path>,
71 ) -> Result<Self, RevlogError> {
70 ) -> Result<Self, RevlogError> {
72 let index_path = index_path.as_ref();
71 let index_path = index_path.as_ref();
73 let index_mmap = repo.store_vfs().mmap_open(&index_path)?;
72 let index_mmap = repo.store_vfs().mmap_open(&index_path)?;
74
73
75 let version = get_version(&index_mmap);
74 let version = get_version(&index_mmap);
76 if version != 1 {
75 if version != 1 {
77 // A proper new version should have had a repo/store requirement.
76 // A proper new version should have had a repo/store requirement.
78 return Err(RevlogError::corrupted());
77 return Err(RevlogError::corrupted());
79 }
78 }
80
79
81 let index = Index::new(Box::new(index_mmap))?;
80 let index = Index::new(Box::new(index_mmap))?;
82
81
83 let default_data_path = index_path.with_extension("d");
82 let default_data_path = index_path.with_extension("d");
84
83
85 // type annotation required
84 // type annotation required
86 // won't recognize Mmap as Deref<Target = [u8]>
85 // won't recognize Mmap as Deref<Target = [u8]>
87 let data_bytes: Option<Box<dyn Deref<Target = [u8]> + Send>> =
86 let data_bytes: Option<Box<dyn Deref<Target = [u8]> + Send>> =
88 if index.is_inline() {
87 if index.is_inline() {
89 None
88 None
90 } else {
89 } else {
91 let data_path = data_path.unwrap_or(&default_data_path);
90 let data_path = data_path.unwrap_or(&default_data_path);
92 let data_mmap = repo.store_vfs().mmap_open(data_path)?;
91 let data_mmap = repo.store_vfs().mmap_open(data_path)?;
93 Some(Box::new(data_mmap))
92 Some(Box::new(data_mmap))
94 };
93 };
95
94
96 let nodemap = NodeMapDocket::read_from_file(repo, index_path)?.map(
95 let nodemap = NodeMapDocket::read_from_file(repo, index_path)?.map(
97 |(docket, data)| {
96 |(docket, data)| {
98 nodemap::NodeTree::load_bytes(
97 nodemap::NodeTree::load_bytes(
99 Box::new(data),
98 Box::new(data),
100 docket.data_length,
99 docket.data_length,
101 )
100 )
102 },
101 },
103 );
102 );
104
103
105 Ok(Revlog {
104 Ok(Revlog {
106 index,
105 index,
107 data_bytes,
106 data_bytes,
108 nodemap,
107 nodemap,
109 })
108 })
110 }
109 }
111
110
112 /// Return number of entries of the `Revlog`.
111 /// Return number of entries of the `Revlog`.
113 pub fn len(&self) -> usize {
112 pub fn len(&self) -> usize {
114 self.index.len()
113 self.index.len()
115 }
114 }
116
115
117 /// Returns `true` if the `Revlog` has zero `entries`.
116 /// Returns `true` if the `Revlog` has zero `entries`.
118 pub fn is_empty(&self) -> bool {
117 pub fn is_empty(&self) -> bool {
119 self.index.is_empty()
118 self.index.is_empty()
120 }
119 }
121
120
122 /// Return the full data associated to a node.
121 /// Return the full data associated to a node.
123 #[timed]
122 #[timed]
124 pub fn get_node_rev(
123 pub fn get_node_rev(
125 &self,
124 &self,
126 node: NodePrefix,
125 node: NodePrefix,
127 ) -> Result<Revision, RevlogError> {
126 ) -> Result<Revision, RevlogError> {
128 if let Some(nodemap) = &self.nodemap {
127 if let Some(nodemap) = &self.nodemap {
129 return nodemap
128 return nodemap
130 .find_bin(&self.index, node)?
129 .find_bin(&self.index, node)?
131 .ok_or(RevlogError::InvalidRevision);
130 .ok_or(RevlogError::InvalidRevision);
132 }
131 }
133
132
134 // Fallback to linear scan when a persistent nodemap is not present.
133 // Fallback to linear scan when a persistent nodemap is not present.
135 // This happens when the persistent-nodemap experimental feature is not
134 // This happens when the persistent-nodemap experimental feature is not
136 // enabled, or for small revlogs.
135 // enabled, or for small revlogs.
137 //
136 //
138 // TODO: consider building a non-persistent nodemap in memory to
137 // TODO: consider building a non-persistent nodemap in memory to
139 // optimize these cases.
138 // optimize these cases.
140 let mut found_by_prefix = None;
139 let mut found_by_prefix = None;
141 for rev in (0..self.len() as Revision).rev() {
140 for rev in (0..self.len() as Revision).rev() {
142 let index_entry =
141 let index_entry =
143 self.index.get_entry(rev).ok_or(HgError::corrupted(
142 self.index.get_entry(rev).ok_or(HgError::corrupted(
144 "revlog references a revision not in the index",
143 "revlog references a revision not in the index",
145 ))?;
144 ))?;
146 if node == *index_entry.hash() {
145 if node == *index_entry.hash() {
147 return Ok(rev);
146 return Ok(rev);
148 }
147 }
149 if node.is_prefix_of(index_entry.hash()) {
148 if node.is_prefix_of(index_entry.hash()) {
150 if found_by_prefix.is_some() {
149 if found_by_prefix.is_some() {
151 return Err(RevlogError::AmbiguousPrefix);
150 return Err(RevlogError::AmbiguousPrefix);
152 }
151 }
153 found_by_prefix = Some(rev)
152 found_by_prefix = Some(rev)
154 }
153 }
155 }
154 }
156 found_by_prefix.ok_or(RevlogError::InvalidRevision)
155 found_by_prefix.ok_or(RevlogError::InvalidRevision)
157 }
156 }
158
157
159 /// Returns whether the given revision exists in this revlog.
158 /// Returns whether the given revision exists in this revlog.
160 pub fn has_rev(&self, rev: Revision) -> bool {
159 pub fn has_rev(&self, rev: Revision) -> bool {
161 self.index.get_entry(rev).is_some()
160 self.index.get_entry(rev).is_some()
162 }
161 }
163
162
164 /// Return the full data associated to a revision.
163 /// Return the full data associated to a revision.
165 ///
164 ///
166 /// All entries required to build the final data out of deltas will be
165 /// All entries required to build the final data out of deltas will be
167 /// retrieved as needed, and the deltas will be applied to the inital
166 /// retrieved as needed, and the deltas will be applied to the inital
168 /// snapshot to rebuild the final data.
167 /// snapshot to rebuild the final data.
169 #[timed]
168 #[timed]
170 pub fn get_rev_data(&self, rev: Revision) -> Result<Vec<u8>, RevlogError> {
169 pub fn get_rev_data(&self, rev: Revision) -> Result<Vec<u8>, RevlogError> {
171 // Todo return -> Cow
170 // Todo return -> Cow
172 let mut entry = self.get_entry(rev)?;
171 let mut entry = self.get_entry(rev)?;
173 let mut delta_chain = vec![];
172 let mut delta_chain = vec![];
174 while let Some(base_rev) = entry.base_rev {
173 while let Some(base_rev) = entry.base_rev {
175 delta_chain.push(entry);
174 delta_chain.push(entry);
176 entry = self
175 entry = self
177 .get_entry(base_rev)
176 .get_entry(base_rev)
178 .map_err(|_| RevlogError::corrupted())?;
177 .map_err(|_| RevlogError::corrupted())?;
179 }
178 }
180
179
181 // TODO do not look twice in the index
180 // TODO do not look twice in the index
182 let index_entry = self
181 let index_entry = self
183 .index
182 .index
184 .get_entry(rev)
183 .get_entry(rev)
185 .ok_or(RevlogError::InvalidRevision)?;
184 .ok_or(RevlogError::InvalidRevision)?;
186
185
187 let data: Vec<u8> = if delta_chain.is_empty() {
186 let data: Vec<u8> = if delta_chain.is_empty() {
188 entry.data()?.into()
187 entry.data()?.into()
189 } else {
188 } else {
190 Revlog::build_data_from_deltas(entry, &delta_chain)?
189 Revlog::build_data_from_deltas(entry, &delta_chain)?
191 };
190 };
192
191
193 if self.check_hash(
192 if self.check_hash(
194 index_entry.p1(),
193 index_entry.p1(),
195 index_entry.p2(),
194 index_entry.p2(),
196 index_entry.hash().as_bytes(),
195 index_entry.hash().as_bytes(),
197 &data,
196 &data,
198 ) {
197 ) {
199 Ok(data)
198 Ok(data)
200 } else {
199 } else {
201 Err(RevlogError::corrupted())
200 Err(RevlogError::corrupted())
202 }
201 }
203 }
202 }
204
203
205 /// Check the hash of some given data against the recorded hash.
204 /// Check the hash of some given data against the recorded hash.
206 pub fn check_hash(
205 pub fn check_hash(
207 &self,
206 &self,
208 p1: Revision,
207 p1: Revision,
209 p2: Revision,
208 p2: Revision,
210 expected: &[u8],
209 expected: &[u8],
211 data: &[u8],
210 data: &[u8],
212 ) -> bool {
211 ) -> bool {
213 let e1 = self.index.get_entry(p1);
212 let e1 = self.index.get_entry(p1);
214 let h1 = match e1 {
213 let h1 = match e1 {
215 Some(ref entry) => entry.hash(),
214 Some(ref entry) => entry.hash(),
216 None => &NULL_NODE,
215 None => &NULL_NODE,
217 };
216 };
218 let e2 = self.index.get_entry(p2);
217 let e2 = self.index.get_entry(p2);
219 let h2 = match e2 {
218 let h2 = match e2 {
220 Some(ref entry) => entry.hash(),
219 Some(ref entry) => entry.hash(),
221 None => &NULL_NODE,
220 None => &NULL_NODE,
222 };
221 };
223
222
224 hash(data, h1.as_bytes(), h2.as_bytes()).as_slice() == expected
223 &hash(data, h1.as_bytes(), h2.as_bytes()) == expected
225 }
224 }
226
225
227 /// Build the full data of a revision out its snapshot
226 /// Build the full data of a revision out its snapshot
228 /// and its deltas.
227 /// and its deltas.
229 #[timed]
228 #[timed]
230 fn build_data_from_deltas(
229 fn build_data_from_deltas(
231 snapshot: RevlogEntry,
230 snapshot: RevlogEntry,
232 deltas: &[RevlogEntry],
231 deltas: &[RevlogEntry],
233 ) -> Result<Vec<u8>, RevlogError> {
232 ) -> Result<Vec<u8>, RevlogError> {
234 let snapshot = snapshot.data()?;
233 let snapshot = snapshot.data()?;
235 let deltas = deltas
234 let deltas = deltas
236 .iter()
235 .iter()
237 .rev()
236 .rev()
238 .map(RevlogEntry::data)
237 .map(RevlogEntry::data)
239 .collect::<Result<Vec<Cow<'_, [u8]>>, RevlogError>>()?;
238 .collect::<Result<Vec<Cow<'_, [u8]>>, RevlogError>>()?;
240 let patches: Vec<_> =
239 let patches: Vec<_> =
241 deltas.iter().map(|d| patch::PatchList::new(d)).collect();
240 deltas.iter().map(|d| patch::PatchList::new(d)).collect();
242 let patch = patch::fold_patch_lists(&patches);
241 let patch = patch::fold_patch_lists(&patches);
243 Ok(patch.apply(&snapshot))
242 Ok(patch.apply(&snapshot))
244 }
243 }
245
244
246 /// Return the revlog data.
245 /// Return the revlog data.
247 fn data(&self) -> &[u8] {
246 fn data(&self) -> &[u8] {
248 match self.data_bytes {
247 match self.data_bytes {
249 Some(ref data_bytes) => &data_bytes,
248 Some(ref data_bytes) => &data_bytes,
250 None => panic!(
249 None => panic!(
251 "forgot to load the data or trying to access inline data"
250 "forgot to load the data or trying to access inline data"
252 ),
251 ),
253 }
252 }
254 }
253 }
255
254
256 /// Get an entry of the revlog.
255 /// Get an entry of the revlog.
257 fn get_entry(&self, rev: Revision) -> Result<RevlogEntry, RevlogError> {
256 fn get_entry(&self, rev: Revision) -> Result<RevlogEntry, RevlogError> {
258 let index_entry = self
257 let index_entry = self
259 .index
258 .index
260 .get_entry(rev)
259 .get_entry(rev)
261 .ok_or(RevlogError::InvalidRevision)?;
260 .ok_or(RevlogError::InvalidRevision)?;
262 let start = index_entry.offset();
261 let start = index_entry.offset();
263 let end = start + index_entry.compressed_len();
262 let end = start + index_entry.compressed_len();
264 let data = if self.index.is_inline() {
263 let data = if self.index.is_inline() {
265 self.index.data(start, end)
264 self.index.data(start, end)
266 } else {
265 } else {
267 &self.data()[start..end]
266 &self.data()[start..end]
268 };
267 };
269 let entry = RevlogEntry {
268 let entry = RevlogEntry {
270 rev,
269 rev,
271 bytes: data,
270 bytes: data,
272 compressed_len: index_entry.compressed_len(),
271 compressed_len: index_entry.compressed_len(),
273 uncompressed_len: index_entry.uncompressed_len(),
272 uncompressed_len: index_entry.uncompressed_len(),
274 base_rev: if index_entry.base_revision() == rev {
273 base_rev: if index_entry.base_revision() == rev {
275 None
274 None
276 } else {
275 } else {
277 Some(index_entry.base_revision())
276 Some(index_entry.base_revision())
278 },
277 },
279 };
278 };
280 Ok(entry)
279 Ok(entry)
281 }
280 }
282 }
281 }
283
282
284 /// The revlog entry's bytes and the necessary informations to extract
283 /// The revlog entry's bytes and the necessary informations to extract
285 /// the entry's data.
284 /// the entry's data.
286 #[derive(Debug)]
285 #[derive(Debug)]
287 pub struct RevlogEntry<'a> {
286 pub struct RevlogEntry<'a> {
288 rev: Revision,
287 rev: Revision,
289 bytes: &'a [u8],
288 bytes: &'a [u8],
290 compressed_len: usize,
289 compressed_len: usize,
291 uncompressed_len: usize,
290 uncompressed_len: usize,
292 base_rev: Option<Revision>,
291 base_rev: Option<Revision>,
293 }
292 }
294
293
295 impl<'a> RevlogEntry<'a> {
294 impl<'a> RevlogEntry<'a> {
296 /// Extract the data contained in the entry.
295 /// Extract the data contained in the entry.
297 pub fn data(&self) -> Result<Cow<'_, [u8]>, RevlogError> {
296 pub fn data(&self) -> Result<Cow<'_, [u8]>, RevlogError> {
298 if self.bytes.is_empty() {
297 if self.bytes.is_empty() {
299 return Ok(Cow::Borrowed(&[]));
298 return Ok(Cow::Borrowed(&[]));
300 }
299 }
301 match self.bytes[0] {
300 match self.bytes[0] {
302 // Revision data is the entirety of the entry, including this
301 // Revision data is the entirety of the entry, including this
303 // header.
302 // header.
304 b'\0' => Ok(Cow::Borrowed(self.bytes)),
303 b'\0' => Ok(Cow::Borrowed(self.bytes)),
305 // Raw revision data follows.
304 // Raw revision data follows.
306 b'u' => Ok(Cow::Borrowed(&self.bytes[1..])),
305 b'u' => Ok(Cow::Borrowed(&self.bytes[1..])),
307 // zlib (RFC 1950) data.
306 // zlib (RFC 1950) data.
308 b'x' => Ok(Cow::Owned(self.uncompressed_zlib_data()?)),
307 b'x' => Ok(Cow::Owned(self.uncompressed_zlib_data()?)),
309 // zstd data.
308 // zstd data.
310 b'\x28' => Ok(Cow::Owned(self.uncompressed_zstd_data()?)),
309 b'\x28' => Ok(Cow::Owned(self.uncompressed_zstd_data()?)),
311 // A proper new format should have had a repo/store requirement.
310 // A proper new format should have had a repo/store requirement.
312 _format_type => Err(RevlogError::corrupted()),
311 _format_type => Err(RevlogError::corrupted()),
313 }
312 }
314 }
313 }
315
314
316 fn uncompressed_zlib_data(&self) -> Result<Vec<u8>, RevlogError> {
315 fn uncompressed_zlib_data(&self) -> Result<Vec<u8>, RevlogError> {
317 let mut decoder = ZlibDecoder::new(self.bytes);
316 let mut decoder = ZlibDecoder::new(self.bytes);
318 if self.is_delta() {
317 if self.is_delta() {
319 let mut buf = Vec::with_capacity(self.compressed_len);
318 let mut buf = Vec::with_capacity(self.compressed_len);
320 decoder
319 decoder
321 .read_to_end(&mut buf)
320 .read_to_end(&mut buf)
322 .map_err(|_| RevlogError::corrupted())?;
321 .map_err(|_| RevlogError::corrupted())?;
323 Ok(buf)
322 Ok(buf)
324 } else {
323 } else {
325 let mut buf = vec![0; self.uncompressed_len];
324 let mut buf = vec![0; self.uncompressed_len];
326 decoder
325 decoder
327 .read_exact(&mut buf)
326 .read_exact(&mut buf)
328 .map_err(|_| RevlogError::corrupted())?;
327 .map_err(|_| RevlogError::corrupted())?;
329 Ok(buf)
328 Ok(buf)
330 }
329 }
331 }
330 }
332
331
333 fn uncompressed_zstd_data(&self) -> Result<Vec<u8>, RevlogError> {
332 fn uncompressed_zstd_data(&self) -> Result<Vec<u8>, RevlogError> {
334 if self.is_delta() {
333 if self.is_delta() {
335 let mut buf = Vec::with_capacity(self.compressed_len);
334 let mut buf = Vec::with_capacity(self.compressed_len);
336 zstd::stream::copy_decode(self.bytes, &mut buf)
335 zstd::stream::copy_decode(self.bytes, &mut buf)
337 .map_err(|_| RevlogError::corrupted())?;
336 .map_err(|_| RevlogError::corrupted())?;
338 Ok(buf)
337 Ok(buf)
339 } else {
338 } else {
340 let mut buf = vec![0; self.uncompressed_len];
339 let mut buf = vec![0; self.uncompressed_len];
341 let len = zstd::block::decompress_to_buffer(self.bytes, &mut buf)
340 let len = zstd::block::decompress_to_buffer(self.bytes, &mut buf)
342 .map_err(|_| RevlogError::corrupted())?;
341 .map_err(|_| RevlogError::corrupted())?;
343 if len != self.uncompressed_len {
342 if len != self.uncompressed_len {
344 Err(RevlogError::corrupted())
343 Err(RevlogError::corrupted())
345 } else {
344 } else {
346 Ok(buf)
345 Ok(buf)
347 }
346 }
348 }
347 }
349 }
348 }
350
349
351 /// Tell if the entry is a snapshot or a delta
350 /// Tell if the entry is a snapshot or a delta
352 /// (influences on decompression).
351 /// (influences on decompression).
353 fn is_delta(&self) -> bool {
352 fn is_delta(&self) -> bool {
354 self.base_rev.is_some()
353 self.base_rev.is_some()
355 }
354 }
356 }
355 }
357
356
358 /// Format version of the revlog.
357 /// Format version of the revlog.
359 pub fn get_version(index_bytes: &[u8]) -> u16 {
358 pub fn get_version(index_bytes: &[u8]) -> u16 {
360 BigEndian::read_u16(&index_bytes[2..=3])
359 BigEndian::read_u16(&index_bytes[2..=3])
361 }
360 }
362
361
363 /// Calculate the hash of a revision given its data and its parents.
362 /// Calculate the hash of a revision given its data and its parents.
364 fn hash(data: &[u8], p1_hash: &[u8], p2_hash: &[u8]) -> Vec<u8> {
363 fn hash(
364 data: &[u8],
365 p1_hash: &[u8],
366 p2_hash: &[u8],
367 ) -> [u8; NODE_BYTES_LENGTH] {
365 let mut hasher = Sha1::new();
368 let mut hasher = Sha1::new();
366 let (a, b) = (p1_hash, p2_hash);
369 let (a, b) = (p1_hash, p2_hash);
367 if a > b {
370 if a > b {
368 hasher.input(b);
371 hasher.update(b);
369 hasher.input(a);
372 hasher.update(a);
370 } else {
373 } else {
371 hasher.input(a);
374 hasher.update(a);
372 hasher.input(b);
375 hasher.update(b);
373 }
376 }
374 hasher.input(data);
377 hasher.update(data);
375 let mut hash = vec![0; NODE_BYTES_LENGTH];
378 *hasher.finalize().as_ref()
376 hasher.result(&mut hash);
377 hash
378 }
379 }
379
380
380 #[cfg(test)]
381 #[cfg(test)]
381 mod tests {
382 mod tests {
382 use super::*;
383 use super::*;
383
384
384 use super::super::index::IndexEntryBuilder;
385 use super::super::index::IndexEntryBuilder;
385
386
386 #[test]
387 #[test]
387 fn version_test() {
388 fn version_test() {
388 let bytes = IndexEntryBuilder::new()
389 let bytes = IndexEntryBuilder::new()
389 .is_first(true)
390 .is_first(true)
390 .with_version(1)
391 .with_version(1)
391 .build();
392 .build();
392
393
393 assert_eq!(get_version(&bytes), 1)
394 assert_eq!(get_version(&bytes), 1)
394 }
395 }
395 }
396 }
General Comments 0
You need to be logged in to leave comments. Login now