tests/test-clone-uncompressed.t
changeset 47876 517a2c1cb788
parent 47875 0fb328bb2459
child 47877 2174f54aab18
equal deleted inserted replaced
47875:0fb328bb2459 47876:517a2c1cb788
     1 #require serve no-reposimplestore no-chg
       
     2 
       
     3 #testcases stream-legacy stream-bundle2
       
     4 
       
     5 #if stream-legacy
       
     6   $ cat << EOF >> $HGRCPATH
       
     7   > [server]
       
     8   > bundle2.stream = no
       
     9   > EOF
       
    10 #endif
       
    11 
       
    12 Initialize repository
       
    13 the status call is to check for issue5130
       
    14 
       
    15   $ hg init server
       
    16   $ cd server
       
    17   $ touch foo
       
    18   $ hg -q commit -A -m initial
       
    19   >>> for i in range(1024):
       
    20   ...     with open(str(i), 'wb') as fh:
       
    21   ...         fh.write(b"%d" % i) and None
       
    22   $ hg -q commit -A -m 'add a lot of files'
       
    23   $ hg st
       
    24 
       
    25 add files with "tricky" name:
       
    26 
       
    27   $ echo foo > 00changelog.i
       
    28   $ echo foo > 00changelog.d
       
    29   $ echo foo > 00changelog.n
       
    30   $ echo foo > 00changelog-ab349180a0405010.nd
       
    31   $ echo foo > 00manifest.i
       
    32   $ echo foo > 00manifest.d
       
    33   $ echo foo > foo.i
       
    34   $ echo foo > foo.d
       
    35   $ echo foo > foo.n
       
    36   $ echo foo > undo.py
       
    37   $ echo foo > undo.i
       
    38   $ echo foo > undo.d
       
    39   $ echo foo > undo.n
       
    40   $ echo foo > undo.foo.i
       
    41   $ echo foo > undo.foo.d
       
    42   $ echo foo > undo.foo.n
       
    43   $ echo foo > undo.babar
       
    44   $ mkdir savanah
       
    45   $ echo foo > savanah/foo.i
       
    46   $ echo foo > savanah/foo.d
       
    47   $ echo foo > savanah/foo.n
       
    48   $ echo foo > savanah/undo.py
       
    49   $ echo foo > savanah/undo.i
       
    50   $ echo foo > savanah/undo.d
       
    51   $ echo foo > savanah/undo.n
       
    52   $ echo foo > savanah/undo.foo.i
       
    53   $ echo foo > savanah/undo.foo.d
       
    54   $ echo foo > savanah/undo.foo.n
       
    55   $ echo foo > savanah/undo.babar
       
    56   $ mkdir data
       
    57   $ echo foo > data/foo.i
       
    58   $ echo foo > data/foo.d
       
    59   $ echo foo > data/foo.n
       
    60   $ echo foo > data/undo.py
       
    61   $ echo foo > data/undo.i
       
    62   $ echo foo > data/undo.d
       
    63   $ echo foo > data/undo.n
       
    64   $ echo foo > data/undo.foo.i
       
    65   $ echo foo > data/undo.foo.d
       
    66   $ echo foo > data/undo.foo.n
       
    67   $ echo foo > data/undo.babar
       
    68   $ mkdir meta
       
    69   $ echo foo > meta/foo.i
       
    70   $ echo foo > meta/foo.d
       
    71   $ echo foo > meta/foo.n
       
    72   $ echo foo > meta/undo.py
       
    73   $ echo foo > meta/undo.i
       
    74   $ echo foo > meta/undo.d
       
    75   $ echo foo > meta/undo.n
       
    76   $ echo foo > meta/undo.foo.i
       
    77   $ echo foo > meta/undo.foo.d
       
    78   $ echo foo > meta/undo.foo.n
       
    79   $ echo foo > meta/undo.babar
       
    80   $ mkdir store
       
    81   $ echo foo > store/foo.i
       
    82   $ echo foo > store/foo.d
       
    83   $ echo foo > store/foo.n
       
    84   $ echo foo > store/undo.py
       
    85   $ echo foo > store/undo.i
       
    86   $ echo foo > store/undo.d
       
    87   $ echo foo > store/undo.n
       
    88   $ echo foo > store/undo.foo.i
       
    89   $ echo foo > store/undo.foo.d
       
    90   $ echo foo > store/undo.foo.n
       
    91   $ echo foo > store/undo.babar
       
    92 
       
    93 Name with special characters
       
    94 
       
    95   $ echo foo > store/CélesteVille_is_a_Capital_City
       
    96 
       
    97 All all that
       
    98 
       
    99   $ hg add .
       
   100   adding 00changelog-ab349180a0405010.nd
       
   101   adding 00changelog.d
       
   102   adding 00changelog.i
       
   103   adding 00changelog.n
       
   104   adding 00manifest.d
       
   105   adding 00manifest.i
       
   106   adding data/foo.d
       
   107   adding data/foo.i
       
   108   adding data/foo.n
       
   109   adding data/undo.babar
       
   110   adding data/undo.d
       
   111   adding data/undo.foo.d
       
   112   adding data/undo.foo.i
       
   113   adding data/undo.foo.n
       
   114   adding data/undo.i
       
   115   adding data/undo.n
       
   116   adding data/undo.py
       
   117   adding foo.d
       
   118   adding foo.i
       
   119   adding foo.n
       
   120   adding meta/foo.d
       
   121   adding meta/foo.i
       
   122   adding meta/foo.n
       
   123   adding meta/undo.babar
       
   124   adding meta/undo.d
       
   125   adding meta/undo.foo.d
       
   126   adding meta/undo.foo.i
       
   127   adding meta/undo.foo.n
       
   128   adding meta/undo.i
       
   129   adding meta/undo.n
       
   130   adding meta/undo.py
       
   131   adding savanah/foo.d
       
   132   adding savanah/foo.i
       
   133   adding savanah/foo.n
       
   134   adding savanah/undo.babar
       
   135   adding savanah/undo.d
       
   136   adding savanah/undo.foo.d
       
   137   adding savanah/undo.foo.i
       
   138   adding savanah/undo.foo.n
       
   139   adding savanah/undo.i
       
   140   adding savanah/undo.n
       
   141   adding savanah/undo.py
       
   142   adding store/C\xc3\xa9lesteVille_is_a_Capital_City (esc)
       
   143   adding store/foo.d
       
   144   adding store/foo.i
       
   145   adding store/foo.n
       
   146   adding store/undo.babar
       
   147   adding store/undo.d
       
   148   adding store/undo.foo.d
       
   149   adding store/undo.foo.i
       
   150   adding store/undo.foo.n
       
   151   adding store/undo.i
       
   152   adding store/undo.n
       
   153   adding store/undo.py
       
   154   adding undo.babar
       
   155   adding undo.d
       
   156   adding undo.foo.d
       
   157   adding undo.foo.i
       
   158   adding undo.foo.n
       
   159   adding undo.i
       
   160   adding undo.n
       
   161   adding undo.py
       
   162   $ hg ci -m 'add files with "tricky" name'
       
   163   $ hg --config server.uncompressed=false serve -p $HGPORT -d --pid-file=hg.pid
       
   164   $ cat hg.pid > $DAEMON_PIDS
       
   165   $ cd ..
       
   166 
       
   167 Check local clone
       
   168 ==================
       
   169 
       
   170 The logic is close enough of uncompressed.
       
   171 This is present here to reuse the testing around file with "special" names.
       
   172 
       
   173   $ hg clone server local-clone
       
   174   updating to branch default
       
   175   1087 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   176 
       
   177 Check uncompressed
       
   178 ==================
       
   179 
       
   180 Cannot stream clone when server.uncompressed is set
       
   181 
       
   182   $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=stream_out'
       
   183   200 Script output follows
       
   184   
       
   185   1
       
   186 
       
   187 #if stream-legacy
       
   188   $ hg debugcapabilities http://localhost:$HGPORT
       
   189   Main capabilities:
       
   190     batch
       
   191     branchmap
       
   192     $USUAL_BUNDLE2_CAPS_SERVER$
       
   193     changegroupsubset
       
   194     compression=$BUNDLE2_COMPRESSIONS$
       
   195     getbundle
       
   196     httpheader=1024
       
   197     httpmediatype=0.1rx,0.1tx,0.2tx
       
   198     known
       
   199     lookup
       
   200     pushkey
       
   201     unbundle=HG10GZ,HG10BZ,HG10UN
       
   202     unbundlehash
       
   203   Bundle2 capabilities:
       
   204     HG20
       
   205     bookmarks
       
   206     changegroup
       
   207       01
       
   208       02
       
   209     checkheads
       
   210       related
       
   211     digests
       
   212       md5
       
   213       sha1
       
   214       sha512
       
   215     error
       
   216       abort
       
   217       unsupportedcontent
       
   218       pushraced
       
   219       pushkey
       
   220     hgtagsfnodes
       
   221     listkeys
       
   222     phases
       
   223       heads
       
   224     pushkey
       
   225     remote-changegroup
       
   226       http
       
   227       https
       
   228 
       
   229   $ hg clone --stream -U http://localhost:$HGPORT server-disabled
       
   230   warning: stream clone requested but server has them disabled
       
   231   requesting all changes
       
   232   adding changesets
       
   233   adding manifests
       
   234   adding file changes
       
   235   added 3 changesets with 1087 changes to 1087 files
       
   236   new changesets 96ee1d7354c4:42e820400e84
       
   237 
       
   238   $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto 0.2 --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1"
       
   239   200 Script output follows
       
   240   content-type: application/mercurial-0.2
       
   241   
       
   242 
       
   243   $ f --size body --hexdump --bytes 100
       
   244   body: size=232
       
   245   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
       
   246   0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...|
       
   247   0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest|
       
   248   0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques|
       
   249   0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d|
       
   250   0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th|
       
   251   0060: 69 73 20 66                                     |is f|
       
   252 
       
   253 #endif
       
   254 #if stream-bundle2
       
   255   $ hg debugcapabilities http://localhost:$HGPORT
       
   256   Main capabilities:
       
   257     batch
       
   258     branchmap
       
   259     $USUAL_BUNDLE2_CAPS_SERVER$
       
   260     changegroupsubset
       
   261     compression=$BUNDLE2_COMPRESSIONS$
       
   262     getbundle
       
   263     httpheader=1024
       
   264     httpmediatype=0.1rx,0.1tx,0.2tx
       
   265     known
       
   266     lookup
       
   267     pushkey
       
   268     unbundle=HG10GZ,HG10BZ,HG10UN
       
   269     unbundlehash
       
   270   Bundle2 capabilities:
       
   271     HG20
       
   272     bookmarks
       
   273     changegroup
       
   274       01
       
   275       02
       
   276     checkheads
       
   277       related
       
   278     digests
       
   279       md5
       
   280       sha1
       
   281       sha512
       
   282     error
       
   283       abort
       
   284       unsupportedcontent
       
   285       pushraced
       
   286       pushkey
       
   287     hgtagsfnodes
       
   288     listkeys
       
   289     phases
       
   290       heads
       
   291     pushkey
       
   292     remote-changegroup
       
   293       http
       
   294       https
       
   295 
       
   296   $ hg clone --stream -U http://localhost:$HGPORT server-disabled
       
   297   warning: stream clone requested but server has them disabled
       
   298   requesting all changes
       
   299   adding changesets
       
   300   adding manifests
       
   301   adding file changes
       
   302   added 3 changesets with 1087 changes to 1087 files
       
   303   new changesets 96ee1d7354c4:42e820400e84
       
   304 
       
   305   $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto 0.2 --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1"
       
   306   200 Script output follows
       
   307   content-type: application/mercurial-0.2
       
   308   
       
   309 
       
   310   $ f --size body --hexdump --bytes 100
       
   311   body: size=232
       
   312   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
       
   313   0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...|
       
   314   0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest|
       
   315   0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques|
       
   316   0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d|
       
   317   0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th|
       
   318   0060: 69 73 20 66                                     |is f|
       
   319 
       
   320 #endif
       
   321 
       
   322   $ killdaemons.py
       
   323   $ cd server
       
   324   $ hg serve -p $HGPORT -d --pid-file=hg.pid --error errors.txt
       
   325   $ cat hg.pid > $DAEMON_PIDS
       
   326   $ cd ..
       
   327 
       
   328 Basic clone
       
   329 
       
   330 #if stream-legacy
       
   331   $ hg clone --stream -U http://localhost:$HGPORT clone1
       
   332   streaming all changes
       
   333   1089 files to transfer, 101 KB of data (no-zstd !)
       
   334   transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
       
   335   1089 files to transfer, 98.5 KB of data (zstd !)
       
   336   transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
       
   337   searching for changes
       
   338   no changes found
       
   339   $ cat server/errors.txt
       
   340 #endif
       
   341 #if stream-bundle2
       
   342   $ hg clone --stream -U http://localhost:$HGPORT clone1
       
   343   streaming all changes
       
   344   1092 files to transfer, 101 KB of data (no-zstd !)
       
   345   transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
       
   346   1092 files to transfer, 98.6 KB of data (zstd !)
       
   347   transferred 98.6 KB in * seconds (* */sec) (glob) (zstd !)
       
   348 
       
   349   $ ls -1 clone1/.hg/cache
       
   350   branch2-base
       
   351   branch2-immutable
       
   352   branch2-served
       
   353   branch2-served.hidden
       
   354   branch2-visible
       
   355   branch2-visible-hidden
       
   356   rbc-names-v1
       
   357   rbc-revs-v1
       
   358   tags2
       
   359   tags2-served
       
   360   $ cat server/errors.txt
       
   361 #endif
       
   362 
       
   363 getbundle requests with stream=1 are uncompressed
       
   364 
       
   365   $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto '0.1 0.2 comp=zlib,none' --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1"
       
   366   200 Script output follows
       
   367   content-type: application/mercurial-0.2
       
   368   
       
   369 
       
   370 #if no-zstd no-rust
       
   371   $ f --size --hex --bytes 256 body
       
   372   body: size=118737
       
   373   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
       
   374   0010: 80 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
       
   375   0020: 06 09 04 0c 44 62 79 74 65 63 6f 75 6e 74 31 30 |....Dbytecount10|
       
   376   0030: 33 38 33 34 66 69 6c 65 63 6f 75 6e 74 31 30 39 |3834filecount109|
       
   377   0040: 32 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 |2requirementsdot|
       
   378   0050: 65 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 |encode%2Cfncache|
       
   379   0060: 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 |%2Cgeneraldelta%|
       
   380   0070: 32 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 |2Crevlogv1%2Cspa|
       
   381   0080: 72 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 |rserevlog%2Cstor|
       
   382   0090: 65 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 |e....s.Bdata/0.i|
       
   383   00a0: 00 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 |................|
       
   384   00b0: 00 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff |................|
       
   385   00c0: 80 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c |.)c.I.#....Vg.g,|
       
   386   00d0: 69 d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 00 |i..9............|
       
   387   00e0: 75 30 73 26 45 64 61 74 61 2f 30 30 63 68 61 6e |u0s&Edata/00chan|
       
   388   00f0: 67 65 6c 6f 67 2d 61 62 33 34 39 31 38 30 61 30 |gelog-ab349180a0|
       
   389 #endif
       
   390 #if zstd no-rust
       
   391   $ f --size --hex --bytes 256 body
       
   392   body: size=115921
       
   393   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
       
   394   0010: 9a 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
       
   395   0020: 06 09 04 0c 5e 62 79 74 65 63 6f 75 6e 74 31 30 |....^bytecount10|
       
   396   0030: 30 39 39 32 66 69 6c 65 63 6f 75 6e 74 31 30 39 |0992filecount109|
       
   397   0040: 32 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 |2requirementsdot|
       
   398   0050: 65 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 |encode%2Cfncache|
       
   399   0060: 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 |%2Cgeneraldelta%|
       
   400   0070: 32 43 72 65 76 6c 6f 67 2d 63 6f 6d 70 72 65 73 |2Crevlog-compres|
       
   401   0080: 73 69 6f 6e 2d 7a 73 74 64 25 32 43 72 65 76 6c |sion-zstd%2Crevl|
       
   402   0090: 6f 67 76 31 25 32 43 73 70 61 72 73 65 72 65 76 |ogv1%2Csparserev|
       
   403   00a0: 6c 6f 67 25 32 43 73 74 6f 72 65 00 00 80 00 73 |log%2Cstore....s|
       
   404   00b0: 08 42 64 61 74 61 2f 30 2e 69 00 03 00 01 00 00 |.Bdata/0.i......|
       
   405   00c0: 00 00 00 00 00 02 00 00 00 01 00 00 00 00 00 00 |................|
       
   406   00d0: 00 01 ff ff ff ff ff ff ff ff 80 29 63 a0 49 d3 |...........)c.I.|
       
   407   00e0: 23 87 bf ce fe 56 67 92 67 2c 69 d1 ec 39 00 00 |#....Vg.g,i..9..|
       
   408   00f0: 00 00 00 00 00 00 00 00 00 00 75 30 73 26 45 64 |..........u0s&Ed|
       
   409 #endif
       
   410 #if zstd rust no-dirstate-v2
       
   411   $ f --size --hex --bytes 256 body
       
   412   body: size=115942
       
   413   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
       
   414   0010: af 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
       
   415   0020: 06 09 04 0c 73 62 79 74 65 63 6f 75 6e 74 31 30 |....sbytecount10|
       
   416   0030: 30 39 39 32 66 69 6c 65 63 6f 75 6e 74 31 30 39 |0992filecount109|
       
   417   0040: 32 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 |2requirementsdot|
       
   418   0050: 65 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 |encode%2Cfncache|
       
   419   0060: 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 |%2Cgeneraldelta%|
       
   420   0070: 32 43 70 65 72 73 69 73 74 65 6e 74 2d 6e 6f 64 |2Cpersistent-nod|
       
   421   0080: 65 6d 61 70 25 32 43 72 65 76 6c 6f 67 2d 63 6f |emap%2Crevlog-co|
       
   422   0090: 6d 70 72 65 73 73 69 6f 6e 2d 7a 73 74 64 25 32 |mpression-zstd%2|
       
   423   00a0: 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 72 |Crevlogv1%2Cspar|
       
   424   00b0: 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 65 |serevlog%2Cstore|
       
   425   00c0: 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 00 |....s.Bdata/0.i.|
       
   426   00d0: 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 00 |................|
       
   427   00e0: 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff 80 |................|
       
   428   00f0: 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c 69 |)c.I.#....Vg.g,i|
       
   429 #endif
       
   430 #if zstd dirstate-v2
       
   431   $ f --size --hex --bytes 256 body
       
   432   body: size=109549
       
   433   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
       
   434   0010: c0 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
       
   435   0020: 05 09 04 0c 85 62 79 74 65 63 6f 75 6e 74 39 35 |.....bytecount95|
       
   436   0030: 38 39 37 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |897filecount1030|
       
   437   0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote|
       
   438   0050: 6e 63 6f 64 65 25 32 43 65 78 70 2d 64 69 72 73 |ncode%2Cexp-dirs|
       
   439   0060: 74 61 74 65 2d 76 32 25 32 43 66 6e 63 61 63 68 |tate-v2%2Cfncach|
       
   440   0070: 65 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 |e%2Cgeneraldelta|
       
   441   0080: 25 32 43 70 65 72 73 69 73 74 65 6e 74 2d 6e 6f |%2Cpersistent-no|
       
   442   0090: 64 65 6d 61 70 25 32 43 72 65 76 6c 6f 67 2d 63 |demap%2Crevlog-c|
       
   443   00a0: 6f 6d 70 72 65 73 73 69 6f 6e 2d 7a 73 74 64 25 |ompression-zstd%|
       
   444   00b0: 32 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 |2Crevlogv1%2Cspa|
       
   445   00c0: 72 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 |rserevlog%2Cstor|
       
   446   00d0: 65 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 |e....s.Bdata/0.i|
       
   447   00e0: 00 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 |................|
       
   448   00f0: 00 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff |................|
       
   449 #endif
       
   450 
       
   451 --uncompressed is an alias to --stream
       
   452 
       
   453 #if stream-legacy
       
   454   $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed
       
   455   streaming all changes
       
   456   1089 files to transfer, 101 KB of data (no-zstd !)
       
   457   transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
       
   458   1089 files to transfer, 98.5 KB of data (zstd !)
       
   459   transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
       
   460   searching for changes
       
   461   no changes found
       
   462 #endif
       
   463 #if stream-bundle2
       
   464   $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed
       
   465   streaming all changes
       
   466   1092 files to transfer, 101 KB of data (no-zstd !)
       
   467   transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
       
   468   1092 files to transfer, 98.6 KB of data (zstd !)
       
   469   transferred 98.6 KB in * seconds (* */sec) (glob) (zstd !)
       
   470 #endif
       
   471 
       
   472 Clone with background file closing enabled
       
   473 
       
   474 #if stream-legacy
       
   475   $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep -v adding
       
   476   using http://localhost:$HGPORT/
       
   477   sending capabilities command
       
   478   sending branchmap command
       
   479   streaming all changes
       
   480   sending stream_out command
       
   481   1089 files to transfer, 101 KB of data (no-zstd !)
       
   482   1089 files to transfer, 98.5 KB of data (zstd !)
       
   483   starting 4 threads for background file closing
       
   484   updating the branch cache
       
   485   transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
       
   486   transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
       
   487   query 1; heads
       
   488   sending batch command
       
   489   searching for changes
       
   490   all remote heads known locally
       
   491   no changes found
       
   492   sending getbundle command
       
   493   bundle2-input-bundle: with-transaction
       
   494   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
       
   495   bundle2-input-part: "phase-heads" supported
       
   496   bundle2-input-part: total payload size 24
       
   497   bundle2-input-bundle: 2 parts total
       
   498   checking for updated bookmarks
       
   499   updating the branch cache
       
   500   (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob)
       
   501 #endif
       
   502 #if stream-bundle2
       
   503   $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep -v adding
       
   504   using http://localhost:$HGPORT/
       
   505   sending capabilities command
       
   506   query 1; heads
       
   507   sending batch command
       
   508   streaming all changes
       
   509   sending getbundle command
       
   510   bundle2-input-bundle: with-transaction
       
   511   bundle2-input-part: "stream2" (params: 3 mandatory) supported
       
   512   applying stream bundle
       
   513   1092 files to transfer, 101 KB of data (no-zstd !)
       
   514   1092 files to transfer, 98.6 KB of data (zstd !)
       
   515   starting 4 threads for background file closing
       
   516   starting 4 threads for background file closing
       
   517   updating the branch cache
       
   518   transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
       
   519   bundle2-input-part: total payload size 118568 (no-zstd !)
       
   520   transferred 98.6 KB in * seconds (* */sec) (glob) (zstd !)
       
   521   bundle2-input-part: total payload size 115726 (zstd !)
       
   522   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
       
   523   bundle2-input-bundle: 2 parts total
       
   524   checking for updated bookmarks
       
   525   updating the branch cache
       
   526   (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
       
   527 #endif
       
   528 
       
   529 Cannot stream clone when there are secret changesets
       
   530 
       
   531   $ hg -R server phase --force --secret -r tip
       
   532   $ hg clone --stream -U http://localhost:$HGPORT secret-denied
       
   533   warning: stream clone requested but server has them disabled
       
   534   requesting all changes
       
   535   adding changesets
       
   536   adding manifests
       
   537   adding file changes
       
   538   added 2 changesets with 1025 changes to 1025 files
       
   539   new changesets 96ee1d7354c4:c17445101a72
       
   540 
       
   541   $ killdaemons.py
       
   542 
       
   543 Streaming of secrets can be overridden by server config
       
   544 
       
   545   $ cd server
       
   546   $ hg serve --config server.uncompressedallowsecret=true -p $HGPORT -d --pid-file=hg.pid
       
   547   $ cat hg.pid > $DAEMON_PIDS
       
   548   $ cd ..
       
   549 
       
   550 #if stream-legacy
       
   551   $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
       
   552   streaming all changes
       
   553   1089 files to transfer, 101 KB of data (no-zstd !)
       
   554   transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
       
   555   1089 files to transfer, 98.5 KB of data (zstd !)
       
   556   transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
       
   557   searching for changes
       
   558   no changes found
       
   559 #endif
       
   560 #if stream-bundle2
       
   561   $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
       
   562   streaming all changes
       
   563   1092 files to transfer, 101 KB of data (no-zstd !)
       
   564   transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
       
   565   1092 files to transfer, 98.6 KB of data (zstd !)
       
   566   transferred 98.6 KB in * seconds (* */sec) (glob) (zstd !)
       
   567 #endif
       
   568 
       
   569   $ killdaemons.py
       
   570 
       
   571 Verify interaction between preferuncompressed and secret presence
       
   572 
       
   573   $ cd server
       
   574   $ hg serve --config server.preferuncompressed=true -p $HGPORT -d --pid-file=hg.pid
       
   575   $ cat hg.pid > $DAEMON_PIDS
       
   576   $ cd ..
       
   577 
       
   578   $ hg clone -U http://localhost:$HGPORT preferuncompressed-secret
       
   579   requesting all changes
       
   580   adding changesets
       
   581   adding manifests
       
   582   adding file changes
       
   583   added 2 changesets with 1025 changes to 1025 files
       
   584   new changesets 96ee1d7354c4:c17445101a72
       
   585 
       
   586   $ killdaemons.py
       
   587 
       
   588 Clone not allowed when full bundles disabled and can't serve secrets
       
   589 
       
   590   $ cd server
       
   591   $ hg serve --config server.disablefullbundle=true -p $HGPORT -d --pid-file=hg.pid
       
   592   $ cat hg.pid > $DAEMON_PIDS
       
   593   $ cd ..
       
   594 
       
   595   $ hg clone --stream http://localhost:$HGPORT secret-full-disabled
       
   596   warning: stream clone requested but server has them disabled
       
   597   requesting all changes
       
   598   remote: abort: server has pull-based clones disabled
       
   599   abort: pull failed on remote
       
   600   (remove --pull if specified or upgrade Mercurial)
       
   601   [100]
       
   602 
       
   603 Local stream clone with secrets involved
       
   604 (This is just a test over behavior: if you have access to the repo's files,
       
   605 there is no security so it isn't important to prevent a clone here.)
       
   606 
       
   607   $ hg clone -U --stream server local-secret
       
   608   warning: stream clone requested but server has them disabled
       
   609   requesting all changes
       
   610   adding changesets
       
   611   adding manifests
       
   612   adding file changes
       
   613   added 2 changesets with 1025 changes to 1025 files
       
   614   new changesets 96ee1d7354c4:c17445101a72
       
   615 
       
   616 Stream clone while repo is changing:
       
   617 
       
   618   $ mkdir changing
       
   619   $ cd changing
       
   620 
       
   621 extension for delaying the server process so we reliably can modify the repo
       
   622 while cloning
       
   623 
       
   624   $ cat > stream_steps.py <<EOF
       
   625   > import os
       
   626   > import sys
       
   627   > from mercurial import (
       
   628   >     encoding,
       
   629   >     extensions,
       
   630   >     streamclone,
       
   631   >     testing,
       
   632   > )
       
   633   > WALKED_FILE_1 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_1']
       
   634   > WALKED_FILE_2 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_2']
       
   635   > 
       
   636   > def _test_sync_point_walk_1(orig, repo):
       
   637   >     testing.write_file(WALKED_FILE_1)
       
   638   > 
       
   639   > def _test_sync_point_walk_2(orig, repo):
       
   640   >     assert repo._currentlock(repo._lockref) is None
       
   641   >     testing.wait_file(WALKED_FILE_2)
       
   642   > 
       
   643   > extensions.wrapfunction(
       
   644   >     streamclone,
       
   645   >     '_test_sync_point_walk_1',
       
   646   >     _test_sync_point_walk_1
       
   647   > )
       
   648   > extensions.wrapfunction(
       
   649   >     streamclone,
       
   650   >     '_test_sync_point_walk_2',
       
   651   >     _test_sync_point_walk_2
       
   652   > )
       
   653   > EOF
       
   654 
       
   655 prepare repo with small and big file to cover both code paths in emitrevlogdata
       
   656 
       
   657   $ hg init repo
       
   658   $ touch repo/f1
       
   659   $ $TESTDIR/seq.py 50000 > repo/f2
       
   660   $ hg -R repo ci -Aqm "0"
       
   661   $ HG_TEST_STREAM_WALKED_FILE_1="$TESTTMP/sync_file_walked_1"
       
   662   $ export HG_TEST_STREAM_WALKED_FILE_1
       
   663   $ HG_TEST_STREAM_WALKED_FILE_2="$TESTTMP/sync_file_walked_2"
       
   664   $ export HG_TEST_STREAM_WALKED_FILE_2
       
   665   $ HG_TEST_STREAM_WALKED_FILE_3="$TESTTMP/sync_file_walked_3"
       
   666   $ export HG_TEST_STREAM_WALKED_FILE_3
       
   667 #   $ cat << EOF >> $HGRCPATH
       
   668 #   > [hooks]
       
   669 #   > pre-clone=rm -f "$TESTTMP/sync_file_walked_*"
       
   670 #   > EOF
       
   671   $ hg serve -R repo -p $HGPORT1 -d --error errors.log --pid-file=hg.pid --config extensions.stream_steps="$RUNTESTDIR/testlib/ext-stream-clone-steps.py"
       
   672   $ cat hg.pid >> $DAEMON_PIDS
       
   673 
       
   674 clone while modifying the repo between stating file with write lock and
       
   675 actually serving file content
       
   676 
       
   677   $ (hg clone -q --stream -U http://localhost:$HGPORT1 clone; touch "$HG_TEST_STREAM_WALKED_FILE_3") &
       
   678   $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1
       
   679   $ echo >> repo/f1
       
   680   $ echo >> repo/f2
       
   681   $ hg -R repo ci -m "1" --config ui.timeout.warn=-1
       
   682   $ touch $HG_TEST_STREAM_WALKED_FILE_2
       
   683   $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3
       
   684   $ hg -R clone id
       
   685   000000000000
       
   686   $ cat errors.log
       
   687   $ cd ..
       
   688 
       
   689 Stream repository with bookmarks
       
   690 --------------------------------
       
   691 
       
   692 (revert introduction of secret changeset)
       
   693 
       
   694   $ hg -R server phase --draft 'secret()'
       
   695 
       
   696 add a bookmark
       
   697 
       
   698   $ hg -R server bookmark -r tip some-bookmark
       
   699 
       
   700 clone it
       
   701 
       
   702 #if stream-legacy
       
   703   $ hg clone --stream http://localhost:$HGPORT with-bookmarks
       
   704   streaming all changes
       
   705   1089 files to transfer, 101 KB of data (no-zstd !)
       
   706   transferred 101 KB in * seconds (*) (glob) (no-zstd !)
       
   707   1089 files to transfer, 98.5 KB of data (zstd !)
       
   708   transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
       
   709   searching for changes
       
   710   no changes found
       
   711   updating to branch default
       
   712   1087 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   713 #endif
       
   714 #if stream-bundle2
       
   715   $ hg clone --stream http://localhost:$HGPORT with-bookmarks
       
   716   streaming all changes
       
   717   1095 files to transfer, 102 KB of data (no-zstd !)
       
   718   transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
       
   719   1095 files to transfer, 98.8 KB of data (zstd !)
       
   720   transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
       
   721   updating to branch default
       
   722   1087 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   723 #endif
       
   724   $ hg verify -R with-bookmarks
       
   725   checking changesets
       
   726   checking manifests
       
   727   crosschecking files in changesets and manifests
       
   728   checking files
       
   729   checked 3 changesets with 1087 changes to 1087 files
       
   730   $ hg -R with-bookmarks bookmarks
       
   731      some-bookmark             2:42e820400e84
       
   732 
       
   733 Stream repository with phases
       
   734 -----------------------------
       
   735 
       
   736 Clone as publishing
       
   737 
       
   738   $ hg -R server phase -r 'all()'
       
   739   0: draft
       
   740   1: draft
       
   741   2: draft
       
   742 
       
   743 #if stream-legacy
       
   744   $ hg clone --stream http://localhost:$HGPORT phase-publish
       
   745   streaming all changes
       
   746   1089 files to transfer, 101 KB of data (no-zstd !)
       
   747   transferred 101 KB in * seconds (*) (glob) (no-zstd !)
       
   748   1089 files to transfer, 98.5 KB of data (zstd !)
       
   749   transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
       
   750   searching for changes
       
   751   no changes found
       
   752   updating to branch default
       
   753   1087 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   754 #endif
       
   755 #if stream-bundle2
       
   756   $ hg clone --stream http://localhost:$HGPORT phase-publish
       
   757   streaming all changes
       
   758   1095 files to transfer, 102 KB of data (no-zstd !)
       
   759   transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
       
   760   1095 files to transfer, 98.8 KB of data (zstd !)
       
   761   transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
       
   762   updating to branch default
       
   763   1087 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   764 #endif
       
   765   $ hg verify -R phase-publish
       
   766   checking changesets
       
   767   checking manifests
       
   768   crosschecking files in changesets and manifests
       
   769   checking files
       
   770   checked 3 changesets with 1087 changes to 1087 files
       
   771   $ hg -R phase-publish phase -r 'all()'
       
   772   0: public
       
   773   1: public
       
   774   2: public
       
   775 
       
   776 Clone as non publishing
       
   777 
       
   778   $ cat << EOF >> server/.hg/hgrc
       
   779   > [phases]
       
   780   > publish = False
       
   781   > EOF
       
   782   $ killdaemons.py
       
   783   $ hg -R server serve -p $HGPORT -d --pid-file=hg.pid
       
   784   $ cat hg.pid > $DAEMON_PIDS
       
   785 
       
   786 #if stream-legacy
       
   787 
       
   788 With v1 of the stream protocol, changeset are always cloned as public. It make
       
   789 stream v1 unsuitable for non-publishing repository.
       
   790 
       
   791   $ hg clone --stream http://localhost:$HGPORT phase-no-publish
       
   792   streaming all changes
       
   793   1089 files to transfer, 101 KB of data (no-zstd !)
       
   794   transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
       
   795   1089 files to transfer, 98.5 KB of data (zstd !)
       
   796   transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
       
   797   searching for changes
       
   798   no changes found
       
   799   updating to branch default
       
   800   1087 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   801   $ hg -R phase-no-publish phase -r 'all()'
       
   802   0: public
       
   803   1: public
       
   804   2: public
       
   805 #endif
       
   806 #if stream-bundle2
       
   807   $ hg clone --stream http://localhost:$HGPORT phase-no-publish
       
   808   streaming all changes
       
   809   1096 files to transfer, 102 KB of data (no-zstd !)
       
   810   transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
       
   811   1096 files to transfer, 98.8 KB of data (zstd !)
       
   812   transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
       
   813   updating to branch default
       
   814   1087 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   815   $ hg -R phase-no-publish phase -r 'all()'
       
   816   0: draft
       
   817   1: draft
       
   818   2: draft
       
   819 #endif
       
   820   $ hg verify -R phase-no-publish
       
   821   checking changesets
       
   822   checking manifests
       
   823   crosschecking files in changesets and manifests
       
   824   checking files
       
   825   checked 3 changesets with 1087 changes to 1087 files
       
   826 
       
   827   $ killdaemons.py
       
   828 
       
   829 #if stream-legacy
       
   830 
       
   831 With v1 of the stream protocol, changeset are always cloned as public. There's
       
   832 no obsolescence markers exchange in stream v1.
       
   833 
       
   834 #endif
       
   835 #if stream-bundle2
       
   836 
       
   837 Stream repository with obsolescence
       
   838 -----------------------------------
       
   839 
       
   840 Clone non-publishing with obsolescence
       
   841 
       
   842   $ cat >> $HGRCPATH << EOF
       
   843   > [experimental]
       
   844   > evolution=all
       
   845   > EOF
       
   846 
       
   847   $ cd server
       
   848   $ echo foo > foo
       
   849   $ hg -q commit -m 'about to be pruned'
       
   850   $ hg debugobsolete `hg log -r . -T '{node}'` -d '0 0' -u test --record-parents
       
   851   1 new obsolescence markers
       
   852   obsoleted 1 changesets
       
   853   $ hg up null -q
       
   854   $ hg log -T '{rev}: {phase}\n'
       
   855   2: draft
       
   856   1: draft
       
   857   0: draft
       
   858   $ hg serve -p $HGPORT -d --pid-file=hg.pid
       
   859   $ cat hg.pid > $DAEMON_PIDS
       
   860   $ cd ..
       
   861 
       
   862   $ hg clone -U --stream http://localhost:$HGPORT with-obsolescence
       
   863   streaming all changes
       
   864   1097 files to transfer, 102 KB of data (no-zstd !)
       
   865   transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
       
   866   1097 files to transfer, 99.2 KB of data (zstd !)
       
   867   transferred 99.2 KB in * seconds (* */sec) (glob) (zstd !)
       
   868   $ hg -R with-obsolescence log -T '{rev}: {phase}\n'
       
   869   2: draft
       
   870   1: draft
       
   871   0: draft
       
   872   $ hg debugobsolete -R with-obsolescence
       
   873   e53e122156df12330d3a0b72351e3a84bfd14195 0 {42e820400e843bc479ad36068ff772a69c8affe9} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       
   874   $ hg verify -R with-obsolescence
       
   875   checking changesets
       
   876   checking manifests
       
   877   crosschecking files in changesets and manifests
       
   878   checking files
       
   879   checked 4 changesets with 1088 changes to 1087 files
       
   880 
       
   881   $ hg clone -U --stream --config experimental.evolution=0 http://localhost:$HGPORT with-obsolescence-no-evolution
       
   882   streaming all changes
       
   883   remote: abort: server has obsolescence markers, but client cannot receive them via stream clone
       
   884   abort: pull failed on remote
       
   885   [100]
       
   886 
       
   887   $ killdaemons.py
       
   888 
       
   889 #endif