tests/test-convert-clonebranches
author Patrick Mezard <pmezard@gmail.com>
Mon, 15 Jun 2009 00:03:26 +0200
changeset 8810 ac92775b3b80
parent 6723 1fe6f365df2e
child 10119 bb5ea66789e3
permissions -rwxr-xr-x
Add patch.eol to ignore EOLs when patching (issue1019) The intent is to fix many issues involving patching when win32ext is enabled. With win32ext, the working directory and repository files EOLs are not the same which means that patches made on a non-win32ext host do not apply cleanly because of EOLs discrepancies. A theorically correct approach would be transform either the patched file or the patch content with the encoding/decoding filters used by win32ext. This solution is tricky to implement and invasive, instead we prefer to address the win32ext case, by offering a way to ignore input EOLs when patching and rewriting them when saving the patched result.
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
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
echo "hgext.convert = " >> $HGRCPATH
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