tests/test-convert-baz
author Alexander Solovyov <piranha@piranha.org.ua>
Thu, 25 Dec 2008 10:48:24 +0200
changeset 7547 4949729ee9ee
parent 6799 12d1e1e79faf
child 7567 0946294d1f32
permissions -rwxr-xr-x
python implementation of diffstat Implemented as two functions: diffstat, which yields lines of text, formatted as a usual diffstat output, and diffstatdata, which is called inside diffstat to do real performing and yield file names with appropriate data (numbers of added and removed lines).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6078
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
     1
#!/bin/sh
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
     2
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
     3
"$TESTDIR/hghave" baz || exit 80
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
     4
6101
abb1c451a88e Define tla username locally in baz and tla tests
Patrick Mezard <pmezard@gmail.com>
parents: 6084
diff changeset
     5
mkdir do_not_use_HOME_baz
abb1c451a88e Define tla username locally in baz and tla tests
Patrick Mezard <pmezard@gmail.com>
parents: 6084
diff changeset
     6
cd do_not_use_HOME_baz
abb1c451a88e Define tla username locally in baz and tla tests
Patrick Mezard <pmezard@gmail.com>
parents: 6084
diff changeset
     7
HOME=`pwd`; export HOME
abb1c451a88e Define tla username locally in baz and tla tests
Patrick Mezard <pmezard@gmail.com>
parents: 6084
diff changeset
     8
cd ..
6102
4e351c03a31a test-convert-baz: set username with baz, not tla
Patrick Mezard <pmezard@gmail.com>
parents: 6101
diff changeset
     9
baz my-id "mercurial <mercurial@selenic.com>"
6084
a672df805855 Document and fix tla/baz conversion tests
Patrick Mezard <pmezard@gmail.com>
parents: 6078
diff changeset
    10
6078
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    11
echo "[extensions]" >> $HGRCPATH
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    12
echo "convert=" >> $HGRCPATH
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    13
echo 'hgext.graphlog =' >> $HGRCPATH
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    14
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    15
echo % create baz archive
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    16
baz make-archive baz@mercurial--convert hg-test-convert-baz
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    17
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    18
echo % initialize baz repo
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    19
mkdir baz-repo
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    20
cd baz-repo/
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    21
baz init-tree baz@mercurial--convert/baz--test--0
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    22
baz import
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    23
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    24
echo % create initial files
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    25
echo 'this is a file' > a
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    26
baz add a
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    27
mkdir src
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    28
baz add src
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    29
cd src
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    30
dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    31
baz add b
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    32
baz commit -s "added a file, src and src/b (binary)"
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    33
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    34
echo % create link file and modify a
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    35
ln -s ../a a-link
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    36
baz add a-link
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    37
echo 'this a modification to a' >> ../a
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    38
baz commit -s "added link to a and modify a"
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    39
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    40
echo % create second link and modify b
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    41
ln -s ../a a-link-2
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    42
baz add a-link-2
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    43
dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    44
baz commit -s "added second link and modify b"
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    45
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    46
echo % b file to link and a-link-2 to regular file
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    47
rm -f a-link-2
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    48
echo 'this is now a regular file' > a-link-2
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    49
ln -sf ../a b
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    50
baz commit -s "file to link and link to file test"
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    51
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    52
echo % move a-link-2 file and src directory
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    53
cd ..
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    54
baz mv src/a-link-2 c
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    55
baz mv src test
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    56
baz commit -s "move and rename a-link-2 file and src directory"
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    57
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    58
cd ..
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    59
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    60
echo % converting baz repo to Mercurial
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    61
hg convert baz-repo baz-repo-hg
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    62
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    63
baz register-archive -d baz@mercurial--convert
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    64
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    65
glog()
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    66
{
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    67
    hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    68
}
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    69
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    70
echo % show graph log
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    71
glog -R baz-repo-hg
6799
12d1e1e79faf Fix tests failures introduced by 7239e06e58e9
Patrick Mezard <pmezard@gmail.com>
parents: 6102
diff changeset
    72
hg up -q -R baz-repo-hg
6078
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    73
hg -R baz-repo-hg manifest --debug