comparison tests/test-convert-git @ 5380:a5a7f7fd5554

convert_git: add --filemap support
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 04 Oct 2007 23:21:37 -0300
parents 8ab7de07f40e
children
comparison
equal deleted inserted replaced
5379:d3e51dc804f8 5380:a5a7f7fd5554
2 2
3 "$TESTDIR/hghave" git || exit 80 3 "$TESTDIR/hghave" git || exit 80
4 4
5 echo "[extensions]" >> $HGRCPATH 5 echo "[extensions]" >> $HGRCPATH
6 echo "convert=" >> $HGRCPATH 6 echo "convert=" >> $HGRCPATH
7 echo 'hgext.graphlog =' >> $HGRCPATH
7 8
8 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME 9 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
9 GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL 10 GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
10 GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE 11 GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
11 GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME 12 GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
52 cd .. 53 cd ..
53 54
54 hg convert --datesort git-repo 55 hg convert --datesort git-repo
55 56
56 hg -R git-repo-hg tip -v 57 hg -R git-repo-hg tip -v
58
59 count=10
60 mkdir git-repo2
61 cd git-repo2
62 git init-db >/dev/null 2>/dev/null
63
64 echo foo > foo
65 git add foo
66 commit -a -m 'add foo'
67
68 echo >> foo
69 commit -a -m 'change foo'
70
71 git checkout -b Bar HEAD^ >/dev/null 2>/dev/null
72 echo quux >> quux
73 git add quux
74 commit -a -m 'add quux'
75
76 echo bar > bar
77 git add bar
78 commit -a -m 'add bar'
79
80 git checkout -b Baz HEAD^ >/dev/null 2>/dev/null
81 echo baz > baz
82 git add baz
83 commit -a -m 'add baz'
84
85 git checkout master >/dev/null 2>/dev/null
86 git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
87 commit -m 'Octopus merge'
88
89 echo bar >> bar
90 commit -a -m 'change bar'
91
92 git checkout -b Foo HEAD^ >/dev/null 2>/dev/null
93 echo >> foo
94 commit -a -m 'change foo'
95
96 git checkout master >/dev/null 2>/dev/null
97 git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
98 commit -m 'Discard change to foo'
99
100 cd ..
101
102 glog()
103 {
104 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
105 }
106
107 splitrepo()
108 {
109 msg="$1"
110 files="$2"
111 opts=$3
112 echo "% $files: $msg"
113 prefix=`echo "$files" | sed -e 's/ /-/g'`
114 fmap="$prefix.fmap"
115 repo="$prefix.repo"
116 for i in $files; do
117 echo "include $i" >> "$fmap"
118 done
119 hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
120 glog -R "$repo"
121 hg -R "$repo" manifest --debug
122 }
123
124 echo '% full conversion'
125 hg -q convert --datesort git-repo2 fullrepo
126 glog -R fullrepo
127 hg -R fullrepo manifest --debug
128
129 splitrepo 'octopus merge' 'foo bar baz'
130
131 splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
132