##// END OF EJS Templates
tests: unify test-mq
tests: unify test-mq

File last commit:

r10990:bb377a31 stable
r11894:a15936ac default
Show More
test-convert-git
186 lines | 3.9 KiB | text/plain | TextLexer
Patrick Mezard
Test git repository conversion
r5219 #!/bin/sh
"$TESTDIR/hghave" git || exit 80
echo "[extensions]" >> $HGRCPATH
echo "convert=" >> $HGRCPATH
Alexis S. L. Carvalho
convert_git: add --filemap support
r5380 echo 'hgext.graphlog =' >> $HGRCPATH
Patrick Mezard
Test git repository conversion
r5219
Alexis S. L. Carvalho
convert_git: avoid returning two entries for the same file in getchanges...
r5335 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
count=10
commit()
{
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
count=`expr $count + 1`
}
Patrick Mezard
Test git repository conversion
r5219 mkdir git-repo
cd git-repo
Thomas Arendsen Hein
Make test-convert-git compatible with other git versions (tested with 1.4.4.3)
r5231 git init-db >/dev/null 2>/dev/null
Patrick Mezard
Test git repository conversion
r5219 echo a > a
Patrick Mezard
Test mercurial convert sink removes empty directories.
r5345 mkdir d
echo b > d/b
git add a d
commit -a -m t1
# Remove the directory, then try to replace it with a file
# (issue 754)
Thomas Arendsen Hein
test-convert-git: support older git client (1.4.4.4)
r5369 git rm -f d/b
Patrick Mezard
Test mercurial convert sink removes empty directories.
r5345 commit -m t2
echo d > d
git add d
commit -m t3
Alexis S. L. Carvalho
convert_git: avoid returning two entries for the same file in getchanges...
r5335
Patrick Mezard
Test git repository conversion
r5219 echo b >> a
Patrick Mezard
Test mercurial convert sink removes empty directories.
r5345 commit -a -m t4.1
Alexis S. L. Carvalho
convert_git: avoid returning two entries for the same file in getchanges...
r5335
Mads Kiilerich
test-convert-git: Use ~ instead of ^...
r9434 git checkout -b other HEAD~ >/dev/null 2>/dev/null
Alexis S. L. Carvalho
convert_git: avoid returning two entries for the same file in getchanges...
r5335 echo c > a
echo a >> a
Patrick Mezard
Test mercurial convert sink removes empty directories.
r5345 commit -a -m t4.2
Alexis S. L. Carvalho
convert_git: avoid returning two entries for the same file in getchanges...
r5335
git checkout master >/dev/null 2>/dev/null
git pull --no-commit . other > /dev/null 2>/dev/null
commit -m 'Merge branch other'
Patrick Mezard
Test git repository conversion
r5219 cd ..
Alexis S. L. Carvalho
convert_git: avoid returning two entries for the same file in getchanges...
r5335 hg convert --datesort git-repo
Matt Mackall
context: consistently return p1 context for None
r6737 hg up -q -R git-repo-hg
Alexis S. L. Carvalho
convert_git: avoid returning two entries for the same file in getchanges...
r5335 hg -R git-repo-hg tip -v
Alexis S. L. Carvalho
convert_git: add --filemap support
r5380
count=10
mkdir git-repo2
cd git-repo2
git init-db >/dev/null 2>/dev/null
echo foo > foo
git add foo
commit -a -m 'add foo'
echo >> foo
commit -a -m 'change foo'
Mads Kiilerich
test-convert-git: Use ~ instead of ^...
r9434 git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
Alexis S. L. Carvalho
convert_git: add --filemap support
r5380 echo quux >> quux
git add quux
commit -a -m 'add quux'
echo bar > bar
git add bar
commit -a -m 'add bar'
Mads Kiilerich
test-convert-git: Use ~ instead of ^...
r9434 git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
Alexis S. L. Carvalho
convert_git: add --filemap support
r5380 echo baz > baz
git add baz
commit -a -m 'add baz'
git checkout master >/dev/null 2>/dev/null
git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
commit -m 'Octopus merge'
echo bar >> bar
commit -a -m 'change bar'
Mads Kiilerich
test-convert-git: Use ~ instead of ^...
r9434 git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
Alexis S. L. Carvalho
convert_git: add --filemap support
r5380 echo >> foo
commit -a -m 'change foo'
git checkout master >/dev/null 2>/dev/null
git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
commit -m 'Discard change to foo'
cd ..
glog()
{
Martin Geisler
tests: replace #...# syntax with {...}
r8523 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
Alexis S. L. Carvalho
convert_git: add --filemap support
r5380 }
splitrepo()
{
msg="$1"
files="$2"
opts=$3
echo "% $files: $msg"
prefix=`echo "$files" | sed -e 's/ /-/g'`
fmap="$prefix.fmap"
repo="$prefix.repo"
for i in $files; do
echo "include $i" >> "$fmap"
done
hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
Matt Mackall
context: consistently return p1 context for None
r6737 hg up -q -R "$repo"
Alexis S. L. Carvalho
convert_git: add --filemap support
r5380 glog -R "$repo"
hg -R "$repo" manifest --debug
}
echo '% full conversion'
hg -q convert --datesort git-repo2 fullrepo
Matt Mackall
context: consistently return p1 context for None
r6737 hg up -q -R fullrepo
Alexis S. L. Carvalho
convert_git: add --filemap support
r5380 glog -R fullrepo
hg -R fullrepo manifest --debug
splitrepo 'octopus merge' 'foo bar baz'
splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
Patrick Mezard
convert: read git output in binary mode under Windows (issue 1359)
r7222 echo
echo '% test binary conversion (issue 1359)'
mkdir git-repo3
cd git-repo3
git init-db >/dev/null 2>/dev/null
python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
git add b
commit -a -m addbinary
cd ..
echo '% convert binary file'
hg convert git-repo3 git-repo3-hg
cd git-repo3-hg
hg up -C
python -c 'print len(file("b", "rb").read())'
Richard Quirk
Add committer tag only when needed in git conversion...
r8271 cd ..
Patrick Mezard
convert: read git output in binary mode under Windows (issue 1359)
r7222
Richard Quirk
Add committer tag only when needed in git conversion...
r8271 echo
echo '% test author vs committer'
mkdir git-repo4
cd git-repo4
git init-db >/dev/null 2>/dev/null
echo >> foo
git add foo
commit -a -m addfoo
echo >> foo
GIT_AUTHOR_NAME="nottest"
commit -a -m addfoo2
cd ..
echo '% convert author committer'
hg convert git-repo4 git-repo4-hg
Patrick Mezard
convert: fail fast if source does not support --sourcesort
r8691 hg -R git-repo4-hg log -v
echo '% --sourceorder should fail'
hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
Patrick Mezard
convert/git: check status when reading output stream
r10987 echo '% damage git repository and convert again'
cat > damage.py <<EOF
import os
for root, dirs, files in os.walk('git-repo4/.git/objects'):
if files:
path = os.path.join(root, files[0])
os.remove(path)
break
EOF
python damage.py
hg convert git-repo4 git-repo4-broken-hg 2>&1 | \
Patrick Mezard
test-convert-git: be tolerant to git output variants
r10990 grep 'abort:' | sed 's/abort:.*/abort:/g'
Patrick Mezard
convert/git: check status when reading output stream
r10987
Patrick Mezard
convert: fail fast if source does not support --sourcesort
r8691 true