##// END OF EJS Templates
rust: Align DirstateEntry internals with Python/C DirstateItem...
Simon Sapin -
r48856:008959fc default
parent child Browse files
Show More
@@ -1,1080 +1,1080 b''
1 1 # This file is automatically @generated by Cargo.
2 2 # It is not intended for manual editing.
3
4 3 [[package]]
5 4 name = "adler"
6 5 version = "0.2.3"
7 6 source = "registry+https://github.com/rust-lang/crates.io-index"
8 7 checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
9 8
10 9 [[package]]
11 10 name = "aho-corasick"
12 11 version = "0.7.15"
13 12 source = "registry+https://github.com/rust-lang/crates.io-index"
14 13 checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
15 14 dependencies = [
16 15 "memchr",
17 16 ]
18 17
19 18 [[package]]
20 19 name = "ansi_term"
21 20 version = "0.11.0"
22 21 source = "registry+https://github.com/rust-lang/crates.io-index"
23 22 checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
24 23 dependencies = [
25 24 "winapi",
26 25 ]
27 26
28 27 [[package]]
29 28 name = "atty"
30 29 version = "0.2.14"
31 30 source = "registry+https://github.com/rust-lang/crates.io-index"
32 31 checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
33 32 dependencies = [
34 33 "hermit-abi",
35 34 "libc",
36 35 "winapi",
37 36 ]
38 37
39 38 [[package]]
40 39 name = "autocfg"
41 40 version = "1.0.1"
42 41 source = "registry+https://github.com/rust-lang/crates.io-index"
43 42 checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
44 43
45 44 [[package]]
46 45 name = "bitflags"
47 46 version = "1.2.1"
48 47 source = "registry+https://github.com/rust-lang/crates.io-index"
49 48 checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
50 49
51 50 [[package]]
52 51 name = "bitmaps"
53 52 version = "2.1.0"
54 53 source = "registry+https://github.com/rust-lang/crates.io-index"
55 54 checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
56 55 dependencies = [
57 56 "typenum",
58 57 ]
59 58
60 59 [[package]]
61 60 name = "block-buffer"
62 61 version = "0.9.0"
63 62 source = "registry+https://github.com/rust-lang/crates.io-index"
64 63 checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
65 64 dependencies = [
66 65 "generic-array",
67 66 ]
68 67
69 68 [[package]]
70 69 name = "byteorder"
71 70 version = "1.3.4"
72 71 source = "registry+https://github.com/rust-lang/crates.io-index"
73 72 checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
74 73
75 74 [[package]]
76 75 name = "bytes-cast"
77 76 version = "0.2.0"
78 77 source = "registry+https://github.com/rust-lang/crates.io-index"
79 78 checksum = "0d434f9a4ecbe987e7ccfda7274b6f82ea52c9b63742565a65cb5e8ba0f2c452"
80 79 dependencies = [
81 80 "bytes-cast-derive",
82 81 ]
83 82
84 83 [[package]]
85 84 name = "bytes-cast-derive"
86 85 version = "0.1.0"
87 86 source = "registry+https://github.com/rust-lang/crates.io-index"
88 87 checksum = "cb936af9de38476664d6b58e529aff30d482e4ce1c5e150293d00730b0d81fdb"
89 88 dependencies = [
90 89 "proc-macro2",
91 90 "quote",
92 91 "syn",
93 92 ]
94 93
95 94 [[package]]
96 95 name = "cc"
97 96 version = "1.0.66"
98 97 source = "registry+https://github.com/rust-lang/crates.io-index"
99 98 checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
100 99 dependencies = [
101 100 "jobserver",
102 101 ]
103 102
104 103 [[package]]
105 104 name = "cfg-if"
106 105 version = "0.1.10"
107 106 source = "registry+https://github.com/rust-lang/crates.io-index"
108 107 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
109 108
110 109 [[package]]
111 110 name = "cfg-if"
112 111 version = "1.0.0"
113 112 source = "registry+https://github.com/rust-lang/crates.io-index"
114 113 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
115 114
116 115 [[package]]
117 116 name = "chrono"
118 117 version = "0.4.19"
119 118 source = "registry+https://github.com/rust-lang/crates.io-index"
120 119 checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
121 120 dependencies = [
122 121 "libc",
123 122 "num-integer",
124 123 "num-traits",
125 124 "time",
126 125 "winapi",
127 126 ]
128 127
129 128 [[package]]
130 129 name = "clap"
131 130 version = "2.33.3"
132 131 source = "registry+https://github.com/rust-lang/crates.io-index"
133 132 checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
134 133 dependencies = [
135 134 "ansi_term",
136 135 "atty",
137 136 "bitflags",
138 137 "strsim",
139 138 "textwrap",
140 139 "unicode-width",
141 140 "vec_map",
142 141 ]
143 142
144 143 [[package]]
145 144 name = "const_fn"
146 145 version = "0.4.4"
147 146 source = "registry+https://github.com/rust-lang/crates.io-index"
148 147 checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
149 148
150 149 [[package]]
151 150 name = "cpufeatures"
152 151 version = "0.1.4"
153 152 source = "registry+https://github.com/rust-lang/crates.io-index"
154 153 checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8"
155 154 dependencies = [
156 155 "libc",
157 156 ]
158 157
159 158 [[package]]
160 159 name = "cpython"
161 160 version = "0.6.0"
162 161 source = "registry+https://github.com/rust-lang/crates.io-index"
163 162 checksum = "8094679a4e9bfc8035572162624bc800eda35b5f9eff2537b9cd9aacc3d9782e"
164 163 dependencies = [
165 164 "libc",
166 165 "num-traits",
167 166 "paste",
168 167 "python27-sys",
169 168 "python3-sys",
170 169 ]
171 170
172 171 [[package]]
173 172 name = "crc32fast"
174 173 version = "1.2.1"
175 174 source = "registry+https://github.com/rust-lang/crates.io-index"
176 175 checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
177 176 dependencies = [
178 177 "cfg-if 1.0.0",
179 178 ]
180 179
181 180 [[package]]
182 181 name = "crossbeam-channel"
183 182 version = "0.4.4"
184 183 source = "registry+https://github.com/rust-lang/crates.io-index"
185 184 checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
186 185 dependencies = [
187 186 "crossbeam-utils 0.7.2",
188 187 "maybe-uninit",
189 188 ]
190 189
191 190 [[package]]
192 191 name = "crossbeam-channel"
193 192 version = "0.5.0"
194 193 source = "registry+https://github.com/rust-lang/crates.io-index"
195 194 checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
196 195 dependencies = [
197 196 "cfg-if 1.0.0",
198 197 "crossbeam-utils 0.8.1",
199 198 ]
200 199
201 200 [[package]]
202 201 name = "crossbeam-deque"
203 202 version = "0.8.0"
204 203 source = "registry+https://github.com/rust-lang/crates.io-index"
205 204 checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
206 205 dependencies = [
207 206 "cfg-if 1.0.0",
208 207 "crossbeam-epoch",
209 208 "crossbeam-utils 0.8.1",
210 209 ]
211 210
212 211 [[package]]
213 212 name = "crossbeam-epoch"
214 213 version = "0.9.1"
215 214 source = "registry+https://github.com/rust-lang/crates.io-index"
216 215 checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
217 216 dependencies = [
218 217 "cfg-if 1.0.0",
219 218 "const_fn",
220 219 "crossbeam-utils 0.8.1",
221 220 "lazy_static",
222 221 "memoffset",
223 222 "scopeguard",
224 223 ]
225 224
226 225 [[package]]
227 226 name = "crossbeam-utils"
228 227 version = "0.7.2"
229 228 source = "registry+https://github.com/rust-lang/crates.io-index"
230 229 checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
231 230 dependencies = [
232 231 "autocfg",
233 232 "cfg-if 0.1.10",
234 233 "lazy_static",
235 234 ]
236 235
237 236 [[package]]
238 237 name = "crossbeam-utils"
239 238 version = "0.8.1"
240 239 source = "registry+https://github.com/rust-lang/crates.io-index"
241 240 checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
242 241 dependencies = [
243 242 "autocfg",
244 243 "cfg-if 1.0.0",
245 244 "lazy_static",
246 245 ]
247 246
248 247 [[package]]
249 248 name = "ctor"
250 249 version = "0.1.16"
251 250 source = "registry+https://github.com/rust-lang/crates.io-index"
252 251 checksum = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
253 252 dependencies = [
254 253 "quote",
255 254 "syn",
256 255 ]
257 256
258 257 [[package]]
259 258 name = "derive_more"
260 259 version = "0.99.11"
261 260 source = "registry+https://github.com/rust-lang/crates.io-index"
262 261 checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
263 262 dependencies = [
264 263 "proc-macro2",
265 264 "quote",
266 265 "syn",
267 266 ]
268 267
269 268 [[package]]
270 269 name = "difference"
271 270 version = "2.0.0"
272 271 source = "registry+https://github.com/rust-lang/crates.io-index"
273 272 checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
274 273
275 274 [[package]]
276 275 name = "digest"
277 276 version = "0.9.0"
278 277 source = "registry+https://github.com/rust-lang/crates.io-index"
279 278 checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
280 279 dependencies = [
281 280 "generic-array",
282 281 ]
283 282
284 283 [[package]]
285 284 name = "either"
286 285 version = "1.6.1"
287 286 source = "registry+https://github.com/rust-lang/crates.io-index"
288 287 checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
289 288
290 289 [[package]]
291 290 name = "env_logger"
292 291 version = "0.7.1"
293 292 source = "registry+https://github.com/rust-lang/crates.io-index"
294 293 checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
295 294 dependencies = [
296 295 "atty",
297 296 "humantime",
298 297 "log",
299 298 "regex",
300 299 "termcolor",
301 300 ]
302 301
303 302 [[package]]
304 303 name = "flate2"
305 304 version = "1.0.19"
306 305 source = "registry+https://github.com/rust-lang/crates.io-index"
307 306 checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129"
308 307 dependencies = [
309 308 "cfg-if 1.0.0",
310 309 "crc32fast",
311 310 "libc",
312 311 "libz-sys",
313 312 "miniz_oxide",
314 313 ]
315 314
316 315 [[package]]
317 316 name = "format-bytes"
318 317 version = "0.2.2"
319 318 source = "registry+https://github.com/rust-lang/crates.io-index"
320 319 checksum = "1c4e89040c7fd7b4e6ba2820ac705a45def8a0c098ec78d170ae88f1ef1d5762"
321 320 dependencies = [
322 321 "format-bytes-macros",
323 322 "proc-macro-hack",
324 323 ]
325 324
326 325 [[package]]
327 326 name = "format-bytes-macros"
328 327 version = "0.3.0"
329 328 source = "registry+https://github.com/rust-lang/crates.io-index"
330 329 checksum = "b05089e341a0460449e2210c3bf7b61597860b07f0deae58da38dbed0a4c6b6d"
331 330 dependencies = [
332 331 "proc-macro-hack",
333 332 "proc-macro2",
334 333 "quote",
335 334 "syn",
336 335 ]
337 336
338 337 [[package]]
339 338 name = "generic-array"
340 339 version = "0.14.4"
341 340 source = "registry+https://github.com/rust-lang/crates.io-index"
342 341 checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
343 342 dependencies = [
344 343 "typenum",
345 344 "version_check",
346 345 ]
347 346
348 347 [[package]]
349 348 name = "getrandom"
350 349 version = "0.1.15"
351 350 source = "registry+https://github.com/rust-lang/crates.io-index"
352 351 checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
353 352 dependencies = [
354 353 "cfg-if 0.1.10",
355 354 "libc",
356 355 "wasi 0.9.0+wasi-snapshot-preview1",
357 356 ]
358 357
359 358 [[package]]
360 359 name = "glob"
361 360 version = "0.3.0"
362 361 source = "registry+https://github.com/rust-lang/crates.io-index"
363 362 checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
364 363
365 364 [[package]]
366 365 name = "hermit-abi"
367 366 version = "0.1.17"
368 367 source = "registry+https://github.com/rust-lang/crates.io-index"
369 368 checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
370 369 dependencies = [
371 370 "libc",
372 371 ]
373 372
374 373 [[package]]
375 374 name = "hg-core"
376 375 version = "0.1.0"
377 376 dependencies = [
377 "bitflags",
378 378 "byteorder",
379 379 "bytes-cast",
380 380 "clap",
381 381 "crossbeam-channel 0.4.4",
382 382 "derive_more",
383 383 "flate2",
384 384 "format-bytes",
385 385 "home",
386 386 "im-rc",
387 387 "itertools",
388 388 "lazy_static",
389 389 "log",
390 390 "memmap2",
391 391 "micro-timer",
392 392 "pretty_assertions",
393 393 "rand",
394 394 "rand_distr",
395 395 "rand_pcg",
396 396 "rayon",
397 397 "regex",
398 398 "same-file",
399 399 "sha-1",
400 400 "stable_deref_trait",
401 401 "tempfile",
402 402 "twox-hash",
403 403 "zstd",
404 404 ]
405 405
406 406 [[package]]
407 407 name = "hg-cpython"
408 408 version = "0.1.0"
409 409 dependencies = [
410 410 "cpython",
411 411 "crossbeam-channel 0.4.4",
412 412 "env_logger",
413 413 "hg-core",
414 414 "libc",
415 415 "log",
416 416 "stable_deref_trait",
417 417 ]
418 418
419 419 [[package]]
420 420 name = "home"
421 421 version = "0.5.3"
422 422 source = "registry+https://github.com/rust-lang/crates.io-index"
423 423 checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654"
424 424 dependencies = [
425 425 "winapi",
426 426 ]
427 427
428 428 [[package]]
429 429 name = "humantime"
430 430 version = "1.3.0"
431 431 source = "registry+https://github.com/rust-lang/crates.io-index"
432 432 checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
433 433 dependencies = [
434 434 "quick-error",
435 435 ]
436 436
437 437 [[package]]
438 438 name = "im-rc"
439 439 version = "15.0.0"
440 440 source = "registry+https://github.com/rust-lang/crates.io-index"
441 441 checksum = "3ca8957e71f04a205cb162508f9326aea04676c8dfd0711220190d6b83664f3f"
442 442 dependencies = [
443 443 "bitmaps",
444 444 "rand_core",
445 445 "rand_xoshiro",
446 446 "sized-chunks",
447 447 "typenum",
448 448 "version_check",
449 449 ]
450 450
451 451 [[package]]
452 452 name = "itertools"
453 453 version = "0.9.0"
454 454 source = "registry+https://github.com/rust-lang/crates.io-index"
455 455 checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
456 456 dependencies = [
457 457 "either",
458 458 ]
459 459
460 460 [[package]]
461 461 name = "jobserver"
462 462 version = "0.1.21"
463 463 source = "registry+https://github.com/rust-lang/crates.io-index"
464 464 checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
465 465 dependencies = [
466 466 "libc",
467 467 ]
468 468
469 469 [[package]]
470 470 name = "lazy_static"
471 471 version = "1.4.0"
472 472 source = "registry+https://github.com/rust-lang/crates.io-index"
473 473 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
474 474
475 475 [[package]]
476 476 name = "libc"
477 477 version = "0.2.81"
478 478 source = "registry+https://github.com/rust-lang/crates.io-index"
479 479 checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
480 480
481 481 [[package]]
482 482 name = "libz-sys"
483 483 version = "1.1.2"
484 484 source = "registry+https://github.com/rust-lang/crates.io-index"
485 485 checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
486 486 dependencies = [
487 487 "cc",
488 488 "pkg-config",
489 489 "vcpkg",
490 490 ]
491 491
492 492 [[package]]
493 493 name = "log"
494 494 version = "0.4.11"
495 495 source = "registry+https://github.com/rust-lang/crates.io-index"
496 496 checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
497 497 dependencies = [
498 498 "cfg-if 0.1.10",
499 499 ]
500 500
501 501 [[package]]
502 502 name = "maybe-uninit"
503 503 version = "2.0.0"
504 504 source = "registry+https://github.com/rust-lang/crates.io-index"
505 505 checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
506 506
507 507 [[package]]
508 508 name = "memchr"
509 509 version = "2.3.4"
510 510 source = "registry+https://github.com/rust-lang/crates.io-index"
511 511 checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
512 512
513 513 [[package]]
514 514 name = "memmap2"
515 515 version = "0.4.0"
516 516 source = "registry+https://github.com/rust-lang/crates.io-index"
517 517 checksum = "de5d3112c080d58ce560081baeaab7e1e864ca21795ddbf533d5b1842bb1ecf8"
518 518 dependencies = [
519 519 "libc",
520 520 "stable_deref_trait",
521 521 ]
522 522
523 523 [[package]]
524 524 name = "memoffset"
525 525 version = "0.6.1"
526 526 source = "registry+https://github.com/rust-lang/crates.io-index"
527 527 checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
528 528 dependencies = [
529 529 "autocfg",
530 530 ]
531 531
532 532 [[package]]
533 533 name = "micro-timer"
534 534 version = "0.3.1"
535 535 source = "registry+https://github.com/rust-lang/crates.io-index"
536 536 checksum = "2620153e1d903d26b72b89f0e9c48d8c4756cba941c185461dddc234980c298c"
537 537 dependencies = [
538 538 "micro-timer-macros",
539 539 "scopeguard",
540 540 ]
541 541
542 542 [[package]]
543 543 name = "micro-timer-macros"
544 544 version = "0.3.1"
545 545 source = "registry+https://github.com/rust-lang/crates.io-index"
546 546 checksum = "e28a3473e6abd6e9aab36aaeef32ad22ae0bd34e79f376643594c2b152ec1c5d"
547 547 dependencies = [
548 548 "proc-macro2",
549 549 "quote",
550 550 "scopeguard",
551 551 "syn",
552 552 ]
553 553
554 554 [[package]]
555 555 name = "miniz_oxide"
556 556 version = "0.4.3"
557 557 source = "registry+https://github.com/rust-lang/crates.io-index"
558 558 checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
559 559 dependencies = [
560 560 "adler",
561 561 "autocfg",
562 562 ]
563 563
564 564 [[package]]
565 565 name = "num-integer"
566 566 version = "0.1.44"
567 567 source = "registry+https://github.com/rust-lang/crates.io-index"
568 568 checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
569 569 dependencies = [
570 570 "autocfg",
571 571 "num-traits",
572 572 ]
573 573
574 574 [[package]]
575 575 name = "num-traits"
576 576 version = "0.2.14"
577 577 source = "registry+https://github.com/rust-lang/crates.io-index"
578 578 checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
579 579 dependencies = [
580 580 "autocfg",
581 581 ]
582 582
583 583 [[package]]
584 584 name = "num_cpus"
585 585 version = "1.13.0"
586 586 source = "registry+https://github.com/rust-lang/crates.io-index"
587 587 checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
588 588 dependencies = [
589 589 "hermit-abi",
590 590 "libc",
591 591 ]
592 592
593 593 [[package]]
594 594 name = "opaque-debug"
595 595 version = "0.3.0"
596 596 source = "registry+https://github.com/rust-lang/crates.io-index"
597 597 checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
598 598
599 599 [[package]]
600 600 name = "output_vt100"
601 601 version = "0.1.2"
602 602 source = "registry+https://github.com/rust-lang/crates.io-index"
603 603 checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9"
604 604 dependencies = [
605 605 "winapi",
606 606 ]
607 607
608 608 [[package]]
609 609 name = "paste"
610 610 version = "1.0.5"
611 611 source = "registry+https://github.com/rust-lang/crates.io-index"
612 612 checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58"
613 613
614 614 [[package]]
615 615 name = "pkg-config"
616 616 version = "0.3.19"
617 617 source = "registry+https://github.com/rust-lang/crates.io-index"
618 618 checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
619 619
620 620 [[package]]
621 621 name = "ppv-lite86"
622 622 version = "0.2.10"
623 623 source = "registry+https://github.com/rust-lang/crates.io-index"
624 624 checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
625 625
626 626 [[package]]
627 627 name = "pretty_assertions"
628 628 version = "0.6.1"
629 629 source = "registry+https://github.com/rust-lang/crates.io-index"
630 630 checksum = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427"
631 631 dependencies = [
632 632 "ansi_term",
633 633 "ctor",
634 634 "difference",
635 635 "output_vt100",
636 636 ]
637 637
638 638 [[package]]
639 639 name = "proc-macro-hack"
640 640 version = "0.5.19"
641 641 source = "registry+https://github.com/rust-lang/crates.io-index"
642 642 checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
643 643
644 644 [[package]]
645 645 name = "proc-macro2"
646 646 version = "1.0.24"
647 647 source = "registry+https://github.com/rust-lang/crates.io-index"
648 648 checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
649 649 dependencies = [
650 650 "unicode-xid",
651 651 ]
652 652
653 653 [[package]]
654 654 name = "python27-sys"
655 655 version = "0.6.0"
656 656 source = "registry+https://github.com/rust-lang/crates.io-index"
657 657 checksum = "5826ddbc5366eb0b0492040fdc25bf50bb49092c192bd45e80fb7a24dc6832ab"
658 658 dependencies = [
659 659 "libc",
660 660 "regex",
661 661 ]
662 662
663 663 [[package]]
664 664 name = "python3-sys"
665 665 version = "0.6.0"
666 666 source = "registry+https://github.com/rust-lang/crates.io-index"
667 667 checksum = "b78af21b29594951a47fc3dac9b9eff0a3f077dec2f780ee943ae16a668f3b6a"
668 668 dependencies = [
669 669 "libc",
670 670 "regex",
671 671 ]
672 672
673 673 [[package]]
674 674 name = "quick-error"
675 675 version = "1.2.3"
676 676 source = "registry+https://github.com/rust-lang/crates.io-index"
677 677 checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
678 678
679 679 [[package]]
680 680 name = "quote"
681 681 version = "1.0.7"
682 682 source = "registry+https://github.com/rust-lang/crates.io-index"
683 683 checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
684 684 dependencies = [
685 685 "proc-macro2",
686 686 ]
687 687
688 688 [[package]]
689 689 name = "rand"
690 690 version = "0.7.3"
691 691 source = "registry+https://github.com/rust-lang/crates.io-index"
692 692 checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
693 693 dependencies = [
694 694 "getrandom",
695 695 "libc",
696 696 "rand_chacha",
697 697 "rand_core",
698 698 "rand_hc",
699 699 ]
700 700
701 701 [[package]]
702 702 name = "rand_chacha"
703 703 version = "0.2.2"
704 704 source = "registry+https://github.com/rust-lang/crates.io-index"
705 705 checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
706 706 dependencies = [
707 707 "ppv-lite86",
708 708 "rand_core",
709 709 ]
710 710
711 711 [[package]]
712 712 name = "rand_core"
713 713 version = "0.5.1"
714 714 source = "registry+https://github.com/rust-lang/crates.io-index"
715 715 checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
716 716 dependencies = [
717 717 "getrandom",
718 718 ]
719 719
720 720 [[package]]
721 721 name = "rand_distr"
722 722 version = "0.2.2"
723 723 source = "registry+https://github.com/rust-lang/crates.io-index"
724 724 checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2"
725 725 dependencies = [
726 726 "rand",
727 727 ]
728 728
729 729 [[package]]
730 730 name = "rand_hc"
731 731 version = "0.2.0"
732 732 source = "registry+https://github.com/rust-lang/crates.io-index"
733 733 checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
734 734 dependencies = [
735 735 "rand_core",
736 736 ]
737 737
738 738 [[package]]
739 739 name = "rand_pcg"
740 740 version = "0.2.1"
741 741 source = "registry+https://github.com/rust-lang/crates.io-index"
742 742 checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
743 743 dependencies = [
744 744 "rand_core",
745 745 ]
746 746
747 747 [[package]]
748 748 name = "rand_xoshiro"
749 749 version = "0.4.0"
750 750 source = "registry+https://github.com/rust-lang/crates.io-index"
751 751 checksum = "a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004"
752 752 dependencies = [
753 753 "rand_core",
754 754 ]
755 755
756 756 [[package]]
757 757 name = "rayon"
758 758 version = "1.5.0"
759 759 source = "registry+https://github.com/rust-lang/crates.io-index"
760 760 checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
761 761 dependencies = [
762 762 "autocfg",
763 763 "crossbeam-deque",
764 764 "either",
765 765 "rayon-core",
766 766 ]
767 767
768 768 [[package]]
769 769 name = "rayon-core"
770 770 version = "1.9.0"
771 771 source = "registry+https://github.com/rust-lang/crates.io-index"
772 772 checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
773 773 dependencies = [
774 774 "crossbeam-channel 0.5.0",
775 775 "crossbeam-deque",
776 776 "crossbeam-utils 0.8.1",
777 777 "lazy_static",
778 778 "num_cpus",
779 779 ]
780 780
781 781 [[package]]
782 782 name = "redox_syscall"
783 783 version = "0.1.57"
784 784 source = "registry+https://github.com/rust-lang/crates.io-index"
785 785 checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
786 786
787 787 [[package]]
788 788 name = "regex"
789 789 version = "1.4.2"
790 790 source = "registry+https://github.com/rust-lang/crates.io-index"
791 791 checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
792 792 dependencies = [
793 793 "aho-corasick",
794 794 "memchr",
795 795 "regex-syntax",
796 796 "thread_local",
797 797 ]
798 798
799 799 [[package]]
800 800 name = "regex-syntax"
801 801 version = "0.6.21"
802 802 source = "registry+https://github.com/rust-lang/crates.io-index"
803 803 checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
804 804
805 805 [[package]]
806 806 name = "remove_dir_all"
807 807 version = "0.5.3"
808 808 source = "registry+https://github.com/rust-lang/crates.io-index"
809 809 checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
810 810 dependencies = [
811 811 "winapi",
812 812 ]
813 813
814 814 [[package]]
815 815 name = "rhg"
816 816 version = "0.1.0"
817 817 dependencies = [
818 818 "chrono",
819 819 "clap",
820 820 "derive_more",
821 821 "env_logger",
822 822 "format-bytes",
823 823 "hg-core",
824 824 "home",
825 825 "lazy_static",
826 826 "log",
827 827 "micro-timer",
828 828 "regex",
829 829 "users",
830 830 ]
831 831
832 832 [[package]]
833 833 name = "same-file"
834 834 version = "1.0.6"
835 835 source = "registry+https://github.com/rust-lang/crates.io-index"
836 836 checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
837 837 dependencies = [
838 838 "winapi-util",
839 839 ]
840 840
841 841 [[package]]
842 842 name = "scopeguard"
843 843 version = "1.1.0"
844 844 source = "registry+https://github.com/rust-lang/crates.io-index"
845 845 checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
846 846
847 847 [[package]]
848 848 name = "sha-1"
849 849 version = "0.9.6"
850 850 source = "registry+https://github.com/rust-lang/crates.io-index"
851 851 checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16"
852 852 dependencies = [
853 853 "block-buffer",
854 854 "cfg-if 1.0.0",
855 855 "cpufeatures",
856 856 "digest",
857 857 "opaque-debug",
858 858 ]
859 859
860 860 [[package]]
861 861 name = "sized-chunks"
862 862 version = "0.6.2"
863 863 source = "registry+https://github.com/rust-lang/crates.io-index"
864 864 checksum = "1ec31ceca5644fa6d444cc77548b88b67f46db6f7c71683b0f9336e671830d2f"
865 865 dependencies = [
866 866 "bitmaps",
867 867 "typenum",
868 868 ]
869 869
870 870 [[package]]
871 871 name = "stable_deref_trait"
872 872 version = "1.2.0"
873 873 source = "registry+https://github.com/rust-lang/crates.io-index"
874 874 checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
875 875
876 876 [[package]]
877 877 name = "static_assertions"
878 878 version = "1.1.0"
879 879 source = "registry+https://github.com/rust-lang/crates.io-index"
880 880 checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
881 881
882 882 [[package]]
883 883 name = "strsim"
884 884 version = "0.8.0"
885 885 source = "registry+https://github.com/rust-lang/crates.io-index"
886 886 checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
887 887
888 888 [[package]]
889 889 name = "syn"
890 890 version = "1.0.54"
891 891 source = "registry+https://github.com/rust-lang/crates.io-index"
892 892 checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
893 893 dependencies = [
894 894 "proc-macro2",
895 895 "quote",
896 896 "unicode-xid",
897 897 ]
898 898
899 899 [[package]]
900 900 name = "tempfile"
901 901 version = "3.1.0"
902 902 source = "registry+https://github.com/rust-lang/crates.io-index"
903 903 checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
904 904 dependencies = [
905 905 "cfg-if 0.1.10",
906 906 "libc",
907 907 "rand",
908 908 "redox_syscall",
909 909 "remove_dir_all",
910 910 "winapi",
911 911 ]
912 912
913 913 [[package]]
914 914 name = "termcolor"
915 915 version = "1.1.2"
916 916 source = "registry+https://github.com/rust-lang/crates.io-index"
917 917 checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
918 918 dependencies = [
919 919 "winapi-util",
920 920 ]
921 921
922 922 [[package]]
923 923 name = "textwrap"
924 924 version = "0.11.0"
925 925 source = "registry+https://github.com/rust-lang/crates.io-index"
926 926 checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
927 927 dependencies = [
928 928 "unicode-width",
929 929 ]
930 930
931 931 [[package]]
932 932 name = "thread_local"
933 933 version = "1.0.1"
934 934 source = "registry+https://github.com/rust-lang/crates.io-index"
935 935 checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
936 936 dependencies = [
937 937 "lazy_static",
938 938 ]
939 939
940 940 [[package]]
941 941 name = "time"
942 942 version = "0.1.44"
943 943 source = "registry+https://github.com/rust-lang/crates.io-index"
944 944 checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
945 945 dependencies = [
946 946 "libc",
947 947 "wasi 0.10.0+wasi-snapshot-preview1",
948 948 "winapi",
949 949 ]
950 950
951 951 [[package]]
952 952 name = "twox-hash"
953 953 version = "1.6.0"
954 954 source = "registry+https://github.com/rust-lang/crates.io-index"
955 955 checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
956 956 dependencies = [
957 957 "cfg-if 0.1.10",
958 958 "rand",
959 959 "static_assertions",
960 960 ]
961 961
962 962 [[package]]
963 963 name = "typenum"
964 964 version = "1.12.0"
965 965 source = "registry+https://github.com/rust-lang/crates.io-index"
966 966 checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
967 967
968 968 [[package]]
969 969 name = "unicode-width"
970 970 version = "0.1.8"
971 971 source = "registry+https://github.com/rust-lang/crates.io-index"
972 972 checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
973 973
974 974 [[package]]
975 975 name = "unicode-xid"
976 976 version = "0.2.1"
977 977 source = "registry+https://github.com/rust-lang/crates.io-index"
978 978 checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
979 979
980 980 [[package]]
981 981 name = "users"
982 982 version = "0.11.0"
983 983 source = "registry+https://github.com/rust-lang/crates.io-index"
984 984 checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
985 985 dependencies = [
986 986 "libc",
987 987 "log",
988 988 ]
989 989
990 990 [[package]]
991 991 name = "vcpkg"
992 992 version = "0.2.11"
993 993 source = "registry+https://github.com/rust-lang/crates.io-index"
994 994 checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
995 995
996 996 [[package]]
997 997 name = "vec_map"
998 998 version = "0.8.2"
999 999 source = "registry+https://github.com/rust-lang/crates.io-index"
1000 1000 checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
1001 1001
1002 1002 [[package]]
1003 1003 name = "version_check"
1004 1004 version = "0.9.2"
1005 1005 source = "registry+https://github.com/rust-lang/crates.io-index"
1006 1006 checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
1007 1007
1008 1008 [[package]]
1009 1009 name = "wasi"
1010 1010 version = "0.9.0+wasi-snapshot-preview1"
1011 1011 source = "registry+https://github.com/rust-lang/crates.io-index"
1012 1012 checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
1013 1013
1014 1014 [[package]]
1015 1015 name = "wasi"
1016 1016 version = "0.10.0+wasi-snapshot-preview1"
1017 1017 source = "registry+https://github.com/rust-lang/crates.io-index"
1018 1018 checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
1019 1019
1020 1020 [[package]]
1021 1021 name = "winapi"
1022 1022 version = "0.3.9"
1023 1023 source = "registry+https://github.com/rust-lang/crates.io-index"
1024 1024 checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
1025 1025 dependencies = [
1026 1026 "winapi-i686-pc-windows-gnu",
1027 1027 "winapi-x86_64-pc-windows-gnu",
1028 1028 ]
1029 1029
1030 1030 [[package]]
1031 1031 name = "winapi-i686-pc-windows-gnu"
1032 1032 version = "0.4.0"
1033 1033 source = "registry+https://github.com/rust-lang/crates.io-index"
1034 1034 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1035 1035
1036 1036 [[package]]
1037 1037 name = "winapi-util"
1038 1038 version = "0.1.5"
1039 1039 source = "registry+https://github.com/rust-lang/crates.io-index"
1040 1040 checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
1041 1041 dependencies = [
1042 1042 "winapi",
1043 1043 ]
1044 1044
1045 1045 [[package]]
1046 1046 name = "winapi-x86_64-pc-windows-gnu"
1047 1047 version = "0.4.0"
1048 1048 source = "registry+https://github.com/rust-lang/crates.io-index"
1049 1049 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1050 1050
1051 1051 [[package]]
1052 1052 name = "zstd"
1053 1053 version = "0.5.3+zstd.1.4.5"
1054 1054 source = "registry+https://github.com/rust-lang/crates.io-index"
1055 1055 checksum = "01b32eaf771efa709e8308605bbf9319bf485dc1503179ec0469b611937c0cd8"
1056 1056 dependencies = [
1057 1057 "zstd-safe",
1058 1058 ]
1059 1059
1060 1060 [[package]]
1061 1061 name = "zstd-safe"
1062 1062 version = "2.0.5+zstd.1.4.5"
1063 1063 source = "registry+https://github.com/rust-lang/crates.io-index"
1064 1064 checksum = "1cfb642e0d27f64729a639c52db457e0ae906e7bc6f5fe8f5c453230400f1055"
1065 1065 dependencies = [
1066 1066 "libc",
1067 1067 "zstd-sys",
1068 1068 ]
1069 1069
1070 1070 [[package]]
1071 1071 name = "zstd-sys"
1072 1072 version = "1.4.17+zstd.1.4.5"
1073 1073 source = "registry+https://github.com/rust-lang/crates.io-index"
1074 1074 checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b"
1075 1075 dependencies = [
1076 1076 "cc",
1077 1077 "glob",
1078 1078 "itertools",
1079 1079 "libc",
1080 1080 ]
@@ -1,45 +1,46 b''
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 bitflags = "1.2"
12 13 bytes-cast = "0.2"
13 14 byteorder = "1.3.4"
14 15 derive_more = "0.99"
15 16 home = "0.5"
16 17 im-rc = "15.0.*"
17 18 itertools = "0.9"
18 19 lazy_static = "1.4.0"
19 20 rand = "0.7.3"
20 21 rand_pcg = "0.2.1"
21 22 rand_distr = "0.2.2"
22 23 rayon = "1.3.0"
23 24 regex = "1.3.9"
24 25 sha-1 = "0.9.6"
25 26 twox-hash = "1.5.0"
26 27 same-file = "1.0.6"
27 28 stable_deref_trait = "1.2.0"
28 29 tempfile = "3.1.0"
29 30 crossbeam-channel = "0.4"
30 31 micro-timer = "0.3.0"
31 32 log = "0.4.8"
32 33 memmap2 = {version = "0.4", features = ["stable_deref_trait"]}
33 34 zstd = "0.5.3"
34 35 format-bytes = "0.2.2"
35 36
36 37 # We don't use the `miniz-oxide` backend to not change rhg benchmarks and until
37 38 # we have a clearer view of which backend is the fastest.
38 39 [dependencies.flate2]
39 40 version = "1.0.16"
40 41 features = ["zlib"]
41 42 default-features = false
42 43
43 44 [dev-dependencies]
44 45 clap = "*"
45 46 pretty_assertions = "0.6.1"
@@ -1,470 +1,471 b''
1 1 // dirstate_map.rs
2 2 //
3 3 // Copyright 2019 Raphaël Gomès <rgomes@octobus.net>
4 4 //
5 5 // This software may be used and distributed according to the terms of the
6 6 // GNU General Public License version 2 or any later version.
7 7
8 8 use crate::dirstate::parsers::Timestamp;
9 9 use crate::{
10 10 dirstate::EntryState,
11 11 dirstate::MTIME_UNSET,
12 12 dirstate::SIZE_FROM_OTHER_PARENT,
13 13 dirstate::SIZE_NON_NORMAL,
14 14 dirstate::V1_RANGEMASK,
15 15 pack_dirstate, parse_dirstate,
16 16 utils::hg_path::{HgPath, HgPathBuf},
17 17 CopyMap, DirsMultiset, DirstateEntry, DirstateError, DirstateParents,
18 18 StateMap,
19 19 };
20 20 use micro_timer::timed;
21 21 use std::collections::HashSet;
22 22 use std::iter::FromIterator;
23 23 use std::ops::Deref;
24 24
25 25 #[derive(Default)]
26 26 pub struct DirstateMap {
27 27 state_map: StateMap,
28 28 pub copy_map: CopyMap,
29 29 pub dirs: Option<DirsMultiset>,
30 30 pub all_dirs: Option<DirsMultiset>,
31 31 non_normal_set: Option<HashSet<HgPathBuf>>,
32 32 other_parent_set: Option<HashSet<HgPathBuf>>,
33 33 }
34 34
35 35 /// Should only really be used in python interface code, for clarity
36 36 impl Deref for DirstateMap {
37 37 type Target = StateMap;
38 38
39 39 fn deref(&self) -> &Self::Target {
40 40 &self.state_map
41 41 }
42 42 }
43 43
44 44 impl FromIterator<(HgPathBuf, DirstateEntry)> for DirstateMap {
45 45 fn from_iter<I: IntoIterator<Item = (HgPathBuf, DirstateEntry)>>(
46 46 iter: I,
47 47 ) -> Self {
48 48 Self {
49 49 state_map: iter.into_iter().collect(),
50 50 ..Self::default()
51 51 }
52 52 }
53 53 }
54 54
55 55 impl DirstateMap {
56 56 pub fn new() -> Self {
57 57 Self::default()
58 58 }
59 59
60 60 pub fn clear(&mut self) {
61 61 self.state_map = StateMap::default();
62 62 self.copy_map.clear();
63 63 self.non_normal_set = None;
64 64 self.other_parent_set = None;
65 65 }
66 66
67 67 pub fn set_v1_inner(&mut self, filename: &HgPath, entry: DirstateEntry) {
68 68 self.state_map.insert(filename.to_owned(), entry);
69 69 }
70 70
71 71 /// Add a tracked file to the dirstate
72 72 pub fn add_file(
73 73 &mut self,
74 74 filename: &HgPath,
75 75 entry: DirstateEntry,
76 76 // XXX once the dust settle this should probably become an enum
77 77 added: bool,
78 78 merged: bool,
79 79 from_p2: bool,
80 80 possibly_dirty: bool,
81 81 ) -> Result<(), DirstateError> {
82 82 let state;
83 83 let size;
84 84 let mtime;
85 85 if added {
86 86 assert!(!possibly_dirty);
87 87 assert!(!from_p2);
88 88 state = EntryState::Added;
89 89 size = SIZE_NON_NORMAL;
90 90 mtime = MTIME_UNSET;
91 91 } else if merged {
92 92 assert!(!possibly_dirty);
93 93 assert!(!from_p2);
94 94 state = EntryState::Merged;
95 95 size = SIZE_FROM_OTHER_PARENT;
96 96 mtime = MTIME_UNSET;
97 97 } else if from_p2 {
98 98 assert!(!possibly_dirty);
99 99 state = EntryState::Normal;
100 100 size = SIZE_FROM_OTHER_PARENT;
101 101 mtime = MTIME_UNSET;
102 102 } else if possibly_dirty {
103 103 state = EntryState::Normal;
104 104 size = SIZE_NON_NORMAL;
105 105 mtime = MTIME_UNSET;
106 106 } else {
107 107 state = EntryState::Normal;
108 108 size = entry.size() & V1_RANGEMASK;
109 109 mtime = entry.mtime() & V1_RANGEMASK;
110 110 }
111 111 let mode = entry.mode();
112 112 let entry = DirstateEntry::from_v1_data(state, mode, size, mtime);
113 113
114 114 let old_state = self.get(filename).map(|e| e.state());
115 115 if old_state.is_none() || old_state == Some(EntryState::Removed) {
116 116 if let Some(ref mut dirs) = self.dirs {
117 117 dirs.add_path(filename)?;
118 118 }
119 119 }
120 120 if old_state.is_none() {
121 121 if let Some(ref mut all_dirs) = self.all_dirs {
122 122 all_dirs.add_path(filename)?;
123 123 }
124 124 }
125 125 self.state_map.insert(filename.to_owned(), entry.to_owned());
126 126
127 127 if entry.is_non_normal() {
128 128 self.get_non_normal_other_parent_entries()
129 129 .0
130 130 .insert(filename.to_owned());
131 131 }
132 132
133 133 if entry.is_from_other_parent() {
134 134 self.get_non_normal_other_parent_entries()
135 135 .1
136 136 .insert(filename.to_owned());
137 137 }
138 138 Ok(())
139 139 }
140 140
141 141 /// Mark a file as removed in the dirstate.
142 142 ///
143 143 /// The `size` parameter is used to store sentinel values that indicate
144 144 /// the file's previous state. In the future, we should refactor this
145 145 /// to be more explicit about what that state is.
146 146 pub fn remove_file(
147 147 &mut self,
148 148 filename: &HgPath,
149 149 in_merge: bool,
150 150 ) -> Result<(), DirstateError> {
151 151 let old_entry_opt = self.get(filename);
152 152 let old_state = old_entry_opt.map(|e| e.state());
153 153 let mut size = 0;
154 154 if in_merge {
155 155 // XXX we should not be able to have 'm' state and 'FROM_P2' if not
156 156 // during a merge. So I (marmoute) am not sure we need the
157 157 // conditionnal at all. Adding double checking this with assert
158 158 // would be nice.
159 159 if let Some(old_entry) = old_entry_opt {
160 160 // backup the previous state
161 161 if old_entry.state() == EntryState::Merged {
162 162 size = SIZE_NON_NORMAL;
163 163 } else if old_entry.state() == EntryState::Normal
164 164 && old_entry.size() == SIZE_FROM_OTHER_PARENT
165 165 {
166 166 // other parent
167 167 size = SIZE_FROM_OTHER_PARENT;
168 168 self.get_non_normal_other_parent_entries()
169 169 .1
170 170 .insert(filename.to_owned());
171 171 }
172 172 }
173 173 }
174 174 if old_state.is_some() && old_state != Some(EntryState::Removed) {
175 175 if let Some(ref mut dirs) = self.dirs {
176 176 dirs.delete_path(filename)?;
177 177 }
178 178 }
179 179 if old_state.is_none() {
180 180 if let Some(ref mut all_dirs) = self.all_dirs {
181 181 all_dirs.add_path(filename)?;
182 182 }
183 183 }
184 184 if size == 0 {
185 185 self.copy_map.remove(filename);
186 186 }
187 187
188 188 self.state_map
189 189 .insert(filename.to_owned(), DirstateEntry::new_removed(size));
190 190 self.get_non_normal_other_parent_entries()
191 191 .0
192 192 .insert(filename.to_owned());
193 193 Ok(())
194 194 }
195 195
196 196 /// Remove a file from the dirstate.
197 197 /// Returns `true` if the file was previously recorded.
198 198 pub fn drop_file(
199 199 &mut self,
200 200 filename: &HgPath,
201 201 ) -> Result<bool, DirstateError> {
202 202 let old_state = self.get(filename).map(|e| e.state());
203 203 let exists = self.state_map.remove(filename).is_some();
204 204
205 205 if exists {
206 206 if old_state != Some(EntryState::Removed) {
207 207 if let Some(ref mut dirs) = self.dirs {
208 208 dirs.delete_path(filename)?;
209 209 }
210 210 }
211 211 if let Some(ref mut all_dirs) = self.all_dirs {
212 212 all_dirs.delete_path(filename)?;
213 213 }
214 214 }
215 215 self.get_non_normal_other_parent_entries()
216 216 .0
217 217 .remove(filename);
218 218
219 219 Ok(exists)
220 220 }
221 221
222 222 pub fn clear_ambiguous_times(
223 223 &mut self,
224 224 filenames: Vec<HgPathBuf>,
225 225 now: i32,
226 226 ) {
227 227 for filename in filenames {
228 228 if let Some(entry) = self.state_map.get_mut(&filename) {
229 229 if entry.clear_ambiguous_mtime(now) {
230 230 self.get_non_normal_other_parent_entries()
231 231 .0
232 232 .insert(filename.to_owned());
233 233 }
234 234 }
235 235 }
236 236 }
237 237
238 238 pub fn non_normal_entries_remove(
239 239 &mut self,
240 240 key: impl AsRef<HgPath>,
241 241 ) -> bool {
242 242 self.get_non_normal_other_parent_entries()
243 243 .0
244 244 .remove(key.as_ref())
245 245 }
246 246
247 247 pub fn non_normal_entries_add(&mut self, key: impl AsRef<HgPath>) {
248 248 self.get_non_normal_other_parent_entries()
249 249 .0
250 250 .insert(key.as_ref().into());
251 251 }
252 252
253 253 pub fn non_normal_entries_union(
254 254 &mut self,
255 255 other: HashSet<HgPathBuf>,
256 256 ) -> Vec<HgPathBuf> {
257 257 self.get_non_normal_other_parent_entries()
258 258 .0
259 259 .union(&other)
260 260 .map(ToOwned::to_owned)
261 261 .collect()
262 262 }
263 263
264 264 pub fn get_non_normal_other_parent_entries(
265 265 &mut self,
266 266 ) -> (&mut HashSet<HgPathBuf>, &mut HashSet<HgPathBuf>) {
267 267 self.set_non_normal_other_parent_entries(false);
268 268 (
269 269 self.non_normal_set.as_mut().unwrap(),
270 270 self.other_parent_set.as_mut().unwrap(),
271 271 )
272 272 }
273 273
274 274 /// Useful to get immutable references to those sets in contexts where
275 275 /// you only have an immutable reference to the `DirstateMap`, like when
276 276 /// sharing references with Python.
277 277 ///
278 278 /// TODO, get rid of this along with the other "setter/getter" stuff when
279 279 /// a nice typestate plan is defined.
280 280 ///
281 281 /// # Panics
282 282 ///
283 283 /// Will panic if either set is `None`.
284 284 pub fn get_non_normal_other_parent_entries_panic(
285 285 &self,
286 286 ) -> (&HashSet<HgPathBuf>, &HashSet<HgPathBuf>) {
287 287 (
288 288 self.non_normal_set.as_ref().unwrap(),
289 289 self.other_parent_set.as_ref().unwrap(),
290 290 )
291 291 }
292 292
293 293 pub fn set_non_normal_other_parent_entries(&mut self, force: bool) {
294 294 if !force
295 295 && self.non_normal_set.is_some()
296 296 && self.other_parent_set.is_some()
297 297 {
298 298 return;
299 299 }
300 300 let mut non_normal = HashSet::new();
301 301 let mut other_parent = HashSet::new();
302 302
303 303 for (filename, entry) in self.state_map.iter() {
304 304 if entry.is_non_normal() {
305 305 non_normal.insert(filename.to_owned());
306 306 }
307 307 if entry.is_from_other_parent() {
308 308 other_parent.insert(filename.to_owned());
309 309 }
310 310 }
311 311 self.non_normal_set = Some(non_normal);
312 312 self.other_parent_set = Some(other_parent);
313 313 }
314 314
315 315 /// Both of these setters and their uses appear to be the simplest way to
316 316 /// emulate a Python lazy property, but it is ugly and unidiomatic.
317 317 /// TODO One day, rewriting this struct using the typestate might be a
318 318 /// good idea.
319 319 pub fn set_all_dirs(&mut self) -> Result<(), DirstateError> {
320 320 if self.all_dirs.is_none() {
321 321 self.all_dirs = Some(DirsMultiset::from_dirstate(
322 322 self.state_map.iter().map(|(k, v)| Ok((k, *v))),
323 323 false,
324 324 )?);
325 325 }
326 326 Ok(())
327 327 }
328 328
329 329 pub fn set_dirs(&mut self) -> Result<(), DirstateError> {
330 330 if self.dirs.is_none() {
331 331 self.dirs = Some(DirsMultiset::from_dirstate(
332 332 self.state_map.iter().map(|(k, v)| Ok((k, *v))),
333 333 true,
334 334 )?);
335 335 }
336 336 Ok(())
337 337 }
338 338
339 339 pub fn has_tracked_dir(
340 340 &mut self,
341 341 directory: &HgPath,
342 342 ) -> Result<bool, DirstateError> {
343 343 self.set_dirs()?;
344 344 Ok(self.dirs.as_ref().unwrap().contains(directory))
345 345 }
346 346
347 347 pub fn has_dir(
348 348 &mut self,
349 349 directory: &HgPath,
350 350 ) -> Result<bool, DirstateError> {
351 351 self.set_all_dirs()?;
352 352 Ok(self.all_dirs.as_ref().unwrap().contains(directory))
353 353 }
354 354
355 355 #[timed]
356 356 pub fn read(
357 357 &mut self,
358 358 file_contents: &[u8],
359 359 ) -> Result<Option<DirstateParents>, DirstateError> {
360 360 if file_contents.is_empty() {
361 361 return Ok(None);
362 362 }
363 363
364 364 let (parents, entries, copies) = parse_dirstate(file_contents)?;
365 365 self.state_map.extend(
366 366 entries
367 367 .into_iter()
368 368 .map(|(path, entry)| (path.to_owned(), entry)),
369 369 );
370 370 self.copy_map.extend(
371 371 copies
372 372 .into_iter()
373 373 .map(|(path, copy)| (path.to_owned(), copy.to_owned())),
374 374 );
375 375 Ok(Some(parents.clone()))
376 376 }
377 377
378 378 pub fn pack(
379 379 &mut self,
380 380 parents: DirstateParents,
381 381 now: Timestamp,
382 382 ) -> Result<Vec<u8>, DirstateError> {
383 383 let packed =
384 384 pack_dirstate(&mut self.state_map, &self.copy_map, parents, now)?;
385 385
386 386 self.set_non_normal_other_parent_entries(true);
387 387 Ok(packed)
388 388 }
389 389 }
390 390
391 391 #[cfg(test)]
392 392 mod tests {
393 393 use super::*;
394 394
395 395 #[test]
396 396 fn test_dirs_multiset() {
397 397 let mut map = DirstateMap::new();
398 398 assert!(map.dirs.is_none());
399 399 assert!(map.all_dirs.is_none());
400 400
401 401 assert_eq!(map.has_dir(HgPath::new(b"nope")).unwrap(), false);
402 402 assert!(map.all_dirs.is_some());
403 403 assert!(map.dirs.is_none());
404 404
405 405 assert_eq!(map.has_tracked_dir(HgPath::new(b"nope")).unwrap(), false);
406 406 assert!(map.dirs.is_some());
407 407 }
408 408
409 409 #[test]
410 410 fn test_add_file() {
411 411 let mut map = DirstateMap::new();
412 412
413 413 assert_eq!(0, map.len());
414 414
415 415 map.add_file(
416 416 HgPath::new(b"meh"),
417 417 DirstateEntry::from_v1_data(EntryState::Normal, 1337, 1337, 1337),
418 418 false,
419 419 false,
420 420 false,
421 421 false,
422 422 )
423 423 .unwrap();
424 424
425 425 assert_eq!(1, map.len());
426 426 assert_eq!(0, map.get_non_normal_other_parent_entries().0.len());
427 427 assert_eq!(0, map.get_non_normal_other_parent_entries().1.len());
428 428 }
429 429
430 430 #[test]
431 431 fn test_non_normal_other_parent_entries() {
432 432 let mut map: DirstateMap = [
433 433 (b"f1", (EntryState::Removed, 1337, 1337, 1337)),
434 434 (b"f2", (EntryState::Normal, 1337, 1337, -1)),
435 435 (b"f3", (EntryState::Normal, 1337, 1337, 1337)),
436 436 (b"f4", (EntryState::Normal, 1337, -2, 1337)),
437 437 (b"f5", (EntryState::Added, 1337, 1337, 1337)),
438 438 (b"f6", (EntryState::Added, 1337, 1337, -1)),
439 439 (b"f7", (EntryState::Merged, 1337, 1337, -1)),
440 440 (b"f8", (EntryState::Merged, 1337, 1337, 1337)),
441 441 (b"f9", (EntryState::Merged, 1337, -2, 1337)),
442 442 (b"fa", (EntryState::Added, 1337, -2, 1337)),
443 443 (b"fb", (EntryState::Removed, 1337, -2, 1337)),
444 444 ]
445 445 .iter()
446 446 .map(|(fname, (state, mode, size, mtime))| {
447 447 (
448 448 HgPathBuf::from_bytes(fname.as_ref()),
449 449 DirstateEntry::from_v1_data(*state, *mode, *size, *mtime),
450 450 )
451 451 })
452 452 .collect();
453 453
454 454 let mut non_normal = [
455 b"f1", b"f2", b"f5", b"f6", b"f7", b"f8", b"f9", b"fa", b"fb",
455 b"f1", b"f2", b"f4", b"f5", b"f6", b"f7", b"f8", b"f9", b"fa",
456 b"fb",
456 457 ]
457 458 .iter()
458 459 .map(|x| HgPathBuf::from_bytes(x.as_ref()))
459 460 .collect();
460 461
461 462 let mut other_parent = HashSet::new();
462 463 other_parent.insert(HgPathBuf::from_bytes(b"f4"));
463 464 let entries = map.get_non_normal_other_parent_entries();
464 465
465 466 assert_eq!(
466 467 (&mut non_normal, &mut other_parent),
467 468 (entries.0, entries.1)
468 469 );
469 470 }
470 471 }
@@ -1,190 +1,345 b''
1 1 use crate::errors::HgError;
2 use bitflags::bitflags;
2 3 use std::convert::TryFrom;
3 4
4 5 #[derive(Copy, Clone, Debug, Eq, PartialEq)]
5 6 pub enum EntryState {
6 7 Normal,
7 8 Added,
8 9 Removed,
9 10 Merged,
10 11 }
11 12
12 13 /// The C implementation uses all signed types. This will be an issue
13 14 /// either when 4GB+ source files are commonplace or in 2038, whichever
14 15 /// comes first.
15 16 #[derive(Debug, PartialEq, Copy, Clone)]
16 17 pub struct DirstateEntry {
17 state: EntryState,
18 flags: Flags,
18 19 mode: i32,
19 20 size: i32,
20 21 mtime: i32,
21 22 }
22 23
24 bitflags! {
25 struct Flags: u8 {
26 const WDIR_TRACKED = 1 << 0;
27 const P1_TRACKED = 1 << 1;
28 const P2_TRACKED = 1 << 2;
29 const POSSIBLY_DIRTY = 1 << 3;
30 const MERGED = 1 << 4;
31 const CLEAN_P1 = 1 << 5;
32 const CLEAN_P2 = 1 << 6;
33 const ENTRYLESS_TREE_NODE = 1 << 7;
34 }
35 }
36
23 37 pub const V1_RANGEMASK: i32 = 0x7FFFFFFF;
24 38
25 39 pub const MTIME_UNSET: i32 = -1;
26 40
27 41 /// A `DirstateEntry` with a size of `-2` means that it was merged from the
28 42 /// other parent. This allows revert to pick the right status back during a
29 43 /// merge.
30 44 pub const SIZE_FROM_OTHER_PARENT: i32 = -2;
31 45 /// A special value used for internal representation of special case in
32 46 /// dirstate v1 format.
33 47 pub const SIZE_NON_NORMAL: i32 = -1;
34 48
35 49 impl DirstateEntry {
36 50 pub fn from_v1_data(
37 51 state: EntryState,
38 52 mode: i32,
39 53 size: i32,
40 54 mtime: i32,
41 55 ) -> Self {
56 match state {
57 EntryState::Normal => {
58 if size == SIZE_FROM_OTHER_PARENT {
59 Self::new_from_p2()
60 } else if size == SIZE_NON_NORMAL {
61 Self::new_possibly_dirty()
62 } else if mtime == MTIME_UNSET {
63 Self {
64 flags: Flags::WDIR_TRACKED
65 | Flags::P1_TRACKED
66 | Flags::POSSIBLY_DIRTY,
67 mode,
68 size,
69 mtime: 0,
70 }
71 } else {
72 Self {
73 flags: Flags::WDIR_TRACKED | Flags::P1_TRACKED,
74 mode,
75 size,
76 mtime,
77 }
78 }
79 }
80 EntryState::Added => Self::new_added(),
81 EntryState::Removed => Self {
82 flags: if size == SIZE_NON_NORMAL {
83 Flags::P1_TRACKED // might not be true because of rename ?
84 | Flags::P2_TRACKED // might not be true because of rename ?
85 | Flags::MERGED
86 } else if size == SIZE_FROM_OTHER_PARENT {
87 // We don’t know if P1_TRACKED should be set (file history)
88 Flags::P2_TRACKED | Flags::CLEAN_P2
89 } else {
90 Flags::P1_TRACKED
91 },
92 mode: 0,
93 size: 0,
94 mtime: 0,
95 },
96 EntryState::Merged => Self::new_merged(),
97 }
98 }
99
100 fn new_from_p2() -> Self {
42 101 Self {
43 state,
44 mode,
45 size,
46 mtime,
102 // might be missing P1_TRACKED
103 flags: Flags::WDIR_TRACKED | Flags::P2_TRACKED | Flags::CLEAN_P2,
104 mode: 0,
105 size: SIZE_FROM_OTHER_PARENT,
106 mtime: MTIME_UNSET,
107 }
108 }
109
110 fn new_possibly_dirty() -> Self {
111 Self {
112 flags: Flags::WDIR_TRACKED
113 | Flags::P1_TRACKED
114 | Flags::POSSIBLY_DIRTY,
115 mode: 0,
116 size: SIZE_NON_NORMAL,
117 mtime: MTIME_UNSET,
118 }
119 }
120
121 fn new_added() -> Self {
122 Self {
123 flags: Flags::WDIR_TRACKED,
124 mode: 0,
125 size: SIZE_NON_NORMAL,
126 mtime: MTIME_UNSET,
127 }
128 }
129
130 fn new_merged() -> Self {
131 Self {
132 flags: Flags::WDIR_TRACKED
133 | Flags::P1_TRACKED // might not be true because of rename ?
134 | Flags::P2_TRACKED // might not be true because of rename ?
135 | Flags::MERGED,
136 mode: 0,
137 size: SIZE_NON_NORMAL,
138 mtime: MTIME_UNSET,
47 139 }
48 140 }
49 141
50 142 /// Creates a new entry in "removed" state.
51 143 ///
52 144 /// `size` is expected to be zero, `SIZE_NON_NORMAL`, or
53 145 /// `SIZE_FROM_OTHER_PARENT`
54 146 pub fn new_removed(size: i32) -> Self {
55 Self {
56 state: EntryState::Removed,
57 mode: 0,
58 size,
59 mtime: 0,
60 }
147 Self::from_v1_data(EntryState::Removed, 0, size, 0)
61 148 }
62 149
63 150 /// TODO: refactor `DirstateMap::add_file` to not take a `DirstateEntry`
64 151 /// parameter and remove this constructor
65 152 pub fn new_for_add_file(mode: i32, size: i32, mtime: i32) -> Self {
66 Self {
67 // XXX Arbitrary default value since the value is determined later
68 state: EntryState::Normal,
69 mode,
70 size,
71 mtime,
72 }
153 // XXX Arbitrary default value since the value is determined later
154 let state = EntryState::Normal;
155 Self::from_v1_data(state, mode, size, mtime)
156 }
157
158 fn tracked_in_any_parent(&self) -> bool {
159 self.flags.intersects(Flags::P1_TRACKED | Flags::P2_TRACKED)
160 }
161
162 fn removed(&self) -> bool {
163 self.tracked_in_any_parent()
164 && !self.flags.contains(Flags::WDIR_TRACKED)
165 }
166
167 fn merged_removed(&self) -> bool {
168 self.removed() && self.flags.contains(Flags::MERGED)
169 }
170
171 fn from_p2_removed(&self) -> bool {
172 self.removed() && self.flags.contains(Flags::CLEAN_P2)
173 }
174
175 fn merged(&self) -> bool {
176 self.flags.contains(Flags::WDIR_TRACKED | Flags::MERGED)
177 }
178
179 fn added(&self) -> bool {
180 self.flags.contains(Flags::WDIR_TRACKED)
181 && !self.tracked_in_any_parent()
182 }
183
184 fn from_p2(&self) -> bool {
185 self.flags.contains(Flags::WDIR_TRACKED | Flags::CLEAN_P2)
73 186 }
74 187
75 188 pub fn state(&self) -> EntryState {
76 self.state
189 if self.removed() {
190 EntryState::Removed
191 } else if self.merged() {
192 EntryState::Merged
193 } else if self.added() {
194 EntryState::Added
195 } else {
196 EntryState::Normal
197 }
77 198 }
78 199
79 200 pub fn mode(&self) -> i32 {
80 201 self.mode
81 202 }
82 203
83 204 pub fn size(&self) -> i32 {
84 self.size
205 if self.merged_removed() {
206 SIZE_NON_NORMAL
207 } else if self.from_p2_removed() {
208 SIZE_FROM_OTHER_PARENT
209 } else if self.removed() {
210 0
211 } else if self.merged() {
212 SIZE_FROM_OTHER_PARENT
213 } else if self.added() {
214 SIZE_NON_NORMAL
215 } else if self.from_p2() {
216 SIZE_FROM_OTHER_PARENT
217 } else if self.flags.contains(Flags::POSSIBLY_DIRTY) {
218 self.size // TODO: SIZE_NON_NORMAL ?
219 } else {
220 self.size
221 }
85 222 }
86 223
87 224 pub fn mtime(&self) -> i32 {
88 self.mtime
225 if self.removed() {
226 0
227 } else if self.flags.contains(Flags::POSSIBLY_DIRTY) {
228 MTIME_UNSET
229 } else if self.merged() {
230 MTIME_UNSET
231 } else if self.added() {
232 MTIME_UNSET
233 } else if self.from_p2() {
234 MTIME_UNSET
235 } else {
236 self.mtime
237 }
89 238 }
90 239
91 240 /// Returns `(state, mode, size, mtime)` for the puprose of serialization
92 241 /// in the dirstate-v1 format.
93 242 ///
94 243 /// This includes marker values such as `mtime == -1`. In the future we may
95 244 /// want to not represent these cases that way in memory, but serialization
96 245 /// will need to keep the same format.
97 246 pub fn v1_data(&self) -> (u8, i32, i32, i32) {
98 (self.state.into(), self.mode, self.size, self.mtime)
247 (self.state().into(), self.mode(), self.size(), self.mtime())
99 248 }
100 249
101 250 pub fn is_non_normal(&self) -> bool {
102 self.state != EntryState::Normal || self.mtime == MTIME_UNSET
251 self.state() != EntryState::Normal || self.mtime() == MTIME_UNSET
103 252 }
104 253
105 254 pub fn is_from_other_parent(&self) -> bool {
106 self.state == EntryState::Normal && self.size == SIZE_FROM_OTHER_PARENT
255 self.state() == EntryState::Normal
256 && self.size() == SIZE_FROM_OTHER_PARENT
107 257 }
108 258
109 259 // TODO: other platforms
110 260 #[cfg(unix)]
111 261 pub fn mode_changed(
112 262 &self,
113 263 filesystem_metadata: &std::fs::Metadata,
114 264 ) -> bool {
115 265 use std::os::unix::fs::MetadataExt;
116 266 const EXEC_BIT_MASK: u32 = 0o100;
117 let dirstate_exec_bit = (self.mode as u32) & EXEC_BIT_MASK;
267 let dirstate_exec_bit = (self.mode() as u32) & EXEC_BIT_MASK;
118 268 let fs_exec_bit = filesystem_metadata.mode() & EXEC_BIT_MASK;
119 269 dirstate_exec_bit != fs_exec_bit
120 270 }
121 271
122 272 /// Returns a `(state, mode, size, mtime)` tuple as for
123 273 /// `DirstateMapMethods::debug_iter`.
124 274 pub fn debug_tuple(&self) -> (u8, i32, i32, i32) {
125 (self.state.into(), self.mode, self.size, self.mtime)
275 let state = if self.flags.contains(Flags::ENTRYLESS_TREE_NODE) {
276 b' '
277 } else {
278 self.state().into()
279 };
280 (state, self.mode(), self.size(), self.mtime())
126 281 }
127 282
128 283 pub fn mtime_is_ambiguous(&self, now: i32) -> bool {
129 self.state == EntryState::Normal && self.mtime == now
284 self.state() == EntryState::Normal && self.mtime() == now
130 285 }
131 286
132 287 pub fn clear_ambiguous_mtime(&mut self, now: i32) -> bool {
133 288 let ambiguous = self.mtime_is_ambiguous(now);
134 289 if ambiguous {
135 290 // The file was last modified "simultaneously" with the current
136 291 // write to dirstate (i.e. within the same second for file-
137 292 // systems with a granularity of 1 sec). This commonly happens
138 293 // for at least a couple of files on 'update'.
139 294 // The user could change the file without changing its size
140 295 // within the same second. Invalidate the file's mtime in
141 296 // dirstate, forcing future 'status' calls to compare the
142 297 // contents of the file if the size is the same. This prevents
143 298 // mistakenly treating such files as clean.
144 299 self.clear_mtime()
145 300 }
146 301 ambiguous
147 302 }
148 303
149 304 pub fn clear_mtime(&mut self) {
150 305 self.mtime = -1;
151 306 }
152 307 }
153 308
154 309 impl EntryState {
155 310 pub fn is_tracked(self) -> bool {
156 311 use EntryState::*;
157 312 match self {
158 313 Normal | Added | Merged => true,
159 314 Removed => false,
160 315 }
161 316 }
162 317 }
163 318
164 319 impl TryFrom<u8> for EntryState {
165 320 type Error = HgError;
166 321
167 322 fn try_from(value: u8) -> Result<Self, Self::Error> {
168 323 match value {
169 324 b'n' => Ok(EntryState::Normal),
170 325 b'a' => Ok(EntryState::Added),
171 326 b'r' => Ok(EntryState::Removed),
172 327 b'm' => Ok(EntryState::Merged),
173 328 _ => Err(HgError::CorruptedRepository(format!(
174 329 "Incorrect dirstate entry state {}",
175 330 value
176 331 ))),
177 332 }
178 333 }
179 334 }
180 335
181 336 impl Into<u8> for EntryState {
182 337 fn into(self) -> u8 {
183 338 match self {
184 339 EntryState::Normal => b'n',
185 340 EntryState::Added => b'a',
186 341 EntryState::Removed => b'r',
187 342 EntryState::Merged => b'm',
188 343 }
189 344 }
190 345 }
General Comments 0
You need to be logged in to leave comments. Login now