tests/test-largefiles-wireproto.t
changeset 21424 d13b4ecdb680
child 23139 e53f6b72a0e4
equal deleted inserted replaced
21423:7d408720453d 21424:d13b4ecdb680
       
     1 This file contains testcases that tend to be related to the wireprotocol part of
       
     2 largefile.
       
     3 
       
     4   $ USERCACHE="$TESTTMP/cache"; export USERCACHE
       
     5   $ mkdir "${USERCACHE}"
       
     6   $ cat >> $HGRCPATH <<EOF
       
     7   > [extensions]
       
     8   > largefiles=
       
     9   > purge=
       
    10   > rebase=
       
    11   > transplant=
       
    12   > [phases]
       
    13   > publish=False
       
    14   > [largefiles]
       
    15   > minsize=2
       
    16   > patterns=glob:**.dat
       
    17   > usercache=${USERCACHE}
       
    18   > [hooks]
       
    19   > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
       
    20   > EOF
       
    21 
       
    22 
       
    23 #if serve
       
    24 vanilla clients not locked out from largefiles servers on vanilla repos
       
    25   $ mkdir r1
       
    26   $ cd r1
       
    27   $ hg init
       
    28   $ echo c1 > f1
       
    29   $ hg add f1
       
    30   $ hg commit -m "m1"
       
    31   Invoking status precommit hook
       
    32   A f1
       
    33   $ cd ..
       
    34   $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
       
    35   $ cat hg.pid >> $DAEMON_PIDS
       
    36   $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
       
    37   requesting all changes
       
    38   adding changesets
       
    39   adding manifests
       
    40   adding file changes
       
    41   added 1 changesets with 1 changes to 1 files
       
    42   updating to branch default
       
    43   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    44 
       
    45 largefiles clients still work with vanilla servers
       
    46   $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
       
    47   $ cat hg.pid >> $DAEMON_PIDS
       
    48   $ hg clone http://localhost:$HGPORT1 r3
       
    49   requesting all changes
       
    50   adding changesets
       
    51   adding manifests
       
    52   adding file changes
       
    53   added 1 changesets with 1 changes to 1 files
       
    54   updating to branch default
       
    55   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    56 #endif
       
    57 
       
    58 vanilla clients locked out from largefiles http repos
       
    59   $ mkdir r4
       
    60   $ cd r4
       
    61   $ hg init
       
    62   $ echo c1 > f1
       
    63   $ hg add --large f1
       
    64   $ hg commit -m "m1"
       
    65   Invoking status precommit hook
       
    66   A f1
       
    67   $ cd ..
       
    68 
       
    69 largefiles can be pushed locally (issue3583)
       
    70   $ hg init dest
       
    71   $ cd r4
       
    72   $ hg outgoing ../dest
       
    73   comparing with ../dest
       
    74   searching for changes
       
    75   changeset:   0:639881c12b4c
       
    76   tag:         tip
       
    77   user:        test
       
    78   date:        Thu Jan 01 00:00:00 1970 +0000
       
    79   summary:     m1
       
    80   
       
    81   $ hg push ../dest
       
    82   pushing to ../dest
       
    83   searching for changes
       
    84   adding changesets
       
    85   adding manifests
       
    86   adding file changes
       
    87   added 1 changesets with 1 changes to 1 files
       
    88 
       
    89 exit code with nothing outgoing (issue3611)
       
    90   $ hg outgoing ../dest
       
    91   comparing with ../dest
       
    92   searching for changes
       
    93   no changes found
       
    94   [1]
       
    95   $ cd ..
       
    96 
       
    97 #if serve
       
    98   $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
       
    99   $ cat hg.pid >> $DAEMON_PIDS
       
   100   $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
       
   101   abort: remote error:
       
   102   
       
   103   This repository uses the largefiles extension.
       
   104   
       
   105   Please enable it in your Mercurial config file.
       
   106   [255]
       
   107 
       
   108 used all HGPORTs, kill all daemons
       
   109   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
       
   110 #endif
       
   111 
       
   112 vanilla clients locked out from largefiles ssh repos
       
   113   $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
       
   114   abort: remote error:
       
   115   
       
   116   This repository uses the largefiles extension.
       
   117   
       
   118   Please enable it in your Mercurial config file.
       
   119   [255]
       
   120 
       
   121 #if serve
       
   122 
       
   123 largefiles clients refuse to push largefiles repos to vanilla servers
       
   124   $ mkdir r6
       
   125   $ cd r6
       
   126   $ hg init
       
   127   $ echo c1 > f1
       
   128   $ hg add f1
       
   129   $ hg commit -m "m1"
       
   130   Invoking status precommit hook
       
   131   A f1
       
   132   $ cat >> .hg/hgrc <<!
       
   133   > [web]
       
   134   > push_ssl = false
       
   135   > allow_push = *
       
   136   > !
       
   137   $ cd ..
       
   138   $ hg clone r6 r7
       
   139   updating to branch default
       
   140   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   141   $ cd r7
       
   142   $ echo c2 > f2
       
   143   $ hg add --large f2
       
   144   $ hg commit -m "m2"
       
   145   Invoking status precommit hook
       
   146   A f2
       
   147   $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
       
   148   $ cat ../hg.pid >> $DAEMON_PIDS
       
   149   $ hg push http://localhost:$HGPORT
       
   150   pushing to http://localhost:$HGPORT/
       
   151   searching for changes
       
   152   abort: http://localhost:$HGPORT/ does not appear to be a largefile store
       
   153   [255]
       
   154   $ cd ..
       
   155 
       
   156 putlfile errors are shown (issue3123)
       
   157 Corrupt the cached largefile in r7 and move it out of the servers usercache
       
   158   $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 .
       
   159   $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
       
   160   $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
       
   161   $ hg init empty
       
   162   $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
       
   163   >   --config 'web.allow_push=*' --config web.push_ssl=False
       
   164   $ cat hg.pid >> $DAEMON_PIDS
       
   165   $ hg push -R r7 http://localhost:$HGPORT1
       
   166   pushing to http://localhost:$HGPORT1/
       
   167   searching for changes
       
   168   remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
       
   169   abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
       
   170   [255]
       
   171   $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
       
   172 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
       
   173   $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
       
   174   $ hg push -R r7 http://localhost:$HGPORT1
       
   175   pushing to http://localhost:$HGPORT1/
       
   176   searching for changes
       
   177   remote: adding changesets
       
   178   remote: adding manifests
       
   179   remote: adding file changes
       
   180   remote: added 2 changesets with 2 changes to 2 files
       
   181   $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
       
   182   server side corruption
       
   183   $ rm -rf empty
       
   184 
       
   185 Push a largefiles repository to a served empty repository
       
   186   $ hg init r8
       
   187   $ echo c3 > r8/f1
       
   188   $ hg add --large r8/f1 -R r8
       
   189   $ hg commit -m "m1" -R r8
       
   190   Invoking status precommit hook
       
   191   A f1
       
   192   $ hg init empty
       
   193   $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
       
   194   >   --config 'web.allow_push=*' --config web.push_ssl=False
       
   195   $ cat hg.pid >> $DAEMON_PIDS
       
   196   $ rm "${USERCACHE}"/*
       
   197   $ hg push -R r8 http://localhost:$HGPORT2/#default
       
   198   pushing to http://localhost:$HGPORT2/
       
   199   searching for changes
       
   200   remote: adding changesets
       
   201   remote: adding manifests
       
   202   remote: adding file changes
       
   203   remote: added 1 changesets with 1 changes to 1 files
       
   204   $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
       
   205   $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
       
   206 
       
   207 Clone over http, no largefiles pulled on clone.
       
   208 
       
   209   $ hg clone http://localhost:$HGPORT2/#default http-clone -U
       
   210   adding changesets
       
   211   adding manifests
       
   212   adding file changes
       
   213   added 1 changesets with 1 changes to 1 files
       
   214 
       
   215 test 'verify' with remotestore:
       
   216 
       
   217   $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
       
   218   $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
       
   219   $ hg -R http-clone verify --large --lfa
       
   220   checking changesets
       
   221   checking manifests
       
   222   crosschecking files in changesets and manifests
       
   223   checking files
       
   224   1 files, 1 changesets, 1 total revisions
       
   225   searching 1 changesets for largefiles
       
   226   changeset 0:cf03e5bb9936: f1 missing
       
   227   verified existence of 1 revisions of 1 largefiles
       
   228   [1]
       
   229   $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
       
   230   $ hg -R http-clone -q verify --large --lfa
       
   231 
       
   232 largefiles pulled on update - a largefile missing on the server:
       
   233   $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
       
   234   $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
       
   235   getting changed largefiles
       
   236   f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
       
   237   0 largefiles updated, 0 removed
       
   238   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   239   $ hg -R http-clone st
       
   240   ! f1
       
   241   $ hg -R http-clone up -Cqr null
       
   242 
       
   243 largefiles pulled on update - a largefile corrupted on the server:
       
   244   $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
       
   245   $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
       
   246   getting changed largefiles
       
   247   f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
       
   248   0 largefiles updated, 0 removed
       
   249   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   250   $ hg -R http-clone st
       
   251   ! f1
       
   252   $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
       
   253   $ [ ! -f http-clone/f1 ]
       
   254   $ [ ! -f http-clone-usercache ]
       
   255   $ hg -R http-clone verify --large --lfc
       
   256   checking changesets
       
   257   checking manifests
       
   258   crosschecking files in changesets and manifests
       
   259   checking files
       
   260   1 files, 1 changesets, 1 total revisions
       
   261   searching 1 changesets for largefiles
       
   262   verified contents of 1 revisions of 1 largefiles
       
   263   $ hg -R http-clone up -Cqr null
       
   264 
       
   265 largefiles pulled on update - no server side problems:
       
   266   $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
       
   267   $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache
       
   268   resolving manifests
       
   269    branchmerge: False, force: False, partial: False
       
   270    ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936
       
   271    .hglf/f1: remote created -> g
       
   272   getting .hglf/f1
       
   273   updating: .hglf/f1 1/1 files (100.00%)
       
   274   getting changed largefiles
       
   275   using http://localhost:$HGPORT2/
       
   276   sending capabilities command
       
   277   sending batch command
       
   278   getting largefiles: 0/1 lfile (0.00%)
       
   279   getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
       
   280   sending getlfile command
       
   281   found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
       
   282   1 largefiles updated, 0 removed
       
   283   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   284 
       
   285   $ ls http-clone-usercache/*
       
   286   http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
       
   287 
       
   288   $ rm -rf empty http-clone*
       
   289 
       
   290 used all HGPORTs, kill all daemons
       
   291   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
       
   292 
       
   293 #endif