tests/test-bundle-vs-outgoing
author Sune Foldager <cryo@cyanite.org>
Sun, 07 Feb 2010 15:23:46 +0100
changeset 10379 a78bfaf988e1
parent 9821 7d2e9121ef4f
permissions -rwxr-xr-x
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9821
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     2
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     3
# this structure seems to tickle a bug in bundle's search for
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     4
# changesets, so first we have to recreate it
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     5
#
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     6
# o  8
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     7
# |
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     8
# | o  7
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
     9
# | |
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    10
# | o  6
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    11
# |/|
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    12
# o |  5
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    13
# | |
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    14
# o |  4
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    15
# | |
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    16
# | o  3
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    17
# | |
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    18
# | o  2
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    19
# |/
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    20
# o  1
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    21
# |
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    22
# o  0
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    23
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    24
mkrev()
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    25
{
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    26
    revno=$1
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    27
    echo "rev $revno"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    28
    echo "rev $revno" > foo.txt
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    29
    hg -q ci -m"rev $revno"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    30
}
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    31
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    32
set -e
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    33
echo "% setup test repo1"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    34
hg init repo1
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    35
cd repo1
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    36
echo "rev 0" > foo.txt
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    37
hg ci -Am"rev 0"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    38
mkrev 1
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    39
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    40
# first branch
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    41
mkrev 2
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    42
mkrev 3
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    43
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    44
# back to rev 1 to create second branch
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    45
hg up -r1
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    46
mkrev 4
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    47
mkrev 5
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    48
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    49
# merge first branch to second branch
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    50
hg up -C -r5
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    51
HGMERGE=internal:local hg merge
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    52
echo "merge rev 5, rev 3" > foo.txt
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    53
hg ci -m"merge first branch to second branch"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    54
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    55
# one more commit following the merge
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    56
mkrev 7
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    57
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    58
# back to "second branch" to make another head
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    59
hg up -r5
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    60
mkrev 8
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    61
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    62
echo "[extensions]" >> $HGRCPATH
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    63
echo "graphlog=" >> $HGRCPATH
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    64
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    65
echo "% the story so far"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    66
hg glog --template "{rev}\n"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    67
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    68
# check that "hg outgoing" really does the right thing
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    69
echo "% sanity check of outgoing: expect revs 4 5 6 7 8"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    70
hg clone -r3 . ../repo2
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    71
# this should (and does) report 5 outgoing revisions: 4 5 6 7 8
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    72
hg outgoing --template "{rev}\n" ../repo2
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    73
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    74
echo "% test bundle (destination repo): expect 5 revisions"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    75
# this should bundle the same 5 revisions that outgoing reported, but it
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    76
# actually bundles 7
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    77
hg bundle foo.bundle ../repo2
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    78
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    79
echo "% test bundle (base revision): expect 5 revisions"
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    80
# this should (and does) give exactly the same result as bundle
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    81
# with a destination repo... i.e. it's wrong too
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    82
hg bundle --base 3 foo.bundle
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    83
7d2e9121ef4f bundle: add test for Issue1704
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
    84