tests/test-convert-darcs
author Matt Mackall <mpm@selenic.com>
Sun, 26 Sep 2010 13:41:32 -0500
changeset 12421 0ae7cad68842
parent 12407 5bfab61c2fee
permissions -rwxr-xr-x
tests: unify test-eol-add
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
"$TESTDIR/hghave" darcs || exit 80
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
echo "[extensions]" >> $HGRCPATH
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
echo "convert=" >> $HGRCPATH
10119
bb5ea66789e3 tests: load with "ext =" instead of "hgext.ext ="
Martin Geisler <mg@lazybytes.net>
parents: 9527
diff changeset
     7
echo 'graphlog =' >> $HGRCPATH
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
9326
b236f34ec1e9 Fix failing darcs test
Bryan O'Sullivan <bos@serpentine.com>
parents: 8523
diff changeset
    10
HOME=`pwd`/do_not_use_HOME_darcs; export HOME
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
5520
cc3af86ab6fe test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5442
diff changeset
    12
# skip if we can't import elementtree
cc3af86ab6fe test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5442
diff changeset
    13
mkdir dummy
cc3af86ab6fe test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5442
diff changeset
    14
mkdir dummy/_darcs
cc3af86ab6fe test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5442
diff changeset
    15
if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then
5685
57d29a45ffbc Use skipped: instead of hghave: for skipping tests, use this in test-merge-types
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5667
diff changeset
    16
    echo 'skipped: missing feature: elementtree module'
5520
cc3af86ab6fe test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5442
diff changeset
    17
    exit 80
cc3af86ab6fe test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5442
diff changeset
    18
fi
cc3af86ab6fe test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5442
diff changeset
    19
12393
84ceedcfeb6a convert/darcs: improve unsupported format detection (issue2172)
Patrick Mezard <pmezard@gmail.com>
parents: 12252
diff changeset
    20
echo '% try converting darcs1 repository'
12407
5bfab61c2fee tests: fold darcs test repository into a bundle
Matt Mackall <mpm@selenic.com>
parents: 12393
diff changeset
    21
hg clone -q "$TESTDIR/darcs1.hg" darcs
5bfab61c2fee tests: fold darcs test repository into a bundle
Matt Mackall <mpm@selenic.com>
parents: 12393
diff changeset
    22
hg convert -s darcs darcs/darcs1 2>&1 | grep darcs-1.0
12393
84ceedcfeb6a convert/darcs: improve unsupported format detection (issue2172)
Patrick Mezard <pmezard@gmail.com>
parents: 12252
diff changeset
    23
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
echo % initialize darcs repo
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
mkdir darcs-repo
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
cd darcs-repo
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
darcs init
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
echo a > a
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
darcs record -a -l -m p0
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
cd ..
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
echo % branch and update
5667
f29b7c8419cb Fix test-convert-darcs output on Debian etch (issue779)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5520
diff changeset
    33
darcs get darcs-repo darcs-clone >/dev/null
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
cd darcs-clone
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
echo c >> a
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
echo c > c
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
darcs record -a -l -m p1.1
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
cd ..
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
echo % update source
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
cd darcs-repo
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
echo b >> a
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
echo b > b
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
darcs record -a -l -m p1.2
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
echo % merge branch
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
darcs pull -a ../darcs-clone
9326
b236f34ec1e9 Fix failing darcs test
Bryan O'Sullivan <bos@serpentine.com>
parents: 8523
diff changeset
    48
sleep 1
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
echo e > a
9526
457a30ed8ffb convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents: 9326
diff changeset
    50
echo f > f
9527
b3c13e721593 convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents: 9526
diff changeset
    51
mkdir dir
b3c13e721593 convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents: 9526
diff changeset
    52
echo d > dir/d
b3c13e721593 convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents: 9526
diff changeset
    53
echo d > dir/d2
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
darcs record -a -l -m p2
9526
457a30ed8ffb convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents: 9326
diff changeset
    55
457a30ed8ffb convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents: 9326
diff changeset
    56
echo % test file and directory move
457a30ed8ffb convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents: 9326
diff changeset
    57
darcs mv f ff
9527
b3c13e721593 convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents: 9526
diff changeset
    58
# Test remove + move
b3c13e721593 convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents: 9526
diff changeset
    59
darcs remove dir/d2
b3c13e721593 convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents: 9526
diff changeset
    60
rm dir/d2
b3c13e721593 convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents: 9526
diff changeset
    61
darcs mv dir dir2
9526
457a30ed8ffb convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents: 9326
diff changeset
    62
darcs record -a -l -m p3
12252
4481f8a93c7a convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354)
Brodie Rao <brodie@bitheap.org>
parents: 10119
diff changeset
    63
4481f8a93c7a convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354)
Brodie Rao <brodie@bitheap.org>
parents: 10119
diff changeset
    64
echo % test utf-8 commit message and author
4481f8a93c7a convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354)
Brodie Rao <brodie@bitheap.org>
parents: 10119
diff changeset
    65
echo g > g
4481f8a93c7a convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354)
Brodie Rao <brodie@bitheap.org>
parents: 10119
diff changeset
    66
# darcs is encoding agnostic, so it takes whatever bytes it's given
4481f8a93c7a convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354)
Brodie Rao <brodie@bitheap.org>
parents: 10119
diff changeset
    67
darcs record -a -l -m 'p4: desc ñ' -A 'author ñ'
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
glog()
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    70
{
12252
4481f8a93c7a convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354)
Brodie Rao <brodie@bitheap.org>
parents: 10119
diff changeset
    71
    HGENCODING=utf-8 hg glog --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@"
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    72
}
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    73
12252
4481f8a93c7a convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354)
Brodie Rao <brodie@bitheap.org>
parents: 10119
diff changeset
    74
cd ..
9326
b236f34ec1e9 Fix failing darcs test
Bryan O'Sullivan <bos@serpentine.com>
parents: 8523
diff changeset
    75
hg convert darcs-repo darcs-repo-hg
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    76
# The converter does not currently handle patch conflicts very well.
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    77
# When they occur, it reverts *all* changes and moves forward,
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    78
# letting the conflict resolving patch fix collisions.
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    79
# Unfortunately, non-conflicting changes, like the addition of the
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    80
# "c" file in p1.1 patch are reverted too.
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    81
# Just to say that manifest not listing "c" here is a bug.
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    82
glog -R darcs-repo-hg
6799
12d1e1e79faf Fix tests failures introduced by 7239e06e58e9
Patrick Mezard <pmezard@gmail.com>
parents: 5685
diff changeset
    83
hg up -q -R darcs-repo-hg
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    84
hg -R darcs-repo-hg manifest --debug