tests/test-pull-pull-corruption.t
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
Thu, 05 May 2011 12:53:33 +0200
changeset 14199 e3dd3dcd6059
parent 13439 d724a69309e0
child 16481 37e0872b5ced
permissions -rw-r--r--
treediscovery: fix regression when run against older repos (issue2793) I ran the entire test suite with "known" and "getbundle" disabled in localrepository. This generated failures because the old findoutgoing had always queried remote's heads explicitly and thus always got them back in the returned heads. treediscovery.findcommonincoming now correctly returns remote's heads in all cases. Also adds a dedicated test for running treediscovery against a pre-getbundle HTTP server.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     1
Corrupt an hg repo with two pulls.
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     2
create one repo with a long history
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     3
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     4
  $ hg init source1
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     5
  $ cd source1
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     6
  $ touch foo
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     7
  $ hg add foo
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     8
  $ for i in 1 2 3 4 5 6 7 8 9 10; do
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
     9
  >     echo $i >> foo
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    10
  >     hg ci -m $i
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    11
  > done
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    12
  $ cd ..
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    13
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    14
create one repo with a shorter history
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    15
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    16
  $ hg clone -r 0 source1 source2
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    17
  adding changesets
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    18
  adding manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    19
  adding file changes
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    20
  added 1 changesets with 1 changes to 1 files
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    21
  updating to branch default
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    22
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    23
  $ cd source2
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    24
  $ echo a >> foo
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    25
  $ hg ci -m a
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    26
  $ cd ..
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    27
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    28
create a third repo to pull both other repos into it
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    29
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    30
  $ hg init corrupted
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    31
  $ cd corrupted
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    32
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    33
use a hook to make the second pull start while the first one is still running
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    34
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    35
  $ echo '[hooks]' >> .hg/hgrc
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    36
  $ echo 'prechangegroup = sleep 5' >> .hg/hgrc
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    37
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    38
start a pull...
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    39
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    40
  $ hg pull ../source1 &
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    41
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    42
... and start another pull before the first one has finished
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    43
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    44
  $ sleep 1
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 12847
diff changeset
    45
  pulling from ../source1
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 12847
diff changeset
    46
  requesting all changes
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    47
  $ hg pull ../source2 2>/dev/null
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    48
  pulling from ../source2
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    49
  adding changesets
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    50
  adding manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    51
  adding file changes
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    52
  added 10 changesets with 10 changes to 1 files
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    53
  (run 'hg update' to get a working copy)
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    54
  searching for changes
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    55
  adding changesets
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    56
  adding manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    57
  adding file changes
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    58
  added 1 changesets with 1 changes to 1 files (+1 heads)
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    59
  (run 'hg heads' to see heads, 'hg merge' to merge)
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    60
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    61
see the result
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    62
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    63
  $ wait
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    64
  $ hg verify
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    65
  checking changesets
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    66
  checking manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    67
  crosschecking files in changesets and manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    68
  checking files
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
    69
  1 files, 11 changesets, 11 total revisions