##// END OF EJS Templates
dirstate-tree: Serialize to disk...
Simon Sapin -
r47872:d6c94ca4 default
parent child Browse files
Show More
@@ -1,1104 +1,1104
1 1 # This file is automatically @generated by Cargo.
2 2 # It is not intended for manual editing.
3 3 [[package]]
4 4 name = "adler"
5 5 version = "0.2.3"
6 6 source = "registry+https://github.com/rust-lang/crates.io-index"
7 7 checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
8 8
9 9 [[package]]
10 10 name = "aho-corasick"
11 11 version = "0.7.15"
12 12 source = "registry+https://github.com/rust-lang/crates.io-index"
13 13 checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
14 14 dependencies = [
15 15 "memchr",
16 16 ]
17 17
18 18 [[package]]
19 19 name = "ansi_term"
20 20 version = "0.11.0"
21 21 source = "registry+https://github.com/rust-lang/crates.io-index"
22 22 checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
23 23 dependencies = [
24 24 "winapi",
25 25 ]
26 26
27 27 [[package]]
28 28 name = "atty"
29 29 version = "0.2.14"
30 30 source = "registry+https://github.com/rust-lang/crates.io-index"
31 31 checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
32 32 dependencies = [
33 33 "hermit-abi",
34 34 "libc",
35 35 "winapi",
36 36 ]
37 37
38 38 [[package]]
39 39 name = "autocfg"
40 40 version = "1.0.1"
41 41 source = "registry+https://github.com/rust-lang/crates.io-index"
42 42 checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
43 43
44 44 [[package]]
45 45 name = "bitflags"
46 46 version = "1.2.1"
47 47 source = "registry+https://github.com/rust-lang/crates.io-index"
48 48 checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
49 49
50 50 [[package]]
51 51 name = "bitmaps"
52 52 version = "2.1.0"
53 53 source = "registry+https://github.com/rust-lang/crates.io-index"
54 54 checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
55 55 dependencies = [
56 56 "typenum",
57 57 ]
58 58
59 59 [[package]]
60 60 name = "byteorder"
61 61 version = "1.3.4"
62 62 source = "registry+https://github.com/rust-lang/crates.io-index"
63 63 checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
64 64
65 65 [[package]]
66 66 name = "bytes-cast"
67 version = "0.1.0"
67 version = "0.2.0"
68 68 source = "registry+https://github.com/rust-lang/crates.io-index"
69 checksum = "3196ba300c7bc9282a4331e878496cb3e9603a898a8f1446601317163e16ca52"
69 checksum = "0d434f9a4ecbe987e7ccfda7274b6f82ea52c9b63742565a65cb5e8ba0f2c452"
70 70 dependencies = [
71 71 "bytes-cast-derive",
72 72 ]
73 73
74 74 [[package]]
75 75 name = "bytes-cast-derive"
76 76 version = "0.1.0"
77 77 source = "registry+https://github.com/rust-lang/crates.io-index"
78 78 checksum = "cb936af9de38476664d6b58e529aff30d482e4ce1c5e150293d00730b0d81fdb"
79 79 dependencies = [
80 80 "proc-macro2",
81 81 "quote",
82 82 "syn",
83 83 ]
84 84
85 85 [[package]]
86 86 name = "cc"
87 87 version = "1.0.66"
88 88 source = "registry+https://github.com/rust-lang/crates.io-index"
89 89 checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
90 90 dependencies = [
91 91 "jobserver",
92 92 ]
93 93
94 94 [[package]]
95 95 name = "cfg-if"
96 96 version = "0.1.10"
97 97 source = "registry+https://github.com/rust-lang/crates.io-index"
98 98 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
99 99
100 100 [[package]]
101 101 name = "cfg-if"
102 102 version = "1.0.0"
103 103 source = "registry+https://github.com/rust-lang/crates.io-index"
104 104 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
105 105
106 106 [[package]]
107 107 name = "chrono"
108 108 version = "0.4.19"
109 109 source = "registry+https://github.com/rust-lang/crates.io-index"
110 110 checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
111 111 dependencies = [
112 112 "libc",
113 113 "num-integer",
114 114 "num-traits",
115 115 "time",
116 116 "winapi",
117 117 ]
118 118
119 119 [[package]]
120 120 name = "clap"
121 121 version = "2.33.3"
122 122 source = "registry+https://github.com/rust-lang/crates.io-index"
123 123 checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
124 124 dependencies = [
125 125 "ansi_term",
126 126 "atty",
127 127 "bitflags",
128 128 "strsim",
129 129 "textwrap",
130 130 "unicode-width",
131 131 "vec_map",
132 132 ]
133 133
134 134 [[package]]
135 135 name = "const_fn"
136 136 version = "0.4.4"
137 137 source = "registry+https://github.com/rust-lang/crates.io-index"
138 138 checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
139 139
140 140 [[package]]
141 141 name = "cpython"
142 142 version = "0.5.2"
143 143 source = "registry+https://github.com/rust-lang/crates.io-index"
144 144 checksum = "0f11357af68648b6a227e7e2384d439cec8595de65970f45e3f7f4b2600be472"
145 145 dependencies = [
146 146 "libc",
147 147 "num-traits",
148 148 "paste",
149 149 "python27-sys",
150 150 "python3-sys",
151 151 ]
152 152
153 153 [[package]]
154 154 name = "crc32fast"
155 155 version = "1.2.1"
156 156 source = "registry+https://github.com/rust-lang/crates.io-index"
157 157 checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
158 158 dependencies = [
159 159 "cfg-if 1.0.0",
160 160 ]
161 161
162 162 [[package]]
163 163 name = "crossbeam-channel"
164 164 version = "0.4.4"
165 165 source = "registry+https://github.com/rust-lang/crates.io-index"
166 166 checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
167 167 dependencies = [
168 168 "crossbeam-utils 0.7.2",
169 169 "maybe-uninit",
170 170 ]
171 171
172 172 [[package]]
173 173 name = "crossbeam-channel"
174 174 version = "0.5.0"
175 175 source = "registry+https://github.com/rust-lang/crates.io-index"
176 176 checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
177 177 dependencies = [
178 178 "cfg-if 1.0.0",
179 179 "crossbeam-utils 0.8.1",
180 180 ]
181 181
182 182 [[package]]
183 183 name = "crossbeam-deque"
184 184 version = "0.8.0"
185 185 source = "registry+https://github.com/rust-lang/crates.io-index"
186 186 checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
187 187 dependencies = [
188 188 "cfg-if 1.0.0",
189 189 "crossbeam-epoch",
190 190 "crossbeam-utils 0.8.1",
191 191 ]
192 192
193 193 [[package]]
194 194 name = "crossbeam-epoch"
195 195 version = "0.9.1"
196 196 source = "registry+https://github.com/rust-lang/crates.io-index"
197 197 checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
198 198 dependencies = [
199 199 "cfg-if 1.0.0",
200 200 "const_fn",
201 201 "crossbeam-utils 0.8.1",
202 202 "lazy_static",
203 203 "memoffset",
204 204 "scopeguard",
205 205 ]
206 206
207 207 [[package]]
208 208 name = "crossbeam-utils"
209 209 version = "0.7.2"
210 210 source = "registry+https://github.com/rust-lang/crates.io-index"
211 211 checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
212 212 dependencies = [
213 213 "autocfg",
214 214 "cfg-if 0.1.10",
215 215 "lazy_static",
216 216 ]
217 217
218 218 [[package]]
219 219 name = "crossbeam-utils"
220 220 version = "0.8.1"
221 221 source = "registry+https://github.com/rust-lang/crates.io-index"
222 222 checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
223 223 dependencies = [
224 224 "autocfg",
225 225 "cfg-if 1.0.0",
226 226 "lazy_static",
227 227 ]
228 228
229 229 [[package]]
230 230 name = "ctor"
231 231 version = "0.1.16"
232 232 source = "registry+https://github.com/rust-lang/crates.io-index"
233 233 checksum = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
234 234 dependencies = [
235 235 "quote",
236 236 "syn",
237 237 ]
238 238
239 239 [[package]]
240 240 name = "derive_more"
241 241 version = "0.99.11"
242 242 source = "registry+https://github.com/rust-lang/crates.io-index"
243 243 checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
244 244 dependencies = [
245 245 "proc-macro2",
246 246 "quote",
247 247 "syn",
248 248 ]
249 249
250 250 [[package]]
251 251 name = "difference"
252 252 version = "2.0.0"
253 253 source = "registry+https://github.com/rust-lang/crates.io-index"
254 254 checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
255 255
256 256 [[package]]
257 257 name = "either"
258 258 version = "1.6.1"
259 259 source = "registry+https://github.com/rust-lang/crates.io-index"
260 260 checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
261 261
262 262 [[package]]
263 263 name = "env_logger"
264 264 version = "0.7.1"
265 265 source = "registry+https://github.com/rust-lang/crates.io-index"
266 266 checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
267 267 dependencies = [
268 268 "atty",
269 269 "humantime",
270 270 "log",
271 271 "regex",
272 272 "termcolor",
273 273 ]
274 274
275 275 [[package]]
276 276 name = "flate2"
277 277 version = "1.0.19"
278 278 source = "registry+https://github.com/rust-lang/crates.io-index"
279 279 checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129"
280 280 dependencies = [
281 281 "cfg-if 1.0.0",
282 282 "crc32fast",
283 283 "libc",
284 284 "libz-sys",
285 285 "miniz_oxide",
286 286 ]
287 287
288 288 [[package]]
289 289 name = "format-bytes"
290 290 version = "0.2.2"
291 291 source = "registry+https://github.com/rust-lang/crates.io-index"
292 292 checksum = "1c4e89040c7fd7b4e6ba2820ac705a45def8a0c098ec78d170ae88f1ef1d5762"
293 293 dependencies = [
294 294 "format-bytes-macros",
295 295 "proc-macro-hack",
296 296 ]
297 297
298 298 [[package]]
299 299 name = "format-bytes-macros"
300 300 version = "0.3.0"
301 301 source = "registry+https://github.com/rust-lang/crates.io-index"
302 302 checksum = "b05089e341a0460449e2210c3bf7b61597860b07f0deae58da38dbed0a4c6b6d"
303 303 dependencies = [
304 304 "proc-macro-hack",
305 305 "proc-macro2",
306 306 "quote",
307 307 "syn",
308 308 ]
309 309
310 310 [[package]]
311 311 name = "fuchsia-cprng"
312 312 version = "0.1.1"
313 313 source = "registry+https://github.com/rust-lang/crates.io-index"
314 314 checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
315 315
316 316 [[package]]
317 317 name = "gcc"
318 318 version = "0.3.55"
319 319 source = "registry+https://github.com/rust-lang/crates.io-index"
320 320 checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
321 321
322 322 [[package]]
323 323 name = "getrandom"
324 324 version = "0.1.15"
325 325 source = "registry+https://github.com/rust-lang/crates.io-index"
326 326 checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
327 327 dependencies = [
328 328 "cfg-if 0.1.10",
329 329 "libc",
330 330 "wasi 0.9.0+wasi-snapshot-preview1",
331 331 ]
332 332
333 333 [[package]]
334 334 name = "glob"
335 335 version = "0.3.0"
336 336 source = "registry+https://github.com/rust-lang/crates.io-index"
337 337 checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
338 338
339 339 [[package]]
340 340 name = "hermit-abi"
341 341 version = "0.1.17"
342 342 source = "registry+https://github.com/rust-lang/crates.io-index"
343 343 checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
344 344 dependencies = [
345 345 "libc",
346 346 ]
347 347
348 348 [[package]]
349 349 name = "hg-core"
350 350 version = "0.1.0"
351 351 dependencies = [
352 352 "byteorder",
353 353 "bytes-cast",
354 354 "clap",
355 355 "crossbeam-channel 0.4.4",
356 356 "derive_more",
357 357 "flate2",
358 358 "format-bytes",
359 359 "home",
360 360 "im-rc",
361 361 "lazy_static",
362 362 "log",
363 363 "memmap",
364 364 "micro-timer",
365 365 "pretty_assertions",
366 366 "rand 0.7.3",
367 367 "rand_distr",
368 368 "rand_pcg",
369 369 "rayon",
370 370 "regex",
371 371 "rust-crypto",
372 372 "same-file",
373 373 "tempfile",
374 374 "twox-hash",
375 375 "zstd",
376 376 ]
377 377
378 378 [[package]]
379 379 name = "hg-cpython"
380 380 version = "0.1.0"
381 381 dependencies = [
382 382 "cpython",
383 383 "crossbeam-channel 0.4.4",
384 384 "env_logger",
385 385 "hg-core",
386 386 "libc",
387 387 "log",
388 388 ]
389 389
390 390 [[package]]
391 391 name = "home"
392 392 version = "0.5.3"
393 393 source = "registry+https://github.com/rust-lang/crates.io-index"
394 394 checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654"
395 395 dependencies = [
396 396 "winapi",
397 397 ]
398 398
399 399 [[package]]
400 400 name = "humantime"
401 401 version = "1.3.0"
402 402 source = "registry+https://github.com/rust-lang/crates.io-index"
403 403 checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
404 404 dependencies = [
405 405 "quick-error",
406 406 ]
407 407
408 408 [[package]]
409 409 name = "im-rc"
410 410 version = "15.0.0"
411 411 source = "registry+https://github.com/rust-lang/crates.io-index"
412 412 checksum = "3ca8957e71f04a205cb162508f9326aea04676c8dfd0711220190d6b83664f3f"
413 413 dependencies = [
414 414 "bitmaps",
415 415 "rand_core 0.5.1",
416 416 "rand_xoshiro",
417 417 "sized-chunks",
418 418 "typenum",
419 419 "version_check",
420 420 ]
421 421
422 422 [[package]]
423 423 name = "itertools"
424 424 version = "0.9.0"
425 425 source = "registry+https://github.com/rust-lang/crates.io-index"
426 426 checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
427 427 dependencies = [
428 428 "either",
429 429 ]
430 430
431 431 [[package]]
432 432 name = "jobserver"
433 433 version = "0.1.21"
434 434 source = "registry+https://github.com/rust-lang/crates.io-index"
435 435 checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
436 436 dependencies = [
437 437 "libc",
438 438 ]
439 439
440 440 [[package]]
441 441 name = "lazy_static"
442 442 version = "1.4.0"
443 443 source = "registry+https://github.com/rust-lang/crates.io-index"
444 444 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
445 445
446 446 [[package]]
447 447 name = "libc"
448 448 version = "0.2.81"
449 449 source = "registry+https://github.com/rust-lang/crates.io-index"
450 450 checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
451 451
452 452 [[package]]
453 453 name = "libz-sys"
454 454 version = "1.1.2"
455 455 source = "registry+https://github.com/rust-lang/crates.io-index"
456 456 checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
457 457 dependencies = [
458 458 "cc",
459 459 "pkg-config",
460 460 "vcpkg",
461 461 ]
462 462
463 463 [[package]]
464 464 name = "log"
465 465 version = "0.4.11"
466 466 source = "registry+https://github.com/rust-lang/crates.io-index"
467 467 checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
468 468 dependencies = [
469 469 "cfg-if 0.1.10",
470 470 ]
471 471
472 472 [[package]]
473 473 name = "maybe-uninit"
474 474 version = "2.0.0"
475 475 source = "registry+https://github.com/rust-lang/crates.io-index"
476 476 checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
477 477
478 478 [[package]]
479 479 name = "memchr"
480 480 version = "2.3.4"
481 481 source = "registry+https://github.com/rust-lang/crates.io-index"
482 482 checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
483 483
484 484 [[package]]
485 485 name = "memmap"
486 486 version = "0.7.0"
487 487 source = "registry+https://github.com/rust-lang/crates.io-index"
488 488 checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
489 489 dependencies = [
490 490 "libc",
491 491 "winapi",
492 492 ]
493 493
494 494 [[package]]
495 495 name = "memoffset"
496 496 version = "0.6.1"
497 497 source = "registry+https://github.com/rust-lang/crates.io-index"
498 498 checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
499 499 dependencies = [
500 500 "autocfg",
501 501 ]
502 502
503 503 [[package]]
504 504 name = "micro-timer"
505 505 version = "0.3.1"
506 506 source = "registry+https://github.com/rust-lang/crates.io-index"
507 507 checksum = "2620153e1d903d26b72b89f0e9c48d8c4756cba941c185461dddc234980c298c"
508 508 dependencies = [
509 509 "micro-timer-macros",
510 510 "scopeguard",
511 511 ]
512 512
513 513 [[package]]
514 514 name = "micro-timer-macros"
515 515 version = "0.3.1"
516 516 source = "registry+https://github.com/rust-lang/crates.io-index"
517 517 checksum = "e28a3473e6abd6e9aab36aaeef32ad22ae0bd34e79f376643594c2b152ec1c5d"
518 518 dependencies = [
519 519 "proc-macro2",
520 520 "quote",
521 521 "scopeguard",
522 522 "syn",
523 523 ]
524 524
525 525 [[package]]
526 526 name = "miniz_oxide"
527 527 version = "0.4.3"
528 528 source = "registry+https://github.com/rust-lang/crates.io-index"
529 529 checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
530 530 dependencies = [
531 531 "adler",
532 532 "autocfg",
533 533 ]
534 534
535 535 [[package]]
536 536 name = "num-integer"
537 537 version = "0.1.44"
538 538 source = "registry+https://github.com/rust-lang/crates.io-index"
539 539 checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
540 540 dependencies = [
541 541 "autocfg",
542 542 "num-traits",
543 543 ]
544 544
545 545 [[package]]
546 546 name = "num-traits"
547 547 version = "0.2.14"
548 548 source = "registry+https://github.com/rust-lang/crates.io-index"
549 549 checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
550 550 dependencies = [
551 551 "autocfg",
552 552 ]
553 553
554 554 [[package]]
555 555 name = "num_cpus"
556 556 version = "1.13.0"
557 557 source = "registry+https://github.com/rust-lang/crates.io-index"
558 558 checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
559 559 dependencies = [
560 560 "hermit-abi",
561 561 "libc",
562 562 ]
563 563
564 564 [[package]]
565 565 name = "output_vt100"
566 566 version = "0.1.2"
567 567 source = "registry+https://github.com/rust-lang/crates.io-index"
568 568 checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9"
569 569 dependencies = [
570 570 "winapi",
571 571 ]
572 572
573 573 [[package]]
574 574 name = "paste"
575 575 version = "0.1.18"
576 576 source = "registry+https://github.com/rust-lang/crates.io-index"
577 577 checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
578 578 dependencies = [
579 579 "paste-impl",
580 580 "proc-macro-hack",
581 581 ]
582 582
583 583 [[package]]
584 584 name = "paste-impl"
585 585 version = "0.1.18"
586 586 source = "registry+https://github.com/rust-lang/crates.io-index"
587 587 checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
588 588 dependencies = [
589 589 "proc-macro-hack",
590 590 ]
591 591
592 592 [[package]]
593 593 name = "pkg-config"
594 594 version = "0.3.19"
595 595 source = "registry+https://github.com/rust-lang/crates.io-index"
596 596 checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
597 597
598 598 [[package]]
599 599 name = "ppv-lite86"
600 600 version = "0.2.10"
601 601 source = "registry+https://github.com/rust-lang/crates.io-index"
602 602 checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
603 603
604 604 [[package]]
605 605 name = "pretty_assertions"
606 606 version = "0.6.1"
607 607 source = "registry+https://github.com/rust-lang/crates.io-index"
608 608 checksum = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427"
609 609 dependencies = [
610 610 "ansi_term",
611 611 "ctor",
612 612 "difference",
613 613 "output_vt100",
614 614 ]
615 615
616 616 [[package]]
617 617 name = "proc-macro-hack"
618 618 version = "0.5.19"
619 619 source = "registry+https://github.com/rust-lang/crates.io-index"
620 620 checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
621 621
622 622 [[package]]
623 623 name = "proc-macro2"
624 624 version = "1.0.24"
625 625 source = "registry+https://github.com/rust-lang/crates.io-index"
626 626 checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
627 627 dependencies = [
628 628 "unicode-xid",
629 629 ]
630 630
631 631 [[package]]
632 632 name = "python27-sys"
633 633 version = "0.5.2"
634 634 source = "registry+https://github.com/rust-lang/crates.io-index"
635 635 checksum = "f485897ed7048f5032317c4e427800ef9f2053355516524d73952b8b07032054"
636 636 dependencies = [
637 637 "libc",
638 638 "regex",
639 639 ]
640 640
641 641 [[package]]
642 642 name = "python3-sys"
643 643 version = "0.5.2"
644 644 source = "registry+https://github.com/rust-lang/crates.io-index"
645 645 checksum = "5b29b99c6868eb02beb3bf6ed025c8bcdf02efc149b8e80347d3e5d059a806db"
646 646 dependencies = [
647 647 "libc",
648 648 "regex",
649 649 ]
650 650
651 651 [[package]]
652 652 name = "quick-error"
653 653 version = "1.2.3"
654 654 source = "registry+https://github.com/rust-lang/crates.io-index"
655 655 checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
656 656
657 657 [[package]]
658 658 name = "quote"
659 659 version = "1.0.7"
660 660 source = "registry+https://github.com/rust-lang/crates.io-index"
661 661 checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
662 662 dependencies = [
663 663 "proc-macro2",
664 664 ]
665 665
666 666 [[package]]
667 667 name = "rand"
668 668 version = "0.3.23"
669 669 source = "registry+https://github.com/rust-lang/crates.io-index"
670 670 checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
671 671 dependencies = [
672 672 "libc",
673 673 "rand 0.4.6",
674 674 ]
675 675
676 676 [[package]]
677 677 name = "rand"
678 678 version = "0.4.6"
679 679 source = "registry+https://github.com/rust-lang/crates.io-index"
680 680 checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
681 681 dependencies = [
682 682 "fuchsia-cprng",
683 683 "libc",
684 684 "rand_core 0.3.1",
685 685 "rdrand",
686 686 "winapi",
687 687 ]
688 688
689 689 [[package]]
690 690 name = "rand"
691 691 version = "0.7.3"
692 692 source = "registry+https://github.com/rust-lang/crates.io-index"
693 693 checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
694 694 dependencies = [
695 695 "getrandom",
696 696 "libc",
697 697 "rand_chacha",
698 698 "rand_core 0.5.1",
699 699 "rand_hc",
700 700 ]
701 701
702 702 [[package]]
703 703 name = "rand_chacha"
704 704 version = "0.2.2"
705 705 source = "registry+https://github.com/rust-lang/crates.io-index"
706 706 checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
707 707 dependencies = [
708 708 "ppv-lite86",
709 709 "rand_core 0.5.1",
710 710 ]
711 711
712 712 [[package]]
713 713 name = "rand_core"
714 714 version = "0.3.1"
715 715 source = "registry+https://github.com/rust-lang/crates.io-index"
716 716 checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
717 717 dependencies = [
718 718 "rand_core 0.4.2",
719 719 ]
720 720
721 721 [[package]]
722 722 name = "rand_core"
723 723 version = "0.4.2"
724 724 source = "registry+https://github.com/rust-lang/crates.io-index"
725 725 checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
726 726
727 727 [[package]]
728 728 name = "rand_core"
729 729 version = "0.5.1"
730 730 source = "registry+https://github.com/rust-lang/crates.io-index"
731 731 checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
732 732 dependencies = [
733 733 "getrandom",
734 734 ]
735 735
736 736 [[package]]
737 737 name = "rand_distr"
738 738 version = "0.2.2"
739 739 source = "registry+https://github.com/rust-lang/crates.io-index"
740 740 checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2"
741 741 dependencies = [
742 742 "rand 0.7.3",
743 743 ]
744 744
745 745 [[package]]
746 746 name = "rand_hc"
747 747 version = "0.2.0"
748 748 source = "registry+https://github.com/rust-lang/crates.io-index"
749 749 checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
750 750 dependencies = [
751 751 "rand_core 0.5.1",
752 752 ]
753 753
754 754 [[package]]
755 755 name = "rand_pcg"
756 756 version = "0.2.1"
757 757 source = "registry+https://github.com/rust-lang/crates.io-index"
758 758 checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
759 759 dependencies = [
760 760 "rand_core 0.5.1",
761 761 ]
762 762
763 763 [[package]]
764 764 name = "rand_xoshiro"
765 765 version = "0.4.0"
766 766 source = "registry+https://github.com/rust-lang/crates.io-index"
767 767 checksum = "a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004"
768 768 dependencies = [
769 769 "rand_core 0.5.1",
770 770 ]
771 771
772 772 [[package]]
773 773 name = "rayon"
774 774 version = "1.5.0"
775 775 source = "registry+https://github.com/rust-lang/crates.io-index"
776 776 checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
777 777 dependencies = [
778 778 "autocfg",
779 779 "crossbeam-deque",
780 780 "either",
781 781 "rayon-core",
782 782 ]
783 783
784 784 [[package]]
785 785 name = "rayon-core"
786 786 version = "1.9.0"
787 787 source = "registry+https://github.com/rust-lang/crates.io-index"
788 788 checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
789 789 dependencies = [
790 790 "crossbeam-channel 0.5.0",
791 791 "crossbeam-deque",
792 792 "crossbeam-utils 0.8.1",
793 793 "lazy_static",
794 794 "num_cpus",
795 795 ]
796 796
797 797 [[package]]
798 798 name = "rdrand"
799 799 version = "0.4.0"
800 800 source = "registry+https://github.com/rust-lang/crates.io-index"
801 801 checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
802 802 dependencies = [
803 803 "rand_core 0.3.1",
804 804 ]
805 805
806 806 [[package]]
807 807 name = "redox_syscall"
808 808 version = "0.1.57"
809 809 source = "registry+https://github.com/rust-lang/crates.io-index"
810 810 checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
811 811
812 812 [[package]]
813 813 name = "regex"
814 814 version = "1.4.2"
815 815 source = "registry+https://github.com/rust-lang/crates.io-index"
816 816 checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
817 817 dependencies = [
818 818 "aho-corasick",
819 819 "memchr",
820 820 "regex-syntax",
821 821 "thread_local",
822 822 ]
823 823
824 824 [[package]]
825 825 name = "regex-syntax"
826 826 version = "0.6.21"
827 827 source = "registry+https://github.com/rust-lang/crates.io-index"
828 828 checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
829 829
830 830 [[package]]
831 831 name = "remove_dir_all"
832 832 version = "0.5.3"
833 833 source = "registry+https://github.com/rust-lang/crates.io-index"
834 834 checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
835 835 dependencies = [
836 836 "winapi",
837 837 ]
838 838
839 839 [[package]]
840 840 name = "rhg"
841 841 version = "0.1.0"
842 842 dependencies = [
843 843 "chrono",
844 844 "clap",
845 845 "derive_more",
846 846 "env_logger",
847 847 "format-bytes",
848 848 "hg-core",
849 849 "lazy_static",
850 850 "log",
851 851 "micro-timer",
852 852 "regex",
853 853 "users",
854 854 ]
855 855
856 856 [[package]]
857 857 name = "rust-crypto"
858 858 version = "0.2.36"
859 859 source = "registry+https://github.com/rust-lang/crates.io-index"
860 860 checksum = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a"
861 861 dependencies = [
862 862 "gcc",
863 863 "libc",
864 864 "rand 0.3.23",
865 865 "rustc-serialize",
866 866 "time",
867 867 ]
868 868
869 869 [[package]]
870 870 name = "rustc-serialize"
871 871 version = "0.3.24"
872 872 source = "registry+https://github.com/rust-lang/crates.io-index"
873 873 checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
874 874
875 875 [[package]]
876 876 name = "same-file"
877 877 version = "1.0.6"
878 878 source = "registry+https://github.com/rust-lang/crates.io-index"
879 879 checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
880 880 dependencies = [
881 881 "winapi-util",
882 882 ]
883 883
884 884 [[package]]
885 885 name = "scopeguard"
886 886 version = "1.1.0"
887 887 source = "registry+https://github.com/rust-lang/crates.io-index"
888 888 checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
889 889
890 890 [[package]]
891 891 name = "sized-chunks"
892 892 version = "0.6.2"
893 893 source = "registry+https://github.com/rust-lang/crates.io-index"
894 894 checksum = "1ec31ceca5644fa6d444cc77548b88b67f46db6f7c71683b0f9336e671830d2f"
895 895 dependencies = [
896 896 "bitmaps",
897 897 "typenum",
898 898 ]
899 899
900 900 [[package]]
901 901 name = "static_assertions"
902 902 version = "1.1.0"
903 903 source = "registry+https://github.com/rust-lang/crates.io-index"
904 904 checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
905 905
906 906 [[package]]
907 907 name = "strsim"
908 908 version = "0.8.0"
909 909 source = "registry+https://github.com/rust-lang/crates.io-index"
910 910 checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
911 911
912 912 [[package]]
913 913 name = "syn"
914 914 version = "1.0.54"
915 915 source = "registry+https://github.com/rust-lang/crates.io-index"
916 916 checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
917 917 dependencies = [
918 918 "proc-macro2",
919 919 "quote",
920 920 "unicode-xid",
921 921 ]
922 922
923 923 [[package]]
924 924 name = "tempfile"
925 925 version = "3.1.0"
926 926 source = "registry+https://github.com/rust-lang/crates.io-index"
927 927 checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
928 928 dependencies = [
929 929 "cfg-if 0.1.10",
930 930 "libc",
931 931 "rand 0.7.3",
932 932 "redox_syscall",
933 933 "remove_dir_all",
934 934 "winapi",
935 935 ]
936 936
937 937 [[package]]
938 938 name = "termcolor"
939 939 version = "1.1.2"
940 940 source = "registry+https://github.com/rust-lang/crates.io-index"
941 941 checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
942 942 dependencies = [
943 943 "winapi-util",
944 944 ]
945 945
946 946 [[package]]
947 947 name = "textwrap"
948 948 version = "0.11.0"
949 949 source = "registry+https://github.com/rust-lang/crates.io-index"
950 950 checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
951 951 dependencies = [
952 952 "unicode-width",
953 953 ]
954 954
955 955 [[package]]
956 956 name = "thread_local"
957 957 version = "1.0.1"
958 958 source = "registry+https://github.com/rust-lang/crates.io-index"
959 959 checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
960 960 dependencies = [
961 961 "lazy_static",
962 962 ]
963 963
964 964 [[package]]
965 965 name = "time"
966 966 version = "0.1.44"
967 967 source = "registry+https://github.com/rust-lang/crates.io-index"
968 968 checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
969 969 dependencies = [
970 970 "libc",
971 971 "wasi 0.10.0+wasi-snapshot-preview1",
972 972 "winapi",
973 973 ]
974 974
975 975 [[package]]
976 976 name = "twox-hash"
977 977 version = "1.6.0"
978 978 source = "registry+https://github.com/rust-lang/crates.io-index"
979 979 checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
980 980 dependencies = [
981 981 "cfg-if 0.1.10",
982 982 "rand 0.7.3",
983 983 "static_assertions",
984 984 ]
985 985
986 986 [[package]]
987 987 name = "typenum"
988 988 version = "1.12.0"
989 989 source = "registry+https://github.com/rust-lang/crates.io-index"
990 990 checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
991 991
992 992 [[package]]
993 993 name = "unicode-width"
994 994 version = "0.1.8"
995 995 source = "registry+https://github.com/rust-lang/crates.io-index"
996 996 checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
997 997
998 998 [[package]]
999 999 name = "unicode-xid"
1000 1000 version = "0.2.1"
1001 1001 source = "registry+https://github.com/rust-lang/crates.io-index"
1002 1002 checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
1003 1003
1004 1004 [[package]]
1005 1005 name = "users"
1006 1006 version = "0.11.0"
1007 1007 source = "registry+https://github.com/rust-lang/crates.io-index"
1008 1008 checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
1009 1009 dependencies = [
1010 1010 "libc",
1011 1011 "log",
1012 1012 ]
1013 1013
1014 1014 [[package]]
1015 1015 name = "vcpkg"
1016 1016 version = "0.2.11"
1017 1017 source = "registry+https://github.com/rust-lang/crates.io-index"
1018 1018 checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
1019 1019
1020 1020 [[package]]
1021 1021 name = "vec_map"
1022 1022 version = "0.8.2"
1023 1023 source = "registry+https://github.com/rust-lang/crates.io-index"
1024 1024 checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
1025 1025
1026 1026 [[package]]
1027 1027 name = "version_check"
1028 1028 version = "0.9.2"
1029 1029 source = "registry+https://github.com/rust-lang/crates.io-index"
1030 1030 checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
1031 1031
1032 1032 [[package]]
1033 1033 name = "wasi"
1034 1034 version = "0.9.0+wasi-snapshot-preview1"
1035 1035 source = "registry+https://github.com/rust-lang/crates.io-index"
1036 1036 checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
1037 1037
1038 1038 [[package]]
1039 1039 name = "wasi"
1040 1040 version = "0.10.0+wasi-snapshot-preview1"
1041 1041 source = "registry+https://github.com/rust-lang/crates.io-index"
1042 1042 checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
1043 1043
1044 1044 [[package]]
1045 1045 name = "winapi"
1046 1046 version = "0.3.9"
1047 1047 source = "registry+https://github.com/rust-lang/crates.io-index"
1048 1048 checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
1049 1049 dependencies = [
1050 1050 "winapi-i686-pc-windows-gnu",
1051 1051 "winapi-x86_64-pc-windows-gnu",
1052 1052 ]
1053 1053
1054 1054 [[package]]
1055 1055 name = "winapi-i686-pc-windows-gnu"
1056 1056 version = "0.4.0"
1057 1057 source = "registry+https://github.com/rust-lang/crates.io-index"
1058 1058 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1059 1059
1060 1060 [[package]]
1061 1061 name = "winapi-util"
1062 1062 version = "0.1.5"
1063 1063 source = "registry+https://github.com/rust-lang/crates.io-index"
1064 1064 checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
1065 1065 dependencies = [
1066 1066 "winapi",
1067 1067 ]
1068 1068
1069 1069 [[package]]
1070 1070 name = "winapi-x86_64-pc-windows-gnu"
1071 1071 version = "0.4.0"
1072 1072 source = "registry+https://github.com/rust-lang/crates.io-index"
1073 1073 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1074 1074
1075 1075 [[package]]
1076 1076 name = "zstd"
1077 1077 version = "0.5.3+zstd.1.4.5"
1078 1078 source = "registry+https://github.com/rust-lang/crates.io-index"
1079 1079 checksum = "01b32eaf771efa709e8308605bbf9319bf485dc1503179ec0469b611937c0cd8"
1080 1080 dependencies = [
1081 1081 "zstd-safe",
1082 1082 ]
1083 1083
1084 1084 [[package]]
1085 1085 name = "zstd-safe"
1086 1086 version = "2.0.5+zstd.1.4.5"
1087 1087 source = "registry+https://github.com/rust-lang/crates.io-index"
1088 1088 checksum = "1cfb642e0d27f64729a639c52db457e0ae906e7bc6f5fe8f5c453230400f1055"
1089 1089 dependencies = [
1090 1090 "libc",
1091 1091 "zstd-sys",
1092 1092 ]
1093 1093
1094 1094 [[package]]
1095 1095 name = "zstd-sys"
1096 1096 version = "1.4.17+zstd.1.4.5"
1097 1097 source = "registry+https://github.com/rust-lang/crates.io-index"
1098 1098 checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b"
1099 1099 dependencies = [
1100 1100 "cc",
1101 1101 "glob",
1102 1102 "itertools",
1103 1103 "libc",
1104 1104 ]
@@ -1,43 +1,43
1 1 [package]
2 2 name = "hg-core"
3 3 version = "0.1.0"
4 4 authors = ["Georges Racinet <gracinet@anybox.fr>"]
5 5 description = "Mercurial pure Rust core library, with no assumption on Python bindings (FFI)"
6 6 edition = "2018"
7 7
8 8 [lib]
9 9 name = "hg"
10 10
11 11 [dependencies]
12 bytes-cast = "0.1"
12 bytes-cast = "0.2"
13 13 byteorder = "1.3.4"
14 14 derive_more = "0.99"
15 15 home = "0.5"
16 16 im-rc = "15.0.*"
17 17 lazy_static = "1.4.0"
18 18 rand = "0.7.3"
19 19 rand_pcg = "0.2.1"
20 20 rand_distr = "0.2.2"
21 21 rayon = "1.3.0"
22 22 regex = "1.3.9"
23 23 twox-hash = "1.5.0"
24 24 same-file = "1.0.6"
25 25 crossbeam-channel = "0.4"
26 26 micro-timer = "0.3.0"
27 27 log = "0.4.8"
28 28 memmap = "0.7.0"
29 29 zstd = "0.5.3"
30 30 rust-crypto = "0.2.36"
31 31 format-bytes = "0.2.2"
32 32
33 33 # We don't use the `miniz-oxide` backend to not change rhg benchmarks and until
34 34 # we have a clearer view of which backend is the fastest.
35 35 [dependencies.flate2]
36 36 version = "1.0.16"
37 37 features = ["zlib"]
38 38 default-features = false
39 39
40 40 [dev-dependencies]
41 41 clap = "*"
42 42 pretty_assertions = "0.6.1"
43 43 tempfile = "3.1.0"
@@ -1,446 +1,473
1 1 // Copyright 2019 Raphaël Gomès <rgomes@octobus.net>
2 2 //
3 3 // This software may be used and distributed according to the terms of the
4 4 // GNU General Public License version 2 or any later version.
5 5
6 6 use crate::errors::HgError;
7 use crate::utils::hg_path::HgPath;
7 use crate::utils::hg_path::{HgPath, HgPathBuf};
8 8 use crate::{
9 9 dirstate::{CopyMap, EntryState, RawEntry, StateMap},
10 10 DirstateEntry, DirstateParents,
11 11 };
12 12 use byteorder::{BigEndian, WriteBytesExt};
13 13 use bytes_cast::BytesCast;
14 14 use micro_timer::timed;
15 15 use std::convert::{TryFrom, TryInto};
16 16
17 17 /// Parents are stored in the dirstate as byte hashes.
18 18 pub const PARENT_SIZE: usize = 20;
19 19 /// Dirstate entries have a static part of 8 + 32 + 32 + 32 + 32 bits.
20 20 const MIN_ENTRY_SIZE: usize = 17;
21 21
22 22 type ParseResult<'a> = (
23 23 &'a DirstateParents,
24 24 Vec<(&'a HgPath, DirstateEntry)>,
25 25 Vec<(&'a HgPath, &'a HgPath)>,
26 26 );
27 27
28 28 pub fn parse_dirstate_parents(
29 29 contents: &[u8],
30 30 ) -> Result<&DirstateParents, HgError> {
31 31 let (parents, _rest) = DirstateParents::from_bytes(contents)
32 32 .map_err(|_| HgError::corrupted("Too little data for dirstate."))?;
33 33 Ok(parents)
34 34 }
35 35
36 36 #[timed]
37 37 pub fn parse_dirstate(contents: &[u8]) -> Result<ParseResult, HgError> {
38 38 let mut copies = Vec::new();
39 39 let mut entries = Vec::new();
40 40 let parents =
41 41 parse_dirstate_entries(contents, |path, entry, copy_source| {
42 42 if let Some(source) = copy_source {
43 43 copies.push((path, source));
44 44 }
45 45 entries.push((path, *entry));
46 46 })?;
47 47 Ok((parents, entries, copies))
48 48 }
49 49
50 50 pub fn parse_dirstate_entries<'a>(
51 51 mut contents: &'a [u8],
52 52 mut each_entry: impl FnMut(&'a HgPath, &DirstateEntry, Option<&'a HgPath>),
53 53 ) -> Result<&'a DirstateParents, HgError> {
54 54 let (parents, rest) = DirstateParents::from_bytes(contents)
55 55 .map_err(|_| HgError::corrupted("Too little data for dirstate."))?;
56 56 contents = rest;
57 57 while !contents.is_empty() {
58 58 let (raw_entry, rest) = RawEntry::from_bytes(contents)
59 59 .map_err(|_| HgError::corrupted("Overflow in dirstate."))?;
60 60
61 61 let entry = DirstateEntry {
62 62 state: EntryState::try_from(raw_entry.state)?,
63 63 mode: raw_entry.mode.get(),
64 64 mtime: raw_entry.mtime.get(),
65 65 size: raw_entry.size.get(),
66 66 };
67 67 let (paths, rest) =
68 68 u8::slice_from_bytes(rest, raw_entry.length.get() as usize)
69 69 .map_err(|_| HgError::corrupted("Overflow in dirstate."))?;
70 70
71 71 // `paths` is either a single path, or two paths separated by a NULL
72 72 // byte
73 73 let mut iter = paths.splitn(2, |&byte| byte == b'\0');
74 74 let path = HgPath::new(
75 75 iter.next().expect("splitn always yields at least one item"),
76 76 );
77 77 let copy_source = iter.next().map(HgPath::new);
78 78 each_entry(path, &entry, copy_source);
79 79
80 80 contents = rest;
81 81 }
82 82 Ok(parents)
83 83 }
84 84
85 fn packed_filename_and_copy_source_size(
86 filename: &HgPathBuf,
87 copy_source: Option<&HgPathBuf>,
88 ) -> usize {
89 filename.len()
90 + if let Some(source) = copy_source {
91 b"\0".len() + source.len()
92 } else {
93 0
94 }
95 }
96
97 pub fn packed_entry_size(
98 filename: &HgPathBuf,
99 copy_source: Option<&HgPathBuf>,
100 ) -> usize {
101 MIN_ENTRY_SIZE
102 + packed_filename_and_copy_source_size(filename, copy_source)
103 }
104
105 pub fn pack_entry(
106 filename: &HgPathBuf,
107 entry: &DirstateEntry,
108 copy_source: Option<&HgPathBuf>,
109 packed: &mut Vec<u8>,
110 ) {
111 let length = packed_filename_and_copy_source_size(filename, copy_source);
112
113 // Unwrapping because `impl std::io::Write for Vec<u8>` never errors
114 packed.write_u8(entry.state.into()).unwrap();
115 packed.write_i32::<BigEndian>(entry.mode).unwrap();
116 packed.write_i32::<BigEndian>(entry.size).unwrap();
117 packed.write_i32::<BigEndian>(entry.mtime).unwrap();
118 packed.write_i32::<BigEndian>(length as i32).unwrap();
119 packed.extend(filename.as_bytes());
120 if let Some(source) = copy_source {
121 packed.push(b'\0');
122 packed.extend(source.as_bytes());
123 }
124 }
125
85 126 /// Seconds since the Unix epoch
86 127 pub struct Timestamp(pub u64);
87 128
129 pub fn clear_ambiguous_mtime(
130 entry: &mut DirstateEntry,
131 mtime_now: i32,
132 ) -> bool {
133 let ambiguous =
134 entry.state == EntryState::Normal && entry.mtime == mtime_now;
135 if ambiguous {
136 // The file was last modified "simultaneously" with the current
137 // write to dirstate (i.e. within the same second for file-
138 // systems with a granularity of 1 sec). This commonly happens
139 // for at least a couple of files on 'update'.
140 // The user could change the file without changing its size
141 // within the same second. Invalidate the file's mtime in
142 // dirstate, forcing future 'status' calls to compare the
143 // contents of the file if the size is the same. This prevents
144 // mistakenly treating such files as clean.
145 entry.mtime = -1;
146 }
147 ambiguous
148 }
149
88 150 pub fn pack_dirstate(
89 151 state_map: &mut StateMap,
90 152 copy_map: &CopyMap,
91 153 parents: DirstateParents,
92 154 now: Timestamp,
93 155 ) -> Result<Vec<u8>, HgError> {
94 156 // TODO move away from i32 before 2038.
95 157 let now: i32 = now.0.try_into().expect("time overflow");
96 158
97 159 let expected_size: usize = state_map
98 160 .iter()
99 161 .map(|(filename, _)| {
100 let mut length = MIN_ENTRY_SIZE + filename.len();
101 if let Some(copy) = copy_map.get(filename) {
102 length += copy.len() + 1;
103 }
104 length
162 packed_entry_size(filename, copy_map.get(filename))
105 163 })
106 164 .sum();
107 165 let expected_size = expected_size + PARENT_SIZE * 2;
108 166
109 167 let mut packed = Vec::with_capacity(expected_size);
110 168
111 169 packed.extend(parents.p1.as_bytes());
112 170 packed.extend(parents.p2.as_bytes());
113 171
114 172 for (filename, entry) in state_map.iter_mut() {
115 let new_filename = filename.to_owned();
116 let mut new_mtime: i32 = entry.mtime;
117 if entry.state == EntryState::Normal && entry.mtime == now {
118 // The file was last modified "simultaneously" with the current
119 // write to dirstate (i.e. within the same second for file-
120 // systems with a granularity of 1 sec). This commonly happens
121 // for at least a couple of files on 'update'.
122 // The user could change the file without changing its size
123 // within the same second. Invalidate the file's mtime in
124 // dirstate, forcing future 'status' calls to compare the
125 // contents of the file if the size is the same. This prevents
126 // mistakenly treating such files as clean.
127 new_mtime = -1;
128 *entry = DirstateEntry {
129 mtime: new_mtime,
130 ..*entry
131 };
132 }
133 let mut new_filename = new_filename.into_vec();
134 if let Some(copy) = copy_map.get(filename) {
135 new_filename.push(b'\0');
136 new_filename.extend(copy.bytes());
137 }
138
139 // Unwrapping because `impl std::io::Write for Vec<u8>` never errors
140 packed.write_u8(entry.state.into()).unwrap();
141 packed.write_i32::<BigEndian>(entry.mode).unwrap();
142 packed.write_i32::<BigEndian>(entry.size).unwrap();
143 packed.write_i32::<BigEndian>(new_mtime).unwrap();
144 packed
145 .write_i32::<BigEndian>(new_filename.len() as i32)
146 .unwrap();
147 packed.extend(new_filename)
173 clear_ambiguous_mtime(entry, now);
174 pack_entry(filename, entry, copy_map.get(filename), &mut packed)
148 175 }
149 176
150 177 if packed.len() != expected_size {
151 178 return Err(HgError::CorruptedRepository(format!(
152 179 "bad dirstate size: {} != {}",
153 180 expected_size,
154 181 packed.len()
155 182 )));
156 183 }
157 184
158 185 Ok(packed)
159 186 }
160 187
161 188 #[cfg(test)]
162 189 mod tests {
163 190 use super::*;
164 191 use crate::{utils::hg_path::HgPathBuf, FastHashMap};
165 192 use pretty_assertions::assert_eq;
166 193
167 194 #[test]
168 195 fn test_pack_dirstate_empty() {
169 196 let mut state_map = StateMap::default();
170 197 let copymap = FastHashMap::default();
171 198 let parents = DirstateParents {
172 199 p1: b"12345678910111213141".into(),
173 200 p2: b"00000000000000000000".into(),
174 201 };
175 202 let now = Timestamp(15000000);
176 203 let expected = b"1234567891011121314100000000000000000000".to_vec();
177 204
178 205 assert_eq!(
179 206 expected,
180 207 pack_dirstate(&mut state_map, &copymap, parents, now).unwrap()
181 208 );
182 209
183 210 assert!(state_map.is_empty())
184 211 }
185 212 #[test]
186 213 fn test_pack_dirstate_one_entry() {
187 214 let expected_state_map: StateMap = [(
188 215 HgPathBuf::from_bytes(b"f1"),
189 216 DirstateEntry {
190 217 state: EntryState::Normal,
191 218 mode: 0o644,
192 219 size: 0,
193 220 mtime: 791231220,
194 221 },
195 222 )]
196 223 .iter()
197 224 .cloned()
198 225 .collect();
199 226 let mut state_map = expected_state_map.clone();
200 227
201 228 let copymap = FastHashMap::default();
202 229 let parents = DirstateParents {
203 230 p1: b"12345678910111213141".into(),
204 231 p2: b"00000000000000000000".into(),
205 232 };
206 233 let now = Timestamp(15000000);
207 234 let expected = [
208 235 49, 50, 51, 52, 53, 54, 55, 56, 57, 49, 48, 49, 49, 49, 50, 49,
209 236 51, 49, 52, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
210 237 48, 48, 48, 48, 48, 48, 48, 48, 110, 0, 0, 1, 164, 0, 0, 0, 0, 47,
211 238 41, 58, 244, 0, 0, 0, 2, 102, 49,
212 239 ]
213 240 .to_vec();
214 241
215 242 assert_eq!(
216 243 expected,
217 244 pack_dirstate(&mut state_map, &copymap, parents, now).unwrap()
218 245 );
219 246
220 247 assert_eq!(expected_state_map, state_map);
221 248 }
222 249 #[test]
223 250 fn test_pack_dirstate_one_entry_with_copy() {
224 251 let expected_state_map: StateMap = [(
225 252 HgPathBuf::from_bytes(b"f1"),
226 253 DirstateEntry {
227 254 state: EntryState::Normal,
228 255 mode: 0o644,
229 256 size: 0,
230 257 mtime: 791231220,
231 258 },
232 259 )]
233 260 .iter()
234 261 .cloned()
235 262 .collect();
236 263 let mut state_map = expected_state_map.clone();
237 264 let mut copymap = FastHashMap::default();
238 265 copymap.insert(
239 266 HgPathBuf::from_bytes(b"f1"),
240 267 HgPathBuf::from_bytes(b"copyname"),
241 268 );
242 269 let parents = DirstateParents {
243 270 p1: b"12345678910111213141".into(),
244 271 p2: b"00000000000000000000".into(),
245 272 };
246 273 let now = Timestamp(15000000);
247 274 let expected = [
248 275 49, 50, 51, 52, 53, 54, 55, 56, 57, 49, 48, 49, 49, 49, 50, 49,
249 276 51, 49, 52, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
250 277 48, 48, 48, 48, 48, 48, 48, 48, 110, 0, 0, 1, 164, 0, 0, 0, 0, 47,
251 278 41, 58, 244, 0, 0, 0, 11, 102, 49, 0, 99, 111, 112, 121, 110, 97,
252 279 109, 101,
253 280 ]
254 281 .to_vec();
255 282
256 283 assert_eq!(
257 284 expected,
258 285 pack_dirstate(&mut state_map, &copymap, parents, now).unwrap()
259 286 );
260 287 assert_eq!(expected_state_map, state_map);
261 288 }
262 289
263 290 #[test]
264 291 fn test_parse_pack_one_entry_with_copy() {
265 292 let mut state_map: StateMap = [(
266 293 HgPathBuf::from_bytes(b"f1"),
267 294 DirstateEntry {
268 295 state: EntryState::Normal,
269 296 mode: 0o644,
270 297 size: 0,
271 298 mtime: 791231220,
272 299 },
273 300 )]
274 301 .iter()
275 302 .cloned()
276 303 .collect();
277 304 let mut copymap = FastHashMap::default();
278 305 copymap.insert(
279 306 HgPathBuf::from_bytes(b"f1"),
280 307 HgPathBuf::from_bytes(b"copyname"),
281 308 );
282 309 let parents = DirstateParents {
283 310 p1: b"12345678910111213141".into(),
284 311 p2: b"00000000000000000000".into(),
285 312 };
286 313 let now = Timestamp(15000000);
287 314 let result =
288 315 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
289 316 .unwrap();
290 317
291 318 let (new_parents, entries, copies) =
292 319 parse_dirstate(result.as_slice()).unwrap();
293 320 let new_state_map: StateMap = entries
294 321 .into_iter()
295 322 .map(|(path, entry)| (path.to_owned(), entry))
296 323 .collect();
297 324 let new_copy_map: CopyMap = copies
298 325 .into_iter()
299 326 .map(|(path, copy)| (path.to_owned(), copy.to_owned()))
300 327 .collect();
301 328
302 329 assert_eq!(
303 330 (&parents, state_map, copymap),
304 331 (new_parents, new_state_map, new_copy_map)
305 332 )
306 333 }
307 334
308 335 #[test]
309 336 fn test_parse_pack_multiple_entries_with_copy() {
310 337 let mut state_map: StateMap = [
311 338 (
312 339 HgPathBuf::from_bytes(b"f1"),
313 340 DirstateEntry {
314 341 state: EntryState::Normal,
315 342 mode: 0o644,
316 343 size: 0,
317 344 mtime: 791231220,
318 345 },
319 346 ),
320 347 (
321 348 HgPathBuf::from_bytes(b"f2"),
322 349 DirstateEntry {
323 350 state: EntryState::Merged,
324 351 mode: 0o777,
325 352 size: 1000,
326 353 mtime: 791231220,
327 354 },
328 355 ),
329 356 (
330 357 HgPathBuf::from_bytes(b"f3"),
331 358 DirstateEntry {
332 359 state: EntryState::Removed,
333 360 mode: 0o644,
334 361 size: 234553,
335 362 mtime: 791231220,
336 363 },
337 364 ),
338 365 (
339 366 HgPathBuf::from_bytes(b"f4\xF6"),
340 367 DirstateEntry {
341 368 state: EntryState::Added,
342 369 mode: 0o644,
343 370 size: -1,
344 371 mtime: -1,
345 372 },
346 373 ),
347 374 ]
348 375 .iter()
349 376 .cloned()
350 377 .collect();
351 378 let mut copymap = FastHashMap::default();
352 379 copymap.insert(
353 380 HgPathBuf::from_bytes(b"f1"),
354 381 HgPathBuf::from_bytes(b"copyname"),
355 382 );
356 383 copymap.insert(
357 384 HgPathBuf::from_bytes(b"f4\xF6"),
358 385 HgPathBuf::from_bytes(b"copyname2"),
359 386 );
360 387 let parents = DirstateParents {
361 388 p1: b"12345678910111213141".into(),
362 389 p2: b"00000000000000000000".into(),
363 390 };
364 391 let now = Timestamp(15000000);
365 392 let result =
366 393 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
367 394 .unwrap();
368 395
369 396 let (new_parents, entries, copies) =
370 397 parse_dirstate(result.as_slice()).unwrap();
371 398 let new_state_map: StateMap = entries
372 399 .into_iter()
373 400 .map(|(path, entry)| (path.to_owned(), entry))
374 401 .collect();
375 402 let new_copy_map: CopyMap = copies
376 403 .into_iter()
377 404 .map(|(path, copy)| (path.to_owned(), copy.to_owned()))
378 405 .collect();
379 406
380 407 assert_eq!(
381 408 (&parents, state_map, copymap),
382 409 (new_parents, new_state_map, new_copy_map)
383 410 )
384 411 }
385 412
386 413 #[test]
387 414 /// https://www.mercurial-scm.org/repo/hg/rev/af3f26b6bba4
388 415 fn test_parse_pack_one_entry_with_copy_and_time_conflict() {
389 416 let mut state_map: StateMap = [(
390 417 HgPathBuf::from_bytes(b"f1"),
391 418 DirstateEntry {
392 419 state: EntryState::Normal,
393 420 mode: 0o644,
394 421 size: 0,
395 422 mtime: 15000000,
396 423 },
397 424 )]
398 425 .iter()
399 426 .cloned()
400 427 .collect();
401 428 let mut copymap = FastHashMap::default();
402 429 copymap.insert(
403 430 HgPathBuf::from_bytes(b"f1"),
404 431 HgPathBuf::from_bytes(b"copyname"),
405 432 );
406 433 let parents = DirstateParents {
407 434 p1: b"12345678910111213141".into(),
408 435 p2: b"00000000000000000000".into(),
409 436 };
410 437 let now = Timestamp(15000000);
411 438 let result =
412 439 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
413 440 .unwrap();
414 441
415 442 let (new_parents, entries, copies) =
416 443 parse_dirstate(result.as_slice()).unwrap();
417 444 let new_state_map: StateMap = entries
418 445 .into_iter()
419 446 .map(|(path, entry)| (path.to_owned(), entry))
420 447 .collect();
421 448 let new_copy_map: CopyMap = copies
422 449 .into_iter()
423 450 .map(|(path, copy)| (path.to_owned(), copy.to_owned()))
424 451 .collect();
425 452
426 453 assert_eq!(
427 454 (
428 455 &parents,
429 456 [(
430 457 HgPathBuf::from_bytes(b"f1"),
431 458 DirstateEntry {
432 459 state: EntryState::Normal,
433 460 mode: 0o644,
434 461 size: 0,
435 462 mtime: -1
436 463 }
437 464 )]
438 465 .iter()
439 466 .cloned()
440 467 .collect::<StateMap>(),
441 468 copymap,
442 469 ),
443 470 (new_parents, new_state_map, new_copy_map)
444 471 )
445 472 }
446 473 }
@@ -1,418 +1,448
1 use std::collections::BTreeMap;
1 use bytes_cast::BytesCast;
2 2 use std::path::PathBuf;
3 use std::{collections::BTreeMap, convert::TryInto};
3 4
4 5 use super::path_with_basename::WithBasename;
6 use crate::dirstate::parsers::clear_ambiguous_mtime;
7 use crate::dirstate::parsers::pack_entry;
8 use crate::dirstate::parsers::packed_entry_size;
5 9 use crate::dirstate::parsers::parse_dirstate_entries;
6 10 use crate::dirstate::parsers::parse_dirstate_parents;
7 11 use crate::dirstate::parsers::Timestamp;
8
9 12 use crate::matchers::Matcher;
10 13 use crate::revlog::node::NULL_NODE;
11 14 use crate::utils::hg_path::{HgPath, HgPathBuf};
12 15 use crate::CopyMapIter;
13 16 use crate::DirstateEntry;
14 17 use crate::DirstateError;
15 18 use crate::DirstateMapError;
16 19 use crate::DirstateParents;
17 20 use crate::DirstateStatus;
18 21 use crate::EntryState;
19 22 use crate::FastHashMap;
20 23 use crate::HgPathCow;
21 24 use crate::PatternFileWarning;
22 25 use crate::StateMapIter;
23 26 use crate::StatusError;
24 27 use crate::StatusOptions;
25 28
26 29 pub struct DirstateMap {
27 30 parents: Option<DirstateParents>,
28 31 dirty_parents: bool,
29 32 root: ChildNodes,
30 33 }
31 34
32 35 /// Using a plain `HgPathBuf` of the full path from the repository root as a
33 36 /// map key would also work: all paths in a given map have the same parent
34 37 /// path, so comparing full paths gives the same result as comparing base
35 38 /// names. However `BTreeMap` would waste time always re-comparing the same
36 39 /// string prefix.
37 40 type ChildNodes = BTreeMap<WithBasename<HgPathBuf>, Node>;
38 41
39 42 #[derive(Default)]
40 43 struct Node {
41 44 entry: Option<DirstateEntry>,
42 45 copy_source: Option<HgPathBuf>,
43 46 children: ChildNodes,
44 47 }
45 48
46 49 /// `(full_path, entry, copy_source)`
47 50 type NodeDataMut<'a> = (
48 51 &'a WithBasename<HgPathBuf>,
49 52 &'a mut Option<DirstateEntry>,
50 53 &'a mut Option<HgPathBuf>,
51 54 );
52 55
53 56 impl DirstateMap {
54 57 pub fn new() -> Self {
55 58 Self {
56 59 parents: None,
57 60 dirty_parents: false,
58 61 root: ChildNodes::new(),
59 62 }
60 63 }
61 64
62 65 fn get_node(&self, path: &HgPath) -> Option<&Node> {
63 66 let mut children = &self.root;
64 67 let mut components = path.components();
65 68 let mut component =
66 69 components.next().expect("expected at least one components");
67 70 loop {
68 71 let child = children.get(component)?;
69 72 if let Some(next_component) = components.next() {
70 73 component = next_component;
71 74 children = &child.children;
72 75 } else {
73 76 return Some(child);
74 77 }
75 78 }
76 79 }
77 80
78 81 fn get_or_insert_node(&mut self, path: &HgPath) -> &mut Node {
79 82 let mut child_nodes = &mut self.root;
80 83 let mut inclusive_ancestor_paths =
81 84 WithBasename::inclusive_ancestors_of(path);
82 85 let mut ancestor_path = inclusive_ancestor_paths
83 86 .next()
84 87 .expect("expected at least one inclusive ancestor");
85 88 loop {
86 89 // TODO: can we avoid double lookup in all cases without allocating
87 90 // an owned key in cases where the map already contains that key?
88 91 let child_node =
89 92 if child_nodes.contains_key(ancestor_path.base_name()) {
90 93 child_nodes.get_mut(ancestor_path.base_name()).unwrap()
91 94 } else {
92 95 // This is always a vacant entry, using `.entry()` lets us
93 96 // return a `&mut Node` of the newly-inserted node without
94 97 // yet another lookup. `BTreeMap::insert` doesn’t do this.
95 98 child_nodes.entry(ancestor_path.to_owned()).or_default()
96 99 };
97 100 if let Some(next) = inclusive_ancestor_paths.next() {
98 101 ancestor_path = next;
99 102 child_nodes = &mut child_node.children;
100 103 } else {
101 104 return child_node;
102 105 }
103 106 }
104 107 }
105 108
106 109 fn iter_nodes<'a>(
107 110 &'a self,
108 111 ) -> impl Iterator<Item = (&'a WithBasename<HgPathBuf>, &'a Node)> + 'a
109 112 {
110 113 // Depth first tree traversal.
111 114 //
112 115 // If we could afford internal iteration and recursion,
113 116 // this would look like:
114 117 //
115 118 // ```
116 119 // fn traverse_children(
117 120 // children: &ChildNodes,
118 121 // each: &mut impl FnMut(&Node),
119 122 // ) {
120 123 // for child in children.values() {
121 124 // traverse_children(&child.children, each);
122 125 // each(child);
123 126 // }
124 127 // }
125 128 // ```
126 129 //
127 130 // However we want an external iterator and therefore can’t use the
128 131 // call stack. Use an explicit stack instead:
129 132 let mut stack = Vec::new();
130 133 let mut iter = self.root.iter();
131 134 std::iter::from_fn(move || {
132 135 while let Some((key, child_node)) = iter.next() {
133 136 // Pseudo-recursion
134 137 let new_iter = child_node.children.iter();
135 138 let old_iter = std::mem::replace(&mut iter, new_iter);
136 139 stack.push((key, child_node, old_iter));
137 140 }
138 141 // Found the end of a `children.iter()` iterator.
139 142 if let Some((key, child_node, next_iter)) = stack.pop() {
140 143 // "Return" from pseudo-recursion by restoring state from the
141 144 // explicit stack
142 145 iter = next_iter;
143 146
144 147 Some((key, child_node))
145 148 } else {
146 149 // Reached the bottom of the stack, we’re done
147 150 None
148 151 }
149 152 })
150 153 }
151 154
152 155 /// Mutable iterator for the `(entry, copy source)` of each node.
153 156 ///
154 157 /// It would not be safe to yield mutable references to nodes themeselves
155 158 /// with `-> impl Iterator<Item = &mut Node>` since child nodes are
156 159 /// reachable from their ancestor nodes, potentially creating multiple
157 160 /// `&mut` references to a given node.
158 161 fn iter_node_data_mut<'a>(
159 162 &'a mut self,
160 163 ) -> impl Iterator<Item = NodeDataMut<'a>> + 'a {
161 164 // Explict stack for pseudo-recursion, see `iter_nodes` above.
162 165 let mut stack = Vec::new();
163 166 let mut iter = self.root.iter_mut();
164 167 std::iter::from_fn(move || {
165 168 while let Some((key, child_node)) = iter.next() {
166 169 // Pseudo-recursion
167 170 let data =
168 171 (key, &mut child_node.entry, &mut child_node.copy_source);
169 172 let new_iter = child_node.children.iter_mut();
170 173 let old_iter = std::mem::replace(&mut iter, new_iter);
171 174 stack.push((data, old_iter));
172 175 }
173 176 // Found the end of a `children.values_mut()` iterator.
174 177 if let Some((data, next_iter)) = stack.pop() {
175 178 // "Return" from pseudo-recursion by restoring state from the
176 179 // explicit stack
177 180 iter = next_iter;
178 181
179 182 Some(data)
180 183 } else {
181 184 // Reached the bottom of the stack, we’re done
182 185 None
183 186 }
184 187 })
185 188 }
186 189 }
187 190
188 191 impl super::dispatch::DirstateMapMethods for DirstateMap {
189 192 fn clear(&mut self) {
190 193 self.set_parents(&DirstateParents {
191 194 p1: NULL_NODE,
192 195 p2: NULL_NODE,
193 196 });
194 197 self.root.clear()
195 198 }
196 199
197 200 fn add_file(
198 201 &mut self,
199 202 _filename: &HgPath,
200 203 _old_state: EntryState,
201 204 _entry: DirstateEntry,
202 205 ) -> Result<(), DirstateMapError> {
203 206 todo!()
204 207 }
205 208
206 209 fn remove_file(
207 210 &mut self,
208 211 _filename: &HgPath,
209 212 _old_state: EntryState,
210 213 _size: i32,
211 214 ) -> Result<(), DirstateMapError> {
212 215 todo!()
213 216 }
214 217
215 218 fn drop_file(
216 219 &mut self,
217 220 _filename: &HgPath,
218 221 _old_state: EntryState,
219 222 ) -> Result<bool, DirstateMapError> {
220 223 todo!()
221 224 }
222 225
223 226 fn clear_ambiguous_times(
224 227 &mut self,
225 228 _filenames: Vec<HgPathBuf>,
226 229 _now: i32,
227 230 ) {
228 231 todo!()
229 232 }
230 233
231 234 fn non_normal_entries_contains(&mut self, _key: &HgPath) -> bool {
232 235 todo!()
233 236 }
234 237
235 238 fn non_normal_entries_remove(&mut self, _key: &HgPath) -> bool {
236 239 todo!()
237 240 }
238 241
239 242 fn non_normal_or_other_parent_paths(
240 243 &mut self,
241 244 ) -> Box<dyn Iterator<Item = &HgPathBuf> + '_> {
242 245 todo!()
243 246 }
244 247
245 248 fn set_non_normal_other_parent_entries(&mut self, _force: bool) {
246 249 todo!()
247 250 }
248 251
249 252 fn iter_non_normal_paths(
250 253 &mut self,
251 254 ) -> Box<dyn Iterator<Item = &HgPathBuf> + Send + '_> {
252 255 todo!()
253 256 }
254 257
255 258 fn iter_non_normal_paths_panic(
256 259 &self,
257 260 ) -> Box<dyn Iterator<Item = &HgPathBuf> + Send + '_> {
258 261 todo!()
259 262 }
260 263
261 264 fn iter_other_parent_paths(
262 265 &mut self,
263 266 ) -> Box<dyn Iterator<Item = &HgPathBuf> + Send + '_> {
264 267 todo!()
265 268 }
266 269
267 270 fn has_tracked_dir(
268 271 &mut self,
269 272 _directory: &HgPath,
270 273 ) -> Result<bool, DirstateMapError> {
271 274 todo!()
272 275 }
273 276
274 277 fn has_dir(
275 278 &mut self,
276 279 _directory: &HgPath,
277 280 ) -> Result<bool, DirstateMapError> {
278 281 todo!()
279 282 }
280 283
281 284 fn parents(
282 285 &mut self,
283 286 file_contents: &[u8],
284 287 ) -> Result<&DirstateParents, DirstateError> {
285 288 if self.parents.is_none() {
286 289 let parents = if !file_contents.is_empty() {
287 290 parse_dirstate_parents(file_contents)?.clone()
288 291 } else {
289 292 DirstateParents {
290 293 p1: NULL_NODE,
291 294 p2: NULL_NODE,
292 295 }
293 296 };
294 297 self.parents = Some(parents);
295 298 }
296 299 Ok(self.parents.as_ref().unwrap())
297 300 }
298 301
299 302 fn set_parents(&mut self, parents: &DirstateParents) {
300 303 self.parents = Some(parents.clone());
301 304 self.dirty_parents = true;
302 305 }
303 306
304 307 fn read<'a>(
305 308 &mut self,
306 309 file_contents: &'a [u8],
307 310 ) -> Result<Option<&'a DirstateParents>, DirstateError> {
308 311 if file_contents.is_empty() {
309 312 return Ok(None);
310 313 }
311 314
312 315 let parents = parse_dirstate_entries(
313 316 file_contents,
314 317 |path, entry, copy_source| {
315 318 let node = self.get_or_insert_node(path);
316 319 node.entry = Some(*entry);
317 320 node.copy_source = copy_source.map(HgPath::to_owned);
318 321 },
319 322 )?;
320 323
321 324 if !self.dirty_parents {
322 325 self.set_parents(parents);
323 326 }
324 327
325 328 Ok(Some(parents))
326 329 }
327 330
328 331 fn pack(
329 332 &mut self,
330 _parents: DirstateParents,
331 _now: Timestamp,
333 parents: DirstateParents,
334 now: Timestamp,
332 335 ) -> Result<Vec<u8>, DirstateError> {
333 let _ = self.iter_node_data_mut();
334 todo!()
336 // Optizimation (to be measured?): pre-compute size to avoid `Vec`
337 // reallocations
338 let mut size = parents.as_bytes().len();
339 for (path, node) in self.iter_nodes() {
340 if node.entry.is_some() {
341 size += packed_entry_size(
342 path.full_path(),
343 node.copy_source.as_ref(),
344 )
345 }
346 }
347
348 let mut packed = Vec::with_capacity(size);
349 packed.extend(parents.as_bytes());
350
351 let now: i32 = now.0.try_into().expect("time overflow");
352 for (path, opt_entry, copy_source) in self.iter_node_data_mut() {
353 if let Some(entry) = opt_entry {
354 clear_ambiguous_mtime(entry, now);
355 pack_entry(
356 path.full_path(),
357 entry,
358 copy_source.as_ref(),
359 &mut packed,
360 );
361 }
362 }
363 self.dirty_parents = false;
364 Ok(packed)
335 365 }
336 366
337 367 fn build_file_fold_map(&mut self) -> &FastHashMap<HgPathBuf, HgPathBuf> {
338 368 todo!()
339 369 }
340 370
341 371 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError> {
342 372 todo!()
343 373 }
344 374
345 375 fn set_dirs(&mut self) -> Result<(), DirstateMapError> {
346 376 todo!()
347 377 }
348 378
349 379 fn status<'a>(
350 380 &'a self,
351 381 _matcher: &'a (dyn Matcher + Sync),
352 382 _root_dir: PathBuf,
353 383 _ignore_files: Vec<PathBuf>,
354 384 _options: StatusOptions,
355 385 ) -> Result<
356 386 (
357 387 (Vec<HgPathCow<'a>>, DirstateStatus<'a>),
358 388 Vec<PatternFileWarning>,
359 389 ),
360 390 StatusError,
361 391 > {
362 392 todo!()
363 393 }
364 394
365 395 fn copy_map_len(&self) -> usize {
366 396 todo!()
367 397 }
368 398
369 399 fn copy_map_iter(&self) -> CopyMapIter<'_> {
370 400 Box::new(self.iter_nodes().filter_map(|(path, node)| {
371 401 node.copy_source
372 402 .as_ref()
373 403 .map(|copy_source| (path.full_path(), copy_source))
374 404 }))
375 405 }
376 406
377 407 fn copy_map_contains_key(&self, key: &HgPath) -> bool {
378 408 if let Some(node) = self.get_node(key) {
379 409 node.copy_source.is_some()
380 410 } else {
381 411 false
382 412 }
383 413 }
384 414
385 415 fn copy_map_get(&self, key: &HgPath) -> Option<&HgPathBuf> {
386 416 self.get_node(key)?.copy_source.as_ref()
387 417 }
388 418
389 419 fn copy_map_remove(&mut self, _key: &HgPath) -> Option<HgPathBuf> {
390 420 todo!()
391 421 }
392 422
393 423 fn copy_map_insert(
394 424 &mut self,
395 425 _key: HgPathBuf,
396 426 _value: HgPathBuf,
397 427 ) -> Option<HgPathBuf> {
398 428 todo!()
399 429 }
400 430
401 431 fn len(&self) -> usize {
402 432 todo!()
403 433 }
404 434
405 435 fn contains_key(&self, key: &HgPath) -> bool {
406 436 self.get(key).is_some()
407 437 }
408 438
409 439 fn get(&self, key: &HgPath) -> Option<&DirstateEntry> {
410 440 self.get_node(key)?.entry.as_ref()
411 441 }
412 442
413 443 fn iter(&self) -> StateMapIter<'_> {
414 444 Box::new(self.iter_nodes().filter_map(|(path, node)| {
415 445 node.entry.as_ref().map(|entry| (path.full_path(), entry))
416 446 }))
417 447 }
418 448 }
General Comments 0
You need to be logged in to leave comments. Login now