tests/test-remotefilelog-repack.t
changeset 40495 3a333a582d7b
child 40502 6d64e2abe8d3
equal deleted inserted replaced
40494:9aeb9e2d28a7 40495:3a333a582d7b
       
     1   $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
       
     2   $ export PYTHONPATH
       
     3 
       
     4   $ . "$TESTDIR/remotefilelog-library.sh"
       
     5 
       
     6   $ hginit master
       
     7   $ cd master
       
     8   $ cat >> .hg/hgrc <<EOF
       
     9   > [remotefilelog]
       
    10   > server=True
       
    11   > serverexpiration=-1
       
    12   > EOF
       
    13   $ echo x > x
       
    14   $ hg commit -qAm x
       
    15   $ echo x >> x
       
    16   $ hg commit -qAm x2
       
    17   $ cd ..
       
    18 
       
    19   $ hgcloneshallow ssh://user@dummy/master shallow -q
       
    20   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
       
    21 
       
    22 # Set the prefetchdays config to zero so that all commits are prefetched
       
    23 # no matter what their creation date is.
       
    24   $ cd shallow
       
    25   $ cat >> .hg/hgrc <<EOF
       
    26   > [remotefilelog]
       
    27   > prefetchdays=0
       
    28   > EOF
       
    29   $ cd ..
       
    30 
       
    31 # Test that repack cleans up the old files and creates new packs
       
    32 
       
    33   $ cd shallow
       
    34   $ find $CACHEDIR | sort
       
    35   $TESTTMP/hgcache
       
    36   $TESTTMP/hgcache/master
       
    37   $TESTTMP/hgcache/master/11
       
    38   $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072
       
    39   $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/aee31534993a501858fb6dd96a065671922e7d51
       
    40   $TESTTMP/hgcache/repos
       
    41 
       
    42   $ hg repack
       
    43 
       
    44   $ find $CACHEDIR | sort
       
    45   $TESTTMP/hgcache
       
    46   $TESTTMP/hgcache/master
       
    47   $TESTTMP/hgcache/master/packs
       
    48   $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histidx
       
    49   $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histpack
       
    50   $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
       
    51   $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
       
    52   $TESTTMP/hgcache/master/packs/repacklock
       
    53   $TESTTMP/hgcache/repos
       
    54 
       
    55 # Test that the packs are readonly
       
    56   $ ls_l $CACHEDIR/master/packs
       
    57   -r--r--r--    1145 276d308429d0303762befa376788300f0310f90e.histidx
       
    58   -r--r--r--     172 276d308429d0303762befa376788300f0310f90e.histpack
       
    59   -r--r--r--    1074 8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
       
    60   -r--r--r--      69 8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
       
    61   -rw-r--r--       0 repacklock
       
    62 
       
    63 # Test that the data in the new packs is accessible
       
    64   $ hg cat -r . x
       
    65   x
       
    66   x
       
    67 
       
    68 # Test that adding new data and repacking it results in the loose data and the
       
    69 # old packs being combined.
       
    70 
       
    71   $ cd ../master
       
    72   $ echo x >> x
       
    73   $ hg commit -m x3
       
    74   $ cd ../shallow
       
    75   $ hg pull -q
       
    76   $ hg up -q tip
       
    77   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
       
    78 
       
    79   $ find $CACHEDIR -type f | sort
       
    80   $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
       
    81   $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histidx
       
    82   $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histpack
       
    83   $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
       
    84   $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
       
    85   $TESTTMP/hgcache/master/packs/repacklock
       
    86   $TESTTMP/hgcache/repos
       
    87 
       
    88 # First assert that with --packsonly, the loose object will be ignored:
       
    89 
       
    90   $ hg repack --packsonly
       
    91 
       
    92   $ find $CACHEDIR -type f | sort
       
    93   $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
       
    94   $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histidx
       
    95   $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histpack
       
    96   $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
       
    97   $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
       
    98   $TESTTMP/hgcache/master/packs/repacklock
       
    99   $TESTTMP/hgcache/repos
       
   100 
       
   101   $ hg repack --traceback
       
   102 
       
   103   $ find $CACHEDIR -type f | sort
       
   104   $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
       
   105   $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
       
   106   $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
       
   107   $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
       
   108   $TESTTMP/hgcache/master/packs/repacklock
       
   109   $TESTTMP/hgcache/repos
       
   110 
       
   111 # Verify all the file data is still available
       
   112   $ hg cat -r . x
       
   113   x
       
   114   x
       
   115   x
       
   116   $ hg cat -r '.^' x
       
   117   x
       
   118   x
       
   119 
       
   120 # Test that repacking again without new data does not delete the pack files
       
   121 # and did not change the pack names
       
   122   $ hg repack
       
   123   $ find $CACHEDIR -type f | sort
       
   124   $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
       
   125   $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
       
   126   $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
       
   127   $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
       
   128   $TESTTMP/hgcache/master/packs/repacklock
       
   129   $TESTTMP/hgcache/repos
       
   130 
       
   131 # Run two repacks at once
       
   132   $ hg repack --config "hooks.prerepack=sleep 3" &
       
   133   $ sleep 1
       
   134   $ hg repack
       
   135   skipping repack - another repack is already running
       
   136   $ hg debugwaitonrepack >/dev/null 2>&1
       
   137 
       
   138 # Run repack in the background
       
   139   $ cd ../master
       
   140   $ echo x >> x
       
   141   $ hg commit -m x4
       
   142   $ cd ../shallow
       
   143   $ hg pull -q
       
   144   $ hg up -q tip
       
   145   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
       
   146   $ find $CACHEDIR -type f | sort
       
   147   $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72
       
   148   $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
       
   149   $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
       
   150   $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
       
   151   $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
       
   152   $TESTTMP/hgcache/master/packs/repacklock
       
   153   $TESTTMP/hgcache/repos
       
   154 
       
   155   $ hg repack --background
       
   156   (running background repack)
       
   157   $ sleep 0.5
       
   158   $ hg debugwaitonrepack >/dev/null 2>&1
       
   159   $ find $CACHEDIR -type f | sort
       
   160   $TESTTMP/hgcache/master/packs/094b530486dad4427a0faf6bcbc031571b99ca24.histidx
       
   161   $TESTTMP/hgcache/master/packs/094b530486dad4427a0faf6bcbc031571b99ca24.histpack
       
   162   $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.dataidx
       
   163   $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
       
   164   $TESTTMP/hgcache/master/packs/repacklock
       
   165   $TESTTMP/hgcache/repos
       
   166 
       
   167 # Test debug commands
       
   168 
       
   169   $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack
       
   170   $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
       
   171   x:
       
   172   Node          Delta Base    Delta Length  Blob Size
       
   173   1bb2e6237e03  000000000000  8             8
       
   174   d4a3ed9310e5  1bb2e6237e03  12            6
       
   175   aee31534993a  d4a3ed9310e5  12            4
       
   176   
       
   177   Total:                      32            18        (77.8% bigger)
       
   178   $ hg debugdatapack --long $TESTTMP/hgcache/master/packs/*.datapack
       
   179   $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
       
   180   x:
       
   181   Node                                      Delta Base                                Delta Length  Blob Size
       
   182   1bb2e6237e035c8f8ef508e281f1ce075bc6db72  0000000000000000000000000000000000000000  8             8
       
   183   d4a3ed9310e5bd9887e3bf779da5077efab28216  1bb2e6237e035c8f8ef508e281f1ce075bc6db72  12            6
       
   184   aee31534993a501858fb6dd96a065671922e7d51  d4a3ed9310e5bd9887e3bf779da5077efab28216  12            4
       
   185   
       
   186   Total:                                                                              32            18        (77.8% bigger)
       
   187   $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack --node d4a3ed9310e5bd9887e3bf779da5077efab28216
       
   188   $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
       
   189   
       
   190   x
       
   191   Node                                      Delta Base                                Delta SHA1                                Delta Length
       
   192   d4a3ed9310e5bd9887e3bf779da5077efab28216  1bb2e6237e035c8f8ef508e281f1ce075bc6db72  77029ab56e83ea2115dd53ff87483682abe5d7ca  12
       
   193   Node                                      Delta Base                                Delta SHA1                                Delta Length
       
   194   1bb2e6237e035c8f8ef508e281f1ce075bc6db72  0000000000000000000000000000000000000000  7ca8c71a64f7b56380e77573da2f7a5fdd2ecdb5  8
       
   195   $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx
       
   196   
       
   197   x
       
   198   Node          P1 Node       P2 Node       Link Node     Copy From
       
   199   1bb2e6237e03  d4a3ed9310e5  000000000000  0b03bbc9e1e7  
       
   200   d4a3ed9310e5  aee31534993a  000000000000  421535db10b6  
       
   201   aee31534993a  1406e7411862  000000000000  a89d614e2364  
       
   202   1406e7411862  000000000000  000000000000  b292c1e3311f  
       
   203 
       
   204 # Test copy tracing from a pack
       
   205   $ cd ../master
       
   206   $ hg mv x y
       
   207   $ hg commit -m 'move x to y'
       
   208   $ cd ../shallow
       
   209   $ hg pull -q
       
   210   $ hg up -q tip
       
   211   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
       
   212   $ hg repack
       
   213   $ hg log -f y -T '{desc}\n'
       
   214   move x to y
       
   215   x4
       
   216   x3
       
   217   x2
       
   218   x
       
   219 
       
   220 # Test copy trace across rename and back
       
   221   $ cp -R $TESTTMP/hgcache/master/packs $TESTTMP/backuppacks
       
   222   $ cd ../master
       
   223   $ hg mv y x
       
   224   $ hg commit -m 'move y back to x'
       
   225   $ hg revert -r 0 x
       
   226   $ mv x y
       
   227   $ hg add y
       
   228   $ echo >> y
       
   229   $ hg revert x
       
   230   $ hg commit -m 'add y back without metadata'
       
   231   $ cd ../shallow
       
   232   $ hg pull -q
       
   233   $ hg up -q tip
       
   234   2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over * (glob)
       
   235   $ hg repack
       
   236   $ ls $TESTTMP/hgcache/master/packs
       
   237   e8fdf7ae22b772dcc291f905b9c6e5f381d28739.dataidx
       
   238   e8fdf7ae22b772dcc291f905b9c6e5f381d28739.datapack
       
   239   ebbd7411e00456c0eec8d1150a77e2b3ef490f3f.histidx
       
   240   ebbd7411e00456c0eec8d1150a77e2b3ef490f3f.histpack
       
   241   repacklock
       
   242   $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx
       
   243   
       
   244   x
       
   245   Node          P1 Node       P2 Node       Link Node     Copy From
       
   246   cd410a44d584  577959738234  000000000000  609547eda446  y
       
   247   1bb2e6237e03  d4a3ed9310e5  000000000000  0b03bbc9e1e7  
       
   248   d4a3ed9310e5  aee31534993a  000000000000  421535db10b6  
       
   249   aee31534993a  1406e7411862  000000000000  a89d614e2364  
       
   250   1406e7411862  000000000000  000000000000  b292c1e3311f  
       
   251   
       
   252   y
       
   253   Node          P1 Node       P2 Node       Link Node     Copy From
       
   254   577959738234  1bb2e6237e03  000000000000  c7faf2fc439a  x
       
   255   21f46f2721e7  000000000000  000000000000  d6868642b790  
       
   256   $ hg strip -r '.^'
       
   257   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   258   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob)
       
   259   $ hg -R ../master strip -r '.^'
       
   260   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   261   saved backup bundle to $TESTTMP/master/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob)
       
   262 
       
   263   $ rm -rf $TESTTMP/hgcache/master/packs
       
   264   $ cp -R $TESTTMP/backuppacks $TESTTMP/hgcache/master/packs
       
   265 
       
   266 # Test repacking datapack without history
       
   267   $ rm -rf $CACHEDIR/master/packs/*hist*
       
   268   $ hg repack
       
   269   $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack
       
   270   $TESTTMP/hgcache/master/packs/a8d86ff8e1a11a77a85f5fea567f56a757583eda:
       
   271   x:
       
   272   Node          Delta Base    Delta Length  Blob Size
       
   273   1bb2e6237e03  000000000000  8             8
       
   274   d4a3ed9310e5  1bb2e6237e03  12            6
       
   275   aee31534993a  d4a3ed9310e5  12            4
       
   276   
       
   277   Total:                      32            18        (77.8% bigger)
       
   278   y:
       
   279   Node          Delta Base    Delta Length  Blob Size
       
   280   577959738234  000000000000  70            8
       
   281   
       
   282   Total:                      70            8         (775.0% bigger)
       
   283 
       
   284   $ hg cat -r ".^" x
       
   285   x
       
   286   x
       
   287   x
       
   288   x
       
   289 
       
   290 Incremental repack
       
   291   $ rm -rf $CACHEDIR/master/packs/*
       
   292   $ cat >> .hg/hgrc <<EOF
       
   293   > [remotefilelog]
       
   294   > data.generations=60
       
   295   >   150
       
   296   > fetchpacks=True
       
   297   > EOF
       
   298 
       
   299 Single pack - repack does nothing
       
   300   $ hg prefetch -r 0
       
   301   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   302   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
       
   303   -r--r--r--      59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
       
   304   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
       
   305   -r--r--r--      90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
       
   306   $ hg repack --incremental
       
   307   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
       
   308   -r--r--r--      59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
       
   309   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
       
   310   -r--r--r--      90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
       
   311 
       
   312 3 gen1 packs, 1 gen0 pack - packs 3 gen1 into 1
       
   313   $ hg prefetch -r 1
       
   314   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   315   $ hg prefetch -r 2
       
   316   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   317   $ hg prefetch -r 3
       
   318   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   319   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
       
   320   -r--r--r--      59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
       
   321   -r--r--r--      65 6c499d21350d79f92fd556b4b7a902569d88e3c9.datapack
       
   322   -r--r--r--      61 817d294043bd21a3de01f807721971abe45219ce.datapack
       
   323   -r--r--r--      63 ff45add45ab3f59c4f75efc6a087d86c821219d6.datapack
       
   324   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
       
   325   -r--r--r--     254 077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
       
   326   -r--r--r--     336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
       
   327   -r--r--r--     172 276d308429d0303762befa376788300f0310f90e.histpack
       
   328   -r--r--r--      90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
       
   329 
       
   330 For the data packs, setting the limit for the repackmaxpacksize to be 64 such
       
   331 that data pack with size 65 is more than the limit. This effectively ensures
       
   332 that no generation has 3 packs and therefore, no packs are chosen for the
       
   333 incremental repacking. As for the history packs, setting repackmaxpacksize to be
       
   334 0 which should always result in no repacking.
       
   335   $ hg repack --incremental --config remotefilelog.data.repackmaxpacksize=64 \
       
   336   > --config remotefilelog.history.repackmaxpacksize=0
       
   337   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
       
   338   -r--r--r--      59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
       
   339   -r--r--r--      65 6c499d21350d79f92fd556b4b7a902569d88e3c9.datapack
       
   340   -r--r--r--      61 817d294043bd21a3de01f807721971abe45219ce.datapack
       
   341   -r--r--r--      63 ff45add45ab3f59c4f75efc6a087d86c821219d6.datapack
       
   342   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
       
   343   -r--r--r--     254 077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
       
   344   -r--r--r--     336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
       
   345   -r--r--r--     172 276d308429d0303762befa376788300f0310f90e.histpack
       
   346   -r--r--r--      90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
       
   347 
       
   348 Setting limit for the repackmaxpacksize to be the size of the biggest pack file
       
   349 which ensures that it is effectively ignored in the incremental repacking.
       
   350   $ hg repack --incremental --config remotefilelog.data.repackmaxpacksize=65 \
       
   351   > --config remotefilelog.history.repackmaxpacksize=336
       
   352   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
       
   353   -r--r--r--      59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
       
   354   -r--r--r--     225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
       
   355   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
       
   356   -r--r--r--     336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
       
   357 
       
   358 1 gen3 pack, 1 gen0 pack - does nothing
       
   359   $ hg repack --incremental
       
   360   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
       
   361   -r--r--r--      59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
       
   362   -r--r--r--     225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
       
   363   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
       
   364   -r--r--r--     336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
       
   365 
       
   366 Pull should run background repack
       
   367   $ cat >> .hg/hgrc <<EOF
       
   368   > [remotefilelog]
       
   369   > backgroundrepack=True
       
   370   > EOF
       
   371   $ clearcache
       
   372   $ hg prefetch -r 0
       
   373   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   374   $ hg prefetch -r 1
       
   375   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   376   $ hg prefetch -r 2
       
   377   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   378   $ hg prefetch -r 3
       
   379   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   380   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
       
   381   -r--r--r--      59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
       
   382   -r--r--r--      65 6c499d21350d79f92fd556b4b7a902569d88e3c9.datapack
       
   383   -r--r--r--      61 817d294043bd21a3de01f807721971abe45219ce.datapack
       
   384   -r--r--r--      63 ff45add45ab3f59c4f75efc6a087d86c821219d6.datapack
       
   385   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
       
   386   -r--r--r--     254 077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
       
   387   -r--r--r--     336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
       
   388   -r--r--r--     172 276d308429d0303762befa376788300f0310f90e.histpack
       
   389   -r--r--r--      90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
       
   390 
       
   391   $ hg pull
       
   392   pulling from ssh://user@dummy/master
       
   393   searching for changes
       
   394   no changes found
       
   395   (running background incremental repack)
       
   396   $ sleep 0.5
       
   397   $ hg debugwaitonrepack >/dev/null 2>&1
       
   398   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
       
   399   -r--r--r--      59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
       
   400   -r--r--r--     225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
       
   401   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
       
   402   -r--r--r--     336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
       
   403 
       
   404 Test environment variable resolution
       
   405   $ CACHEPATH=$TESTTMP/envcache hg prefetch --config 'remotefilelog.cachepath=$CACHEPATH'
       
   406   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   407   $ find $TESTTMP/envcache | sort
       
   408   $TESTTMP/envcache
       
   409   $TESTTMP/envcache/master
       
   410   $TESTTMP/envcache/master/packs
       
   411   $TESTTMP/envcache/master/packs/54afbfda203716c1aa2636029ccc0df18165129e.dataidx
       
   412   $TESTTMP/envcache/master/packs/54afbfda203716c1aa2636029ccc0df18165129e.datapack
       
   413   $TESTTMP/envcache/master/packs/dcebd8e8d4d97ee88e40dd8f92d8678c10e1a3ad.histidx
       
   414   $TESTTMP/envcache/master/packs/dcebd8e8d4d97ee88e40dd8f92d8678c10e1a3ad.histpack
       
   415 
       
   416 Test local remotefilelog blob is correct when based on a pack
       
   417   $ hg prefetch -r .
       
   418   1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   419   $ echo >> y
       
   420   $ hg commit -m y2
       
   421   $ hg debugremotefilelog .hg/store/data/95cb0bfd2977c761298d9624e4b4d4c72a39974a/b70860edba4f8242a1d52f2a94679dd23cb76808
       
   422   size: 9 bytes
       
   423   path: .hg/store/data/95cb0bfd2977c761298d9624e4b4d4c72a39974a/b70860edba4f8242a1d52f2a94679dd23cb76808 
       
   424   key: b70860edba4f 
       
   425   
       
   426           node =>           p1            p2      linknode     copyfrom
       
   427   b70860edba4f => 577959738234  000000000000  08d3fbc98c48  
       
   428   577959738234 => 1bb2e6237e03  000000000000  c7faf2fc439a  x
       
   429   1bb2e6237e03 => d4a3ed9310e5  000000000000  0b03bbc9e1e7  
       
   430   d4a3ed9310e5 => aee31534993a  000000000000  421535db10b6  
       
   431   aee31534993a => 1406e7411862  000000000000  a89d614e2364  
       
   432   1406e7411862 => 000000000000  000000000000  b292c1e3311f  
       
   433 
       
   434 Test limiting the max delta chain length
       
   435   $ hg repack --config packs.maxchainlen=1
       
   436   $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.dataidx
       
   437   $TESTTMP/hgcache/master/packs/a2731c9a16403457b67337a620931797fce8c821:
       
   438   x:
       
   439   Node          Delta Base    Delta Length  Blob Size
       
   440   1bb2e6237e03  000000000000  8             8
       
   441   d4a3ed9310e5  1bb2e6237e03  12            6
       
   442   aee31534993a  000000000000  4             4
       
   443   1406e7411862  aee31534993a  12            2
       
   444   
       
   445   Total:                      36            20        (80.0% bigger)
       
   446   y:
       
   447   Node          Delta Base    Delta Length  Blob Size
       
   448   577959738234  000000000000  8             8
       
   449   
       
   450   Total:                      8             8         (0.0% bigger)
       
   451 
       
   452 Test huge pack cleanup using different values of packs.maxpacksize:
       
   453   $ hg repack --incremental --debug
       
   454   $ hg repack --incremental --debug --config packs.maxpacksize=512
       
   455   removing oversize packfile $TESTTMP/hgcache/master/packs/a2731c9a16403457b67337a620931797fce8c821.datapack (365 bytes)
       
   456   removing oversize packfile $TESTTMP/hgcache/master/packs/a2731c9a16403457b67337a620931797fce8c821.dataidx (1.21 KB)
       
   457 
       
   458 Do a repack where the new pack reuses a delta from the old pack
       
   459   $ clearcache
       
   460   $ hg prefetch -r '2::3'
       
   461   2 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   462   $ hg repack
       
   463   $ hg debugdatapack $CACHEDIR/master/packs/*.datapack
       
   464   $TESTTMP/hgcache/master/packs/abf210f6c3aa4dd0ecc7033633ad73591be16c95:
       
   465   x:
       
   466   Node          Delta Base    Delta Length  Blob Size
       
   467   1bb2e6237e03  000000000000  8             8
       
   468   d4a3ed9310e5  1bb2e6237e03  12            6
       
   469   
       
   470   Total:                      20            14        (42.9% bigger)
       
   471   $ hg prefetch -r '0::1'
       
   472   2 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
       
   473   $ hg repack
       
   474   $ hg debugdatapack $CACHEDIR/master/packs/*.datapack
       
   475   $TESTTMP/hgcache/master/packs/09b8bf49256b3fc2175977ba97d6402e91a9a604:
       
   476   x:
       
   477   Node          Delta Base    Delta Length  Blob Size
       
   478   1bb2e6237e03  000000000000  8             8
       
   479   d4a3ed9310e5  1bb2e6237e03  12            6
       
   480   aee31534993a  d4a3ed9310e5  12            4
       
   481   1406e7411862  aee31534993a  12            2
       
   482   
       
   483   Total:                      44            20        (120.0% bigger)