tests/test-tags.t
changeset 24737 b061a2049662
parent 24735 07200e3332a1
child 24759 d082c6ef9ec3
equal deleted inserted replaced
24736:f2fd087a75ef 24737:b061a2049662
     7   > EOF
     7   > EOF
     8 
     8 
     9 Helper functions:
     9 Helper functions:
    10 
    10 
    11   $ cacheexists() {
    11   $ cacheexists() {
    12   >   [ -f .hg/cache/tags ] && echo "tag cache exists" || echo "no tag cache"
    12   >   [ -f .hg/cache/tags-visible ] && echo "tag cache exists" || echo "no tag cache"
    13   > }
    13   > }
    14 
    14 
    15   $ fnodescacheexists() {
    15   $ fnodescacheexists() {
    16   >   [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache"
    16   >   [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache"
    17   > }
    17   > }
    54   $ fnodescacheexists
    54   $ fnodescacheexists
    55   no fnodes cache
    55   no fnodes cache
    56 
    56 
    57 Try corrupting the cache
    57 Try corrupting the cache
    58 
    58 
    59   $ printf 'a b' > .hg/cache/tags
    59   $ printf 'a b' > .hg/cache/tags-visible
    60   $ hg identify
    60   $ hg identify
    61   acb14030fe0a tip
    61   acb14030fe0a tip
    62   $ cacheexists
    62   $ cacheexists
    63   tag cache exists
    63   tag cache exists
    64   $ fnodescacheexists
    64   $ fnodescacheexists
   100   0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
   100   0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
   101   0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
   101   0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
   102 
   102 
   103 Repeat with cold tag cache:
   103 Repeat with cold tag cache:
   104 
   104 
   105   $ rm -f .hg/cache/tags .hg/cache/hgtagsfnodes1
   105   $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1
   106   $ hg identify
   106   $ hg identify
   107   b9154636be93 tip
   107   b9154636be93 tip
   108 
   108 
   109   $ fnodescacheexists
   109   $ fnodescacheexists
   110   fnodes cache exists
   110   fnodes cache exists
   115   0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
   115   0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
   116 
   116 
   117 And again, but now unable to write tag cache:
   117 And again, but now unable to write tag cache:
   118 
   118 
   119 #if unix-permissions
   119 #if unix-permissions
   120   $ rm -f .hg/cache/tags .hg/cache/hgtagsfnodes1
   120   $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1
   121   $ chmod 555 .hg/cache
   121   $ chmod 555 .hg/cache
   122   $ hg identify
   122   $ hg identify
   123   b9154636be93 tip
   123   b9154636be93 tip
   124   $ chmod 755 .hg/cache
   124   $ chmod 755 .hg/cache
   125 #endif
   125 #endif
   126 
   126 
   127 Tag cache debug info written to blackbox log
   127 Tag cache debug info written to blackbox log
   128 
   128 
   129   $ rm -f .hg/cache/tags .hg/cache/hgtagsfnodes1
   129   $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1
   130   $ hg identify
   130   $ hg identify
   131   b9154636be93 tip
   131   b9154636be93 tip
   132   $ hg blackbox -l 5
   132   $ hg blackbox -l 5
   133   1970/01/01 00:00:00 bob> identify
   133   1970/01/01 00:00:00 bob> identify
   134   1970/01/01 00:00:00 bob> writing 48 bytes to cache/hgtagsfnodes1
   134   1970/01/01 00:00:00 bob> writing 48 bytes to cache/hgtagsfnodes1
   136   1970/01/01 00:00:00 bob> writing tags cache file with 1 heads and 1 tags
   136   1970/01/01 00:00:00 bob> writing tags cache file with 1 heads and 1 tags
   137   1970/01/01 00:00:00 bob> identify exited 0 after ?.?? seconds (glob)
   137   1970/01/01 00:00:00 bob> identify exited 0 after ?.?? seconds (glob)
   138 
   138 
   139 Failure to acquire lock results in no write
   139 Failure to acquire lock results in no write
   140 
   140 
   141   $ rm -f .hg/cache/tags .hg/cache/hgtagsfnodes1
   141   $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1
   142   $ echo 'foo:1' > .hg/wlock
   142   $ echo 'foo:1' > .hg/wlock
   143   $ hg identify
   143   $ hg identify
   144   b9154636be93 tip
   144   b9154636be93 tip
   145   $ hg blackbox -l 5
   145   $ hg blackbox -l 5
   146   1970/01/01 00:00:00 bob> identify
   146   1970/01/01 00:00:00 bob> identify
   152   $ fnodescacheexists
   152   $ fnodescacheexists
   153   no fnodes cache
   153   no fnodes cache
   154 
   154 
   155   $ rm .hg/wlock
   155   $ rm .hg/wlock
   156 
   156 
   157   $ rm -f .hg/cache/tags .hg/cache/hgtagsfnodes1
   157   $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1
   158   $ hg identify
   158   $ hg identify
   159   b9154636be93 tip
   159   b9154636be93 tip
   160 
   160 
   161 Create a branch:
   161 Create a branch:
   162 
   162 
   309   rev 4: .hgtags:
   309   rev 4: .hgtags:
   310   bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
   310   bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
   311 
   311 
   312 Dump cache:
   312 Dump cache:
   313 
   313 
   314   $ cat .hg/cache/tags
   314   $ cat .hg/cache/tags-visible
   315   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   315   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   316   3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
   316   3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
   317   2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   317   2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   318   
   318   
   319   bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
   319   bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
   354 
   354 
   355   $ echo dummy2 > foo
   355   $ echo dummy2 > foo
   356   $ hg commit -m throwaway2
   356   $ hg commit -m throwaway2
   357 
   357 
   358   $ chmod a-w .hg/cache/hgtagsfnodes1
   358   $ chmod a-w .hg/cache/hgtagsfnodes1
   359   $ rm -f .hg/cache/tags
   359   $ rm -f .hg/cache/tags-visible
   360 
   360 
   361   $ hg tags
   361   $ hg tags
   362   tip                                6:b968051b5cf3
   362   tip                                6:b968051b5cf3
   363   bar                                1:78391a272241
   363   bar                                1:78391a272241
   364 
   364 
   370   1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob)
   370   1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob)
   371 
   371 
   372   $ chmod a+w .hg/cache/hgtagsfnodes1
   372   $ chmod a+w .hg/cache/hgtagsfnodes1
   373 #endif
   373 #endif
   374 
   374 
   375   $ rm -f .hg/cache/tags
   375   $ rm -f .hg/cache/tags-visible
   376   $ hg tags
   376   $ hg tags
   377   tip                                6:b968051b5cf3
   377   tip                                6:b968051b5cf3
   378   bar                                1:78391a272241
   378   bar                                1:78391a272241
   379 
   379 
   380   $ hg blackbox -l 5
   380   $ hg blackbox -l 5
   522   $ hg --config extensions.mq= strip 4
   522   $ hg --config extensions.mq= strip 4
   523   saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
   523   saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
   524   $ hg tags                  # partly stale
   524   $ hg tags                  # partly stale
   525   tip                                4:735c3ca72986
   525   tip                                4:735c3ca72986
   526   bar                                0:bbd179dfa0a7
   526   bar                                0:bbd179dfa0a7
   527   $ rm -f .hg/cache/tags
   527   $ rm -f .hg/cache/tags-visible
   528   $ hg tags                  # cold cache
   528   $ hg tags                  # cold cache
   529   tip                                4:735c3ca72986
   529   tip                                4:735c3ca72986
   530   bar                                0:bbd179dfa0a7
   530   bar                                0:bbd179dfa0a7
   531 
   531 
   532 Test tag rank with 3 heads:
   532 Test tag rank with 3 heads: