tests/test-clonebundles.t
changeset 27738 a0e783d26e81
parent 27737 482eb357fe98
child 27752 29cfc474c5fd
equal deleted inserted replaced
27737:482eb357fe98 27738:a0e783d26e81
    18 
    18 
    19   $ hg serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
    19   $ hg serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
    20   $ cat hg.pid >> $DAEMON_PIDS
    20   $ cat hg.pid >> $DAEMON_PIDS
    21   $ cd ..
    21   $ cd ..
    22 
    22 
    23 Feature disabled by default
    23 Missing manifest should not result in server lookup
    24 (client should not request manifest)
    24 
    25 
    25   $ hg --verbose clone -U http://localhost:$HGPORT no-manifest
    26   $ hg clone -U http://localhost:$HGPORT feature-disabled
       
    27   requesting all changes
    26   requesting all changes
    28   adding changesets
    27   adding changesets
    29   adding manifests
    28   adding manifests
    30   adding file changes
    29   adding file changes
    31   added 2 changesets with 2 changes to 2 files
    30   added 2 changesets with 2 changes to 2 files
    34   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
    33   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
    35   * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
    34   * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
    36   * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob)
    35   * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob)
    37   * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob)
    36   * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob)
    38 
    37 
    39   $ cat >> $HGRCPATH << EOF
       
    40   > [experimental]
       
    41   > clonebundles = true
       
    42   > EOF
       
    43 
       
    44 Missing manifest should not result in server lookup
       
    45 
       
    46   $ hg --verbose clone -U http://localhost:$HGPORT no-manifest
       
    47   requesting all changes
       
    48   adding changesets
       
    49   adding manifests
       
    50   adding file changes
       
    51   added 2 changesets with 2 changes to 2 files
       
    52 
       
    53   $ tail -4 server/access.log
       
    54   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
       
    55   * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
       
    56   * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob)
       
    57   * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob)
       
    58 
       
    59 Empty manifest file results in retrieval
    38 Empty manifest file results in retrieval
    60 (the extension only checks if the manifest file exists)
    39 (the extension only checks if the manifest file exists)
    61 
    40 
    62   $ touch server/.hg/clonebundles.manifest
    41   $ touch server/.hg/clonebundles.manifest
    63   $ hg --verbose clone -U http://localhost:$HGPORT empty-manifest
    42   $ hg --verbose clone -U http://localhost:$HGPORT empty-manifest
    73   $ echo 'http://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest
    52   $ echo 'http://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest
    74   $ hg clone http://localhost:$HGPORT 404-url
    53   $ hg clone http://localhost:$HGPORT 404-url
    75   applying clone bundle from http://does.not.exist/bundle.hg
    54   applying clone bundle from http://does.not.exist/bundle.hg
    76   error fetching bundle: (.* not known|getaddrinfo failed) (re)
    55   error fetching bundle: (.* not known|getaddrinfo failed) (re)
    77   abort: error applying bundle
    56   abort: error applying bundle
    78   (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false")
    57   (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false")
    79   [255]
    58   [255]
    80 
    59 
    81 Server is not running aborts
    60 Server is not running aborts
    82 
    61 
    83   $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest
    62   $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest
    84   $ hg clone http://localhost:$HGPORT server-not-runner
    63   $ hg clone http://localhost:$HGPORT server-not-runner
    85   applying clone bundle from http://localhost:$HGPORT1/bundle.hg
    64   applying clone bundle from http://localhost:$HGPORT1/bundle.hg
    86   error fetching bundle: * refused* (glob)
    65   error fetching bundle: * refused* (glob)
    87   abort: error applying bundle
    66   abort: error applying bundle
    88   (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false")
    67   (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false")
    89   [255]
    68   [255]
    90 
    69 
    91 Server returns 404
    70 Server returns 404
    92 
    71 
    93   $ python $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
    72   $ python $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
    94   $ cat http.pid >> $DAEMON_PIDS
    73   $ cat http.pid >> $DAEMON_PIDS
    95   $ hg clone http://localhost:$HGPORT running-404
    74   $ hg clone http://localhost:$HGPORT running-404
    96   applying clone bundle from http://localhost:$HGPORT1/bundle.hg
    75   applying clone bundle from http://localhost:$HGPORT1/bundle.hg
    97   HTTP error fetching bundle: HTTP Error 404: File not found
    76   HTTP error fetching bundle: HTTP Error 404: File not found
    98   abort: error applying bundle
    77   abort: error applying bundle
    99   (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false")
    78   (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false")
   100   [255]
    79   [255]
   101 
    80 
   102 We can override failure to fall back to regular clone
    81 We can override failure to fall back to regular clone
   103 
    82 
   104   $ hg --config ui.clonebundlefallback=true clone -U http://localhost:$HGPORT 404-fallback
    83   $ hg --config ui.clonebundlefallback=true clone -U http://localhost:$HGPORT 404-fallback