comparison tests/test-convert-mtn @ 6372:8f79820443a4

Add a test for monotone conversion
author Patrick Mezard <pmezard@gmail.com>
date Sun, 23 Mar 2008 23:18:20 +0100
parents
children b40e90341ae2
comparison
equal deleted inserted replaced
6371:b2f1d97d10eb 6372:8f79820443a4
1 #!/bin/sh
2
3 "$TESTDIR/hghave" mtn || exit 80
4
5 # Monotone directory is called .monotone on *nix and monotone
6 # on Windows. Having a variable here ease test patching.
7 mtndir=.monotone
8 echo "[extensions]" >> $HGRCPATH
9 echo "convert=" >> $HGRCPATH
10 echo 'hgext.graphlog =' >> $HGRCPATH
11
12 HOME=`pwd`/do_not_use_HOME_mtn; export HOME
13 # Windows version of monotone home
14 APPDATA=$HOME; export APPDATA
15
16 echo % tedious monotone keys configuration
17 # The /dev/null redirection is necessary under Windows, or
18 # it complains about home directory permissions
19 mtn --quiet genkey test@selenic.com 1>/dev/null 2>&1 <<EOF
20 passphrase
21 passphrase
22 EOF
23 cat >> $HOME/$mtndir/monotonerc <<EOF
24 function get_passphrase(keypair_id)
25 return "passphrase"
26 end
27 EOF
28
29 echo % create monotone repository
30 mtn db init --db=repo.mtn
31 mtn --db=repo.mtn --branch=com.selenic.test setup workingdir
32 cd workingdir
33 echo a > a
34 mkdir dir
35 echo b > dir/b
36 python -c 'file("bin", "wb").write("a\\x00b")'
37 echo c > c
38 mtn add a dir/b c bin
39 mtn ci -m initialize
40 echo % update monotone working directory
41 mtn mv a dir/a
42 echo a >> dir/a
43 echo b >> dir/b
44 mtn drop c
45 python -c 'file("bin", "wb").write("b\\x00c")'
46 mtn ci -m update1
47 cd ..
48
49 echo % convert once
50 hg convert -s mtn repo.mtn
51
52 cd workingdir
53 echo e > e
54 mtn add e
55 mtn drop dir/b
56 mtn mv bin bin2
57 mtn ci -m update2
58 cd ..
59
60 echo % convert incrementally
61 hg convert -s mtn repo.mtn
62
63 glog()
64 {
65 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
66 }
67
68 cd repo.mtn-hg
69 hg up -C
70 glog
71 echo % manifest
72 # BUG: c and dir/b should not appear here
73 hg manifest
74 echo % contents
75 cat dir/a
76