tests/test-clone-uncompressed.t
author Simon Farnsworth <simonfar@fb.com>
Mon, 06 Mar 2017 03:19:40 -0800
changeset 31204 84e8a6834223
parent 29064 9dc27a334fb1
child 31252 e7a35f18d91f
permissions -rw-r--r--
filemerge: tag merge tool for blocked times Merge tools can take a while - let's ensure that they're appropriately tagged
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27897
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
#require serve
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
28389
9ab45fbe045e bdiff: (pure) support array.array arrays (issue5130)
timeless <timeless@mozdev.org>
parents: 27897
diff changeset
     3
Initialize repository
9ab45fbe045e bdiff: (pure) support array.array arrays (issue5130)
timeless <timeless@mozdev.org>
parents: 27897
diff changeset
     4
the status call is to check for issue5130
9ab45fbe045e bdiff: (pure) support array.array arrays (issue5130)
timeless <timeless@mozdev.org>
parents: 27897
diff changeset
     5
27897
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  $ hg init server
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  $ cd server
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  $ touch foo
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
  $ hg -q commit -A -m initial
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
  >>> for i in range(1024):
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  ...     with open(str(i), 'wb') as fh:
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  ...         fh.write(str(i))
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  $ hg -q commit -A -m 'add a lot of files'
28389
9ab45fbe045e bdiff: (pure) support array.array arrays (issue5130)
timeless <timeless@mozdev.org>
parents: 27897
diff changeset
    14
  $ hg st
27897
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  $ hg serve -p $HGPORT -d --pid-file=hg.pid
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
  $ cat hg.pid >> $DAEMON_PIDS
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  $ cd ..
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
Basic clone
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
  $ hg clone --uncompressed -U http://localhost:$HGPORT clone1
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
  streaming all changes
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
  1027 files to transfer, 96.3 KB of data
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
  transferred 96.3 KB in * seconds (*/sec) (glob)
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    25
  searching for changes
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
  no changes found
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
Clone with background file closing enabled
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    30
  $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --uncompressed -U http://localhost:$HGPORT clone-background | grep -v adding
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
  using http://localhost:$HGPORT/
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    32
  sending capabilities command
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    33
  sending branchmap command
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    34
  streaming all changes
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    35
  sending stream_out command
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
  1027 files to transfer, 96.3 KB of data
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
  starting 4 threads for background file closing
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
  transferred 96.3 KB in * seconds (*/sec) (glob)
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
  query 1; heads
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    40
  sending batch command
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    41
  searching for changes
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    42
  all remote heads known locally
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
  no changes found
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
  sending getbundle command
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  bundle2-input-bundle: with-transaction
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    46
  bundle2-input-part: "listkeys" (params: 1 mandatory) supported
29064
9dc27a334fb1 bundle2: properly request phases during getbundle
Mike Hommey <mh@glandium.org>
parents: 28518
diff changeset
    47
  bundle2-input-part: total payload size 58
27897
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    48
  bundle2-input-part: "listkeys" (params: 1 mandatory) supported
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    49
  bundle2-input-bundle: 1 parts total
2fdbf22a1b63 streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    50
  checking for updated bookmarks
28517
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    51
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    52
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    53
Stream clone while repo is changing:
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    54
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    55
  $ mkdir changing
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    56
  $ cd changing
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    57
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    58
extension for delaying the server process so we reliably can modify the repo
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    59
while cloning
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    60
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    61
  $ cat > delayer.py <<EOF
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    62
  > import time
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    63
  > from mercurial import extensions, scmutil
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    64
  > def __call__(orig, self, path, *args, **kwargs):
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    65
  >     if path == 'data/f1.i':
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    66
  >         time.sleep(2)
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    67
  >     return orig(self, path, *args, **kwargs)
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    68
  > extensions.wrapfunction(scmutil.vfs, '__call__', __call__)
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    69
  > EOF
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    70
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    71
prepare repo with small and big file to cover both code paths in emitrevlogdata
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    72
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    73
  $ hg init repo
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    74
  $ touch repo/f1
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    75
  $ $TESTDIR/seq.py 50000 > repo/f2
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    76
  $ hg -R repo ci -Aqm "0"
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    77
  $ hg -R repo serve -p $HGPORT1 -d --pid-file=hg.pid --config extensions.delayer=delayer.py
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    78
  $ cat hg.pid >> $DAEMON_PIDS
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    79
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    80
clone while modifying the repo between stating file with write lock and
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    81
actually serving file content
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    82
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    83
  $ hg clone -q --uncompressed -U http://localhost:$HGPORT1 clone &
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    84
  $ sleep 1
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    85
  $ echo >> repo/f1
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    86
  $ echo >> repo/f2
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    87
  $ hg -R repo ci -m "1"
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    88
  $ wait
95163ababeb8 tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents: 28389
diff changeset
    89
  $ hg -R clone id
28518
aa440c3d7c5d streamclone: fix error when store files grow while stream cloning
Mads Kiilerich <madski@unity3d.com>
parents: 28517
diff changeset
    90
  000000000000