tests/fish-merge
author mpm@selenic.com
Sun, 29 May 2005 09:06:43 -0800
changeset 190 3dd5ce2fddb6
parent 28 9f64ee817199
child 544 3d4d5f2aba9a
child 547 4fc63e22b1fe
permissions -rw-r--r--
merge: short-circuit search for merge into empty repo -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 merge: short-circuit search for merge into empty repo We should have 3 cases for merge: - - we have no changesets - - we have less than half the changesets - - we have more than half the changesets For no changesets, we can immediately tell that we need everything. This happens when we initially branch from a remote repo, so we simply shortcircuit the search and grab everything from the root When we're actually tracking a project, we should generally have most of the changesets, so the current search algorithm should minimize searching. It should rarely occur that upstreams gets far ahead of us, in which case, we suffer a longer search. manifest hash: eabd55841b03225176ea72b985aad36431a438a9 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCmfajywK+sNU5EO8RAuyKAKCf7Nw6XSK5HEzbrZae7Q06e3dk4wCgjbK6 YUTEfkpPP1h3mNHIHRKz+aI= =eGMq -----END PGP SIGNATURE-----
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     1
set -e
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     2
set -x
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     3
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     4
# skip commit logs
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     5
export HGMERGE=tkmerge
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     6
export EDITOR=true
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     7
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     8
rm -rf m m1 m2
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
     9
mkdir m
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    10
cd m
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    11
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    12
echo "m     this  that"
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    13
echo "this" > a
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    14
echo "that" > b
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    15
hg init
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    16
hg addremove
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    17
hg commit
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    18
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    19
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    20
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    21
cd ..
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    22
echo "m2    this  that "
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    23
mkdir m2
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    24
cd m2
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    25
hg branch ../m
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    26
hg checkout
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    27
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    28
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    29
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    30
cd ../m
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    31
echo "m     this1 that "
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    32
echo "this1" > a
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    33
hg commit
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    34
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    35
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    36
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    37
cd ..
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    38
echo "m1    this1 that "
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    39
mkdir m1
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    40
cd m1
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    41
hg branch ../m
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    42
hg checkout
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    43
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    44
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    45
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    46
cd ../m1
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    47
echo "m1    this1 that1"
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    48
echo "that1" > b
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    49
hg commit
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    50
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    51
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    52
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    53
cd ../m2
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    54
echo "m2    this  that2"
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    55
echo "that2" > b
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    56
hg commit
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    57
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    58
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    59
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    60
cd ../m1
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    61
echo "m1:m2 this1 that1 that2"
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    62
hg merge ../m2 # b should conflict, a should be fine
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    63
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    64
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    65
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    66
cd ../m2
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    67
echo "m2    this2 that2"
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    68
echo "this2" > a
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    69
hg commit
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    70
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    71
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    72
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    73
cd ../m2
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    74
echo "m2:m this12 that2"
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    75
hg merge ../m # a should conflict, b should be fine
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    76
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    77
echo
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    78
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    79
# now here's the interesting bit
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    80
# if we choose ancestor by file, no conflicts
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    81
# otherwise we've got two equally close ancestors, each with a conflict
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    82
# if we go back to the root, we'll have both conflicts again
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    83
echo "m2:m1 this12 that12"
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    84
hg merge ../m1 # should be clean
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    85
echo "a:" `hg dump a` "b:" `hg dump b`
9f64ee817199 Add some tests to the repo
mpm@selenic.com
parents:
diff changeset
    86
echo