tests/test-convert-darcs
author Bryan O'Sullivan <bos@serpentine.com>
Wed, 10 Oct 2007 15:48:08 -0700
changeset 5442 a19167001251
parent 5413 719fd175181f
child 5520 cc3af86ab6fe
permissions -rwxr-xr-x
test-convert-darcs: don't let $HOME/.darcs pollute the test environment
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
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
echo 'hgext.graphlog =' >> $HGRCPATH
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
5442
a19167001251 test-convert-darcs: don't let $HOME/.darcs pollute the test environment
Bryan O'Sullivan <bos@serpentine.com>
parents: 5413
diff changeset
    10
HOME=do_not_use_HOME_darcs; export HOME
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
echo % initialize darcs repo
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
mkdir darcs-repo
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
cd darcs-repo
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
darcs init
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
echo a > a
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
darcs record -a -l -m p0
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
cd ..
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
echo % branch and update
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
darcs get darcs-repo darcs-clone
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
cd darcs-clone
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
echo c >> a
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
echo c > c
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
darcs record -a -l -m p1.1
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
cd ..
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
echo % update source
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
cd darcs-repo
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
echo b >> a
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
echo b > b
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
darcs record -a -l -m p1.2
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
echo % merge branch
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
darcs pull -a ../darcs-clone
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
echo e > a
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
darcs record -a -l -m p2
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
glog()
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
{
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
    hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
}
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
hg convert darcs-repo darcs-repo-hg
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
# The converter does not currently handle patch conflicts very well.
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
# When they occur, it reverts *all* changes and moves forward,
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
# letting the conflict resolving patch fix collisions.
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
# Unfortunately, non-conflicting changes, like the addition of the
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
# "c" file in p1.1 patch are reverted too.
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
# Just to say that manifest not listing "c" here is a bug.
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
glog -R darcs-repo-hg
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
hg -R darcs-repo-hg manifest --debug