tests/test-tags.t
changeset 46495 5aac1a1a5beb
parent 46314 95a615dd77bf
child 46654 9ea6b75b4a95
equal deleted inserted replaced
46494:d67732a4b58a 46495:5aac1a1a5beb
   102   .hg/cache/hgtagsfnodes1: size=48
   102   .hg/cache/hgtagsfnodes1: size=48
   103   0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
   103   0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
   104   0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
   104   0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
   105   0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
   105   0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
   106   $ hg debugtagscache
   106   $ hg debugtagscache
   107   0 acb14030fe0a21b60322c440ad2d20cf7685a376 missing/invalid
   107   0 acb14030fe0a21b60322c440ad2d20cf7685a376 missing
   108   1 b9154636be938d3d431e75a7c906504a079bfe07 26b7b4a773e09ee3c52f510e19e05e1ff966d859
   108   1 b9154636be938d3d431e75a7c906504a079bfe07 26b7b4a773e09ee3c52f510e19e05e1ff966d859
   109 
   109 
   110 Repeat with cold tag cache:
   110 Repeat with cold tag cache:
   111 
   111 
   112   $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
   112   $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
   379   ...     fp.seek(-10, os.SEEK_END) and None
   379   ...     fp.seek(-10, os.SEEK_END) and None
   380   ...     fp.truncate() and None
   380   ...     fp.truncate() and None
   381 
   381 
   382   $ hg debugtagscache | tail -2
   382   $ hg debugtagscache | tail -2
   383   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   383   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   384   5 8dbfe60eff306a54259cfe007db9e330e7ecf866 missing/invalid
   384   5 8dbfe60eff306a54259cfe007db9e330e7ecf866 missing
   385   $ hg tags
   385   $ hg tags
   386   tip                                5:8dbfe60eff30
   386   tip                                5:8dbfe60eff30
   387   bar                                1:78391a272241
   387   bar                                1:78391a272241
   388   $ hg debugtagscache | tail -2
   388   $ hg debugtagscache | tail -2
   389   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   389   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   390   5 8dbfe60eff306a54259cfe007db9e330e7ecf866 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   390   5 8dbfe60eff306a54259cfe007db9e330e7ecf866 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   391 
   391 
       
   392 If the 4 bytes of node hash for a record don't match an existing node, the entry
       
   393 is flagged as invalid.
       
   394 
       
   395   >>> import os
       
   396   >>> with open(".hg/cache/hgtagsfnodes1", "rb+") as fp:
       
   397   ...     fp.seek(-24, os.SEEK_END) and None
       
   398   ...     fp.write(b'\xde\xad') and None
       
   399 
       
   400   $ f --size --hexdump .hg/cache/hgtagsfnodes1
       
   401   .hg/cache/hgtagsfnodes1: size=144
       
   402   0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
       
   403   0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
       
   404   0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
       
   405   0030: 7a 94 12 77 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |z..w.....1....B(|
       
   406   0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.|
       
   407   0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..|
       
   408   0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(|
       
   409   0070: 78 ee 5a 2d ad bc 94 3d de ad e6 0e 0c 04 f2 a8 |x.Z-...=........|
       
   410   0080: af 31 de 17 fa b7 42 28 78 ee 5a 2d ad bc 94 3d |.1....B(x.Z-...=|
       
   411 
       
   412   $ hg debugtagscache | tail -2
       
   413   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
       
   414   5 8dbfe60eff306a54259cfe007db9e330e7ecf866 invalid
       
   415 
       
   416   $ hg tags
       
   417   tip                                5:8dbfe60eff30
       
   418   bar                                1:78391a272241
       
   419 
   392 #if unix-permissions no-root
   420 #if unix-permissions no-root
   393 Errors writing to .hgtags fnodes cache are silently ignored
   421 Errors writing to .hgtags fnodes cache are silently ignored
   394 
   422 
   395   $ echo dummy2 > foo
   423   $ echo dummy2 > foo
   396   $ hg commit -m throwaway2
   424   $ hg commit -m throwaway2
   403   bar                                1:78391a272241
   431   bar                                1:78391a272241
   404 
   432 
   405   $ hg blackbox -l 6
   433   $ hg blackbox -l 6
   406   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
   434   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
   407   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> couldn't write cache/hgtagsfnodes1: [Errno *] * (glob)
   435   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> couldn't write cache/hgtagsfnodes1: [Errno *] * (glob)
   408   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 3/4 cache hits/lookups in * seconds (glob)
   436   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/4 cache hits/lookups in * seconds (glob)
   409   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
   437   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
   410   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
   438   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
   411   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
   439   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
   412 
   440 
   413   $ chmod a+w .hg/cache/hgtagsfnodes1
   441   $ chmod a+w .hg/cache/hgtagsfnodes1
   418   bar                                1:78391a272241
   446   bar                                1:78391a272241
   419 
   447 
   420   $ hg blackbox -l 6
   448   $ hg blackbox -l 6
   421   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
   449   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
   422   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing 24 bytes to cache/hgtagsfnodes1
   450   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing 24 bytes to cache/hgtagsfnodes1
   423   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 3/4 cache hits/lookups in * seconds (glob)
   451   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/4 cache hits/lookups in * seconds (glob)
   424   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
   452   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
   425   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
   453   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
   426   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
   454   1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
   427 
   455 
   428   $ f --size .hg/cache/hgtagsfnodes1
   456   $ f --size .hg/cache/hgtagsfnodes1