tests/test-convert-clonebranches
author Yuya Nishihara <yuya@tcha.org>
Fri, 21 May 2010 20:55:18 +0900
changeset 11208 2313dc4d9817
parent 10119 bb5ea66789e3
permissions -rwxr-xr-x
tests: fix bashism to load helpers.sh `source` isn't available at POSIX sh.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
10119
bb5ea66789e3 tests: load with "ext =" instead of "hgext.ext ="
Martin Geisler <mg@lazybytes.net>
parents: 6723
diff changeset
     4
echo "convert = " >> $HGRCPATH
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
echo "[convert]" >> $HGRCPATH
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
echo "hg.tagsbranch=0" >> $HGRCPATH
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
hg init source
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
cd source
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
echo a > a
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
hg ci -qAm adda
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
# Add a merge with one parent in the same branch
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
echo a >> a
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
hg ci -qAm changea
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
hg up -qC 0
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
hg branch branch0
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
echo b > b
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
hg ci -qAm addb
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
hg up -qC
6723
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5934
diff changeset
    20
hg merge default
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
hg ci -qm mergeab
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
hg tag -ql mergeab
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
cd ..
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
# Miss perl... sometimes
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
cat > filter.py <<EOF
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
import sys, re
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
r = re.compile(r'^(?:\d+|pulling from)')
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
sys.stdout.writelines([l for l in sys.stdin if r.search(l)])
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
EOF
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
echo % convert
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
hg convert -v --config convert.hg.clonebranches=1 source dest |
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
    python filter.py
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
# Add a merge with both parents and child in different branches
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
cd source
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
hg branch branch1
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
echo a > file1
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
hg ci -qAm c1
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
hg up -qC mergeab
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
hg branch branch2
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
echo a > file2
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
hg ci -qAm c2
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
hg merge branch1
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
hg branch branch3
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
hg ci -qAm c3
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
cd ..
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
echo % incremental conversion
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
hg convert -v --config convert.hg.clonebranches=1 source dest |
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
    python filter.py
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54