tests/test-branches.t
changeset 51530 fc710c993ec9
parent 51521 0d4a6ab3c8da
child 51531 f85f23f1479b
equal deleted inserted replaced
51529:4141d12de073 51530:fc710c993ec9
   865   .hg/cache/rbc-revs-v1: size=8
   865   .hg/cache/rbc-revs-v1: size=8
   866   $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1
   866   $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1
   867   $ f --size .hg/cache/rbc-revs*
   867   $ f --size .hg/cache/rbc-revs*
   868   .hg/cache/rbc-revs-v1: size=120
   868   .hg/cache/rbc-revs-v1: size=120
   869   $ hg log -r 'branch(.)' -T '{rev} ' --debug
   869   $ hg log -r 'branch(.)' -T '{rev} ' --debug
   870   history modification detected - truncating revision branch cache to revision 13
   870   history modification detected - truncating revision branch cache to revision * (glob)
   871   history modification detected - truncating revision branch cache to revision 1
   871   history modification detected - truncating revision branch cache to revision 1
   872   3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8
   872   3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8
   873   $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
   873   $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
   874   5
   874   5
   875   truncating cache/rbc-revs-v1 to 104
   875   truncating cache/rbc-revs-v1 to 104
   887 
   887 
   888 update after rollback - the cache will be correct but rbc-names will will still
   888 update after rollback - the cache will be correct but rbc-names will will still
   889 contain the branch name even though it no longer is used
   889 contain the branch name even though it no longer is used
   890   $ hg up -qr '.^'
   890   $ hg up -qr '.^'
   891   $ hg rollback -qf
   891   $ hg rollback -qf
   892   $ f --size --hexdump .hg/cache/rbc-*
   892   $ f --size .hg/cache/rbc-names-*
   893   .hg/cache/rbc-names-v1: size=111
   893   .hg/cache/rbc-names-v1: size=111
   894   0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
   894   $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
   895   0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
   895   $ f --size .hg/cache/rbc-revs-*
   896   0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
       
   897   0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
       
   898   0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
       
   899   0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 00 69 2d 77 |ranches.m.md.i-w|
       
   900   0060: 69 6c 6c 2d 72 65 67 72 65 74 2d 74 68 69 73    |ill-regret-this|
       
   901   .hg/cache/rbc-revs-v1: size=160
   896   .hg/cache/rbc-revs-v1: size=160
   902   0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
       
   903   0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
       
   904   0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
       
   905   0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
       
   906   0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
       
   907   0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
       
   908   0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
       
   909   0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
       
   910   0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
       
   911   0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
       
   912 
   897 
   913 cache is updated/truncated when stripping - it is thus very hard to get in a
   898 cache is updated/truncated when stripping - it is thus very hard to get in a
   914 situation where the cache is out of sync and the hash check detects it
   899 situation where the cache is out of sync and the hash check detects it
   915   $ hg --config extensions.strip= strip -r tip --nob
   900   $ hg --config extensions.strip= strip -r tip --nob
   916   $ f --size .hg/cache/rbc-revs*
   901   $ f --size .hg/cache/rbc-revs*
   919 cache is rebuilt when corruption is detected
   904 cache is rebuilt when corruption is detected
   920   $ echo > .hg/cache/rbc-names-v1
   905   $ echo > .hg/cache/rbc-names-v1
   921   $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
   906   $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
   922   referenced branch names not found - rebuilding revision branch cache from scratch
   907   referenced branch names not found - rebuilding revision branch cache from scratch
   923   8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40
   908   8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40
   924   $ f --size --hexdump .hg/cache/rbc-*
   909   $ f --size .hg/cache/rbc-names-*
   925   .hg/cache/rbc-names-v1: size=84
   910   .hg/cache/rbc-names-v1: size=84
   926   0000: 62 00 61 00 63 00 61 20 62 72 61 6e 63 68 20 6e |b.a.c.a branch n|
   911   $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
   927   0010: 61 6d 65 20 6d 75 63 68 20 6c 6f 6e 67 65 72 20 |ame much longer |
   912   [1]
   928   0020: 74 68 61 6e 20 74 68 65 20 64 65 66 61 75 6c 74 |than the default|
   913   $ f --size .hg/cache/rbc-revs-*
   929   0030: 20 6a 75 73 74 69 66 69 63 61 74 69 6f 6e 20 75 | justification u|
       
   930   0040: 73 65 64 20 62 79 20 62 72 61 6e 63 68 65 73 00 |sed by branches.|
       
   931   0050: 6d 00 6d 64                                     |m.md|
       
   932   .hg/cache/rbc-revs-v1: size=152
   914   .hg/cache/rbc-revs-v1: size=152
   933   0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
       
   934   0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
       
   935   0020: 00 00 00 00 00 00 00 00 d8 cb c6 1d 00 00 00 01 |................|
       
   936   0030: 58 97 36 a2 00 00 00 02 10 ff 58 95 00 00 00 03 |X.6.......X.....|
       
   937   0040: ee bb 94 44 00 00 00 00 5f 40 61 bb 00 00 00 00 |...D...._@a.....|
       
   938   0050: bf be 84 1b 00 00 00 00 d3 f1 63 45 80 00 00 00 |..........cE....|
       
   939   0060: e3 d4 9c 05 80 00 00 00 e2 3b 55 05 00 00 00 00 |.........;U.....|
       
   940   0070: f8 94 c2 56 80 00 00 02 f3 44 76 37 00 00 00 04 |...V.....Dv7....|
       
   941   0080: a5 8c a5 d3 00 00 00 04 df 34 3b 0d 00 00 00 04 |.........4;.....|
       
   942   0090: c9 14 c9 9f 00 00 00 05                         |........|
       
   943 
   915 
   944 Test that cache files are created and grows correctly:
   916 Test that cache files are created and grows correctly:
   945 
   917 
   946   $ rm .hg/cache/rbc*
   918   $ rm .hg/cache/rbc*
   947   $ hg log -r "5 & branch(5)" -T "{rev}\n"
   919   $ hg log -r "5 & branch(5)" -T "{rev}\n"
   948   5
   920   5
   949   $ f --size --hexdump .hg/cache/rbc-*
   921   $ f --size .hg/cache/rbc-*
   950   .hg/cache/rbc-names-v1: size=1
   922   .hg/cache/rbc-names-v1: size=1
   951   0000: 61                                              |a|
       
   952   .hg/cache/rbc-revs-v1: size=48
   923   .hg/cache/rbc-revs-v1: size=48
   953   0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
       
   954   0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
       
   955   0020: 00 00 00 00 00 00 00 00 d8 cb c6 1d 00 00 00 00 |................|
       
   956 
   924 
   957   $ cd ..
   925   $ cd ..
   958 
   926 
   959 Test for multiple incorrect branch cache entries:
   927 Test for multiple incorrect branch cache entries:
   960 
   928 
   965   $ echo >> f
   933   $ echo >> f
   966   $ hg ci -Amf
   934   $ hg ci -Amf
   967   $ hg branch -q branch
   935   $ hg branch -q branch
   968   $ hg ci -Amf
   936   $ hg ci -Amf
   969 
   937 
   970   $ f --size --hexdump .hg/cache/rbc-*
   938 #if v2
   971   .hg/cache/rbc-names-v1: size=14
   939 
   972   0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68       |default.branch|
   940   $ f --size --sha256 .hg/cache/rbc-*
   973   .hg/cache/rbc-revs-v1: size=24
   941   .hg/cache/rbc-names-v1: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
   974   0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......|
   942   .hg/cache/rbc-revs-v1: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
   975   0010: 56 46 78 69 00 00 00 01                         |VFxi....|
   943 
   976   $ : > .hg/cache/rbc-revs-v1
   944   $ : > .hg/cache/rbc-revs-v1
   977 
   945 
   978 No superfluous rebuilding of cache:
   946 No superfluous rebuilding of cache:
   979   $ hg log -r "branch(null)&branch(branch)" --debug
   947   $ hg log -r "branch(null)&branch(branch)" --debug
   980   $ f --size --hexdump .hg/cache/rbc-*
   948   $ f --size --sha256 .hg/cache/rbc-*
   981   .hg/cache/rbc-names-v1: size=14
   949   .hg/cache/rbc-names-v1: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
   982   0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68       |default.branch|
   950   .hg/cache/rbc-revs-v1: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
   983   .hg/cache/rbc-revs-v1: size=24
   951 #endif
   984   0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......|
       
   985   0010: 56 46 78 69 00 00 00 01                         |VFxi....|
       
   986 
   952 
   987   $ cd ..
   953   $ cd ..
   988 
   954 
   989 Test to make sure that `--close-branch` only works on a branch head:
   955 Test to make sure that `--close-branch` only works on a branch head:
   990 --------------------------------------------------------------------
   956 --------------------------------------------------------------------