##// END OF EJS Templates
tests: fix builtin module test on pypy...
tests: fix builtin module test on pypy On pypy datetime and cProfile are modules written in Python, not in C. For the purpose of this test, just list them explicitely as builtins, which silences warnings about them being imported before stdlib modules.

File last commit:

r28663:ae279d4a 3.7.3 stable
r28713:806d260c default
Show More
test-convert-git.t
748 lines | 24.1 KiB | text/troff | Tads3Lexer
/ tests / test-convert-git.t
Matt Mackall
tests: replace exit 80 with #require
r22046 #require git
Matt Mackall
tests: unify test-convert-git
r12530
Eduard-Cristian Stefan
test-convert: disable autocrlf for git...
r16892 $ echo "[core]" >> $HOME/.gitconfig
$ echo "autocrlf = false" >> $HOME/.gitconfig
Eduard-Cristian Stefan
test-convert: disable autocrlf for git
r16954 $ echo "[core]" >> $HOME/.gitconfig
$ echo "autocrlf = false" >> $HOME/.gitconfig
Matt Mackall
tests: unify test-convert-git
r12530 $ echo "[extensions]" >> $HGRCPATH
$ echo "convert=" >> $HGRCPATH
$ 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
Ben Goswami
splicemap: improve error handling when source is git (issue2084)...
r19121 $ INVALIDID1=afd12345af
$ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
$ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357
$ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da
Matt Mackall
tests: unify test-convert-git
r12530 $ 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`
> }
$ mkdir git-repo
$ cd git-repo
$ git init-db >/dev/null 2>/dev/null
$ echo a > a
$ mkdir d
$ echo b > d/b
$ git add a d
$ commit -a -m t1
Matt Mackall
tests: fixup issue markers to make check-commit happy
r22183 Remove the directory, then try to replace it with a file (issue754)
Matt Mackall
tests: unify test-convert-git
r12530
$ git rm -f d/b
rm 'd/b'
$ commit -m t2
$ echo d > d
$ git add d
$ commit -m t3
$ echo b >> a
$ commit -a -m t4.1
$ git checkout -b other HEAD~ >/dev/null 2>/dev/null
$ echo c > a
$ echo a >> a
$ commit -a -m t4.2
$ git checkout master >/dev/null 2>/dev/null
$ git pull --no-commit . other > /dev/null 2>/dev/null
$ commit -m 'Merge branch other'
$ cd ..
Augie Fackler
test-convert-git.t: add a test of convert progress bars for git...
r22412 $ hg convert --config extensions.progress= --config progress.assume-tty=1 \
> --config progress.delay=0 --config progress.changedelay=0 \
> --config progress.refresh=0 --config progress.width=60 \
Christian Delahousse
convert: changed test's progress output format to ignore estimate...
r27002 > --config progress.format='topic, bar, number' --datesort git-repo
Augie Fackler
test-convert-git.t: add a test of convert progress bars for git...
r22412 \r (no-eol) (esc)
Augie Fackler
convert: enable deterministic conversion progress bar for git
r22413 scanning [======> ] 1/6\r (no-eol) (esc)
scanning [=============> ] 2/6\r (no-eol) (esc)
scanning [=====================> ] 3/6\r (no-eol) (esc)
scanning [============================> ] 4/6\r (no-eol) (esc)
scanning [===================================> ] 5/6\r (no-eol) (esc)
scanning [===========================================>] 6/6\r (no-eol) (esc)
Augie Fackler
test-convert-git.t: add a test of convert progress bars for git...
r22412 \r (no-eol) (esc)
\r (no-eol) (esc)
converting [ ] 0/6\r (no-eol) (esc)
getting files [==================> ] 1/2\r (no-eol) (esc)
getting files [======================================>] 2/2\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [======> ] 1/6\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [=============> ] 2/6\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [====================> ] 3/6\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [===========================> ] 4/6\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [==================================> ] 5/6\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
Matt Mackall
tests: unify test-convert-git
r12530 assuming destination git-repo-hg
initializing destination git-repo-hg repository
scanning source...
sorting...
converting...
5 t1
4 t2
3 t3
2 t4.1
1 t4.2
0 Merge branch other
Edouard Gomez
convert: add bookmarks reading support to git backend
r13756 updating bookmarks
Matt Mackall
tests: unify test-convert-git
r12530 $ hg up -q -R git-repo-hg
$ hg -R git-repo-hg tip -v
changeset: 5:c78094926be2
Edouard Gomez
convert: add bookmarks reading support to git backend
r13756 bookmark: master
Matt Mackall
tests: unify test-convert-git
r12530 tag: tip
parent: 3:f5f5cb45432b
parent: 4:4e174f80c67c
user: test <test@example.org>
date: Mon Jan 01 00:00:15 2007 +0000
files: a
description:
Merge branch other
$ 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'
$ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
$ echo quux >> quux
$ git add quux
$ commit -a -m 'add quux'
$ echo bar > bar
$ git add bar
$ commit -a -m 'add bar'
$ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
$ 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'
$ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
$ 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: don't load unnecessary graphlog extension...
r20117 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
Matt Mackall
tests: unify test-convert-git
r12530 > }
$ 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
Adrian Buehlmann
check-code: add 'no tab indent' check for unified tests...
r12743 > echo "include $i" >> "$fmap"
Matt Mackall
tests: unify test-convert-git
r12530 > done
> hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
> hg up -q -R "$repo"
> glog -R "$repo"
> hg -R "$repo" manifest --debug
> }
full conversion
Augie Fackler
test-convert-git: show insane progress bar with octopus merge (issue4169)...
r24327 $ hg convert --datesort git-repo2 fullrepo \
> --config extensions.progress= --config progress.assume-tty=1 \
> --config progress.delay=0 --config progress.changedelay=0 \
Christian Delahousse
convert: changed test's progress output format to ignore estimate...
r27002 > --config progress.refresh=0 --config progress.width=60 \
> --config progress.format='topic, bar, number'
Augie Fackler
test-convert-git: show insane progress bar with octopus merge (issue4169)...
r24327 \r (no-eol) (esc)
scanning [===> ] 1/9\r (no-eol) (esc)
scanning [========> ] 2/9\r (no-eol) (esc)
scanning [=============> ] 3/9\r (no-eol) (esc)
scanning [==================> ] 4/9\r (no-eol) (esc)
scanning [=======================> ] 5/9\r (no-eol) (esc)
scanning [============================> ] 6/9\r (no-eol) (esc)
scanning [=================================> ] 7/9\r (no-eol) (esc)
scanning [======================================> ] 8/9\r (no-eol) (esc)
scanning [===========================================>] 9/9\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [ ] 0/9\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [===> ] 1/9\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [========> ] 2/9\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [=============> ] 3/9\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [=================> ] 4/9\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [======================> ] 5/9\r (no-eol) (esc)
Augie Fackler
convert: adjust progress bar for octopus merges (issue4169)...
r24328 getting files [===> ] 1/8\r (no-eol) (esc)
getting files [========> ] 2/8\r (no-eol) (esc)
getting files [=============> ] 3/8\r (no-eol) (esc)
getting files [==================> ] 4/8\r (no-eol) (esc)
getting files [=======================> ] 5/8\r (no-eol) (esc)
getting files [============================> ] 6/8\r (no-eol) (esc)
getting files [=================================> ] 7/8\r (no-eol) (esc)
getting files [======================================>] 8/8\r (no-eol) (esc)
Augie Fackler
test-convert-git: show insane progress bar with octopus merge (issue4169)...
r24327 \r (no-eol) (esc)
\r (no-eol) (esc)
converting [===========================> ] 6/9\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [===============================> ] 7/9\r (no-eol) (esc)
getting files [======================================>] 1/1\r (no-eol) (esc)
\r (no-eol) (esc)
\r (no-eol) (esc)
converting [====================================> ] 8/9\r (no-eol) (esc)
getting files [==================> ] 1/2\r (no-eol) (esc)
getting files [======================================>] 2/2\r (no-eol) (esc)
\r (no-eol) (esc)
initializing destination fullrepo repository
scanning source...
sorting...
converting...
8 add foo
7 change foo
6 add quux
5 add bar
4 add baz
3 Octopus merge
2 change bar
1 change foo
0 Discard change to foo
updating bookmarks
Matt Mackall
tests: unify test-convert-git
r12530 $ hg up -q -R fullrepo
$ glog -R fullrepo
@ 9 "Discard change to foo" files: foo
|\
| o 8 "change foo" files: foo
| |
o | 7 "change bar" files: bar
|/
o 6 "(octopus merge fixup)" files:
|\
| o 5 "Octopus merge" files: baz
| |\
o | | 4 "add baz" files: baz
| | |
+---o 3 "add bar" files: bar
| |
o | 2 "add quux" files: quux
| |
| o 1 "change foo" files: foo
|/
o 0 "add foo" files: foo
$ hg -R fullrepo manifest --debug
245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
$ splitrepo 'octopus merge' 'foo bar baz'
% foo bar baz: octopus merge
@ 8 "Discard change to foo" files: foo
|\
| o 7 "change foo" files: foo
| |
o | 6 "change bar" files: bar
|/
o 5 "(octopus merge fixup)" files:
|\
| o 4 "Octopus merge" files: baz
| |\
o | | 3 "add baz" files: baz
| | |
+---o 2 "add bar" files: bar
| |
| o 1 "change foo" files: foo
|/
o 0 "add foo" files: foo
245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
$ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
% foo baz quux: only some parents of an octopus merge; "discard" a head
@ 6 "Discard change to foo" files: foo
|
o 5 "change foo" files: foo
|
o 4 "Octopus merge" files:
|\
| o 3 "add baz" files: baz
| |
| o 2 "add quux" files: quux
| |
o | 1 "change foo" files: foo
|/
o 0 "add foo" files: foo
354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
Siddharth Agarwal
convert: add support to detect git renames and copies...
r22470 test importing git renames and copies
$ cd git-repo2
$ git mv foo foo-renamed
since bar is not touched in this commit, this copy will not be detected
$ cp bar bar-copied
$ cp baz baz-copied
$ cp baz baz-copied2
Durham Goode
convert: fix git copy file content conversions...
r25997 $ cp baz ba-copy
Siddharth Agarwal
convert: add support to detect git renames and copies...
r22470 $ echo baz2 >> baz
Durham Goode
convert: fix git copy file content conversions...
r25997 $ git add bar-copied baz-copied baz-copied2 ba-copy
Siddharth Agarwal
convert: add support to detect git renames and copies...
r22470 $ commit -a -m 'rename and copy'
$ cd ..
input validation
$ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
Siddharth Agarwal
convert: simplify git.similarity parsing
r22511 abort: convert.git.similarity is not an integer ('foo')
Siddharth Agarwal
convert: add support to detect git renames and copies...
r22470 [255]
$ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
abort: similarity must be between 0 and 100
[255]
$ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
abort: similarity must be between 0 and 100
[255]
$ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
$ hg -R fullrepo status -C --change master
M baz
Durham Goode
convert: fix git copy file content conversions...
r25997 A ba-copy
baz
Siddharth Agarwal
convert: add support to detect git renames and copies...
r22470 A bar-copied
A baz-copied
baz
A baz-copied2
baz
A foo-renamed
foo
R foo
Durham Goode
convert: fix git copy file content conversions...
r25997 Ensure that the modification to the copy source was preserved
(there was a bug where if the copy dest was alphabetically prior to the copy
source, the copy source took the contents of the copy dest)
$ hg cat -r tip fullrepo/baz
baz
baz2
Siddharth Agarwal
convert: add support to find git copies from all files in the working copy...
r22471 $ cd git-repo2
Siddharth Agarwal
test-convert-git.t: make copy detection deterministic...
r22558 $ echo bar2 >> bar
$ commit -a -m 'change bar'
Siddharth Agarwal
convert: add support to find git copies from all files in the working copy...
r22471 $ cp bar bar-copied2
$ git add bar-copied2
$ commit -a -m 'copy with no changes'
$ cd ..
$ hg -q convert --config convert.git.similarity=100 \
> --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
$ hg -R fullrepo status -C --change master
A bar-copied2
bar
Matt Mackall
tests: fixup issue markers to make check-commit happy
r22183 test binary conversion (issue1359)
Matt Mackall
tests: unify test-convert-git
r12530
Siddharth Agarwal
convert: add support to detect git renames and copies...
r22470 $ count=19
Matt Mackall
tests: unify test-convert-git
r12530 $ mkdir git-repo3
$ cd git-repo3
$ git init-db >/dev/null 2>/dev/null
Augie Fackler
tests: use $PYTHON instead of hardcoding python...
r22947 $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
Matt Mackall
tests: unify test-convert-git
r12530 $ git add b
$ commit -a -m addbinary
$ cd ..
convert binary file
$ hg convert git-repo3 git-repo3-hg
initializing destination git-repo3-hg repository
scanning source...
sorting...
converting...
0 addbinary
Edouard Gomez
convert: add bookmarks reading support to git backend
r13756 updating bookmarks
Matt Mackall
tests: unify test-convert-git
r12530 $ cd git-repo3-hg
$ hg up -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Augie Fackler
tests: use $PYTHON instead of hardcoding python...
r22947 $ $PYTHON -c 'print len(file("b", "rb").read())'
Matt Mackall
tests: unify test-convert-git
r12530 4096
$ cd ..
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 ..
convert author committer
$ hg convert git-repo4 git-repo4-hg
initializing destination git-repo4-hg repository
scanning source...
sorting...
converting...
1 addfoo
0 addfoo2
Edouard Gomez
convert: add bookmarks reading support to git backend
r13756 updating bookmarks
Matt Mackall
tests: unify test-convert-git
r12530 $ hg -R git-repo4-hg log -v
changeset: 1:d63e967f93da
Edouard Gomez
convert: add bookmarks reading support to git backend
r13756 bookmark: master
Matt Mackall
tests: unify test-convert-git
r12530 tag: tip
user: nottest <test@example.org>
date: Mon Jan 01 00:00:21 2007 +0000
files: foo
description:
addfoo2
committer: test <test@example.org>
changeset: 0:0735477b0224
user: test <test@example.org>
date: Mon Jan 01 00:00:20 2007 +0000
files: foo
description:
addfoo
--sourceorder should fail
$ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
initializing destination git-repo4-sourcesort-hg repository
abort: --sourcesort is not supported by this data source
[255]
Durham Goode
convert: support multiple specifed revs in git source...
r25749 test converting certain branches
$ mkdir git-testrevs
$ cd git-testrevs
$ git init
Initialized empty Git repository in $TESTTMP/git-testrevs/.git/
$ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null
$ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null
$ git checkout -b goodbranch 'HEAD^'
Switched to a new branch 'goodbranch'
$ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null
$ git checkout -b badbranch 'HEAD^'
Switched to a new branch 'badbranch'
$ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null
$ cd ..
$ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch
initializing destination hg-testrevs repository
scanning source...
sorting...
converting...
2 first
1 good branch commit
0 master commit
updating bookmarks
$ cd hg-testrevs
$ hg log -G -T '{rev} {bookmarks}'
o 2 master
|
| o 1 goodbranch
|/
o 0
$ cd ..
YaNan Xu
convert: add support for converting git submodule (issue3528)...
r17929 test sub modules
$ mkdir git-repo5
$ cd git-repo5
$ git init-db >/dev/null 2>/dev/null
$ echo 'sub' >> foo
$ git add foo
$ commit -a -m 'addfoo'
Mads Kiilerich
tests: use `pwd` instead of ${PWD} in test-convert-git.t - because of Solaris
r18508 $ BASE=`pwd`
YaNan Xu
convert: add support for converting git submodule (issue3528)...
r17929 $ cd ..
$ mkdir git-repo6
$ cd git-repo6
$ git init-db >/dev/null 2>/dev/null
$ git submodule add ${BASE} >/dev/null 2>/dev/null
$ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
Durham Goode
convert: handle .gitmodules with non-tab whitespaces...
r25698
test non-tab whitespace .gitmodules
$ cat >> .gitmodules <<EOF
> [submodule "git-repo5"]
> path = git-repo5
Matt Harbison
test-convert-git: use a relative gitmodule url...
r25722 > url = git-repo5
Durham Goode
convert: handle .gitmodules with non-tab whitespaces...
r25698 > EOF
Matt Harbison
test-convert-git: stablize for git 1.7.7.6...
r25721 $ git commit -q -a -m "weird white space submodule"
Durham Goode
convert: handle .gitmodules with non-tab whitespaces...
r25698 $ cd ..
$ hg convert git-repo6 hg-repo6
initializing destination hg-repo6 repository
scanning source...
sorting...
converting...
1 addsubmodule
0 weird white space submodule
updating bookmarks
$ rm -rf hg-repo6
$ cd git-repo6
$ git reset --hard 'HEAD^' > /dev/null
Durham Goode
convert: improve support for unusual .gitmodules...
r25699
test missing .gitmodules
$ git submodule add ../git-repo4 >/dev/null 2>/dev/null
$ git checkout HEAD .gitmodules
$ git rm .gitmodules
rm '.gitmodules'
Matt Harbison
test-convert-git: stablize for git 1.7.7.6...
r25721 $ git commit -q -m "remove .gitmodules" .gitmodules
$ git commit -q -m "missing .gitmodules"
Durham Goode
convert: improve support for unusual .gitmodules...
r25699 $ cd ..
Matt Harbison
test-convert-git: drop a git warning that doesn't occur on Windows...
r26970 $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist"
Durham Goode
convert: improve support for unusual .gitmodules...
r25699 initializing destination hg-repo6 repository
scanning source...
sorting...
converting...
2 addsubmodule
1 remove .gitmodules
0 missing .gitmodules
warning: cannot read submodules config file in * (glob)
updating bookmarks
$ rm -rf hg-repo6
$ cd git-repo6
$ rm -rf git-repo4
$ git reset --hard 'HEAD^^' > /dev/null
YaNan Xu
convert: add support for converting git submodule (issue3528)...
r17929 $ cd ..
Ben Goswami
splicemap: improve error handling when source is git (issue2084)...
r19121 test invalid splicemap1
$ cat > splicemap <<EOF
> $VALIDID1
> EOF
$ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
initializing destination git-repo2-splicemap1-hg repository
abort: syntax error in splicemap(1): child parent1[,parent2] expected
[255]
test invalid splicemap2
$ cat > splicemap <<EOF
> $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
> EOF
$ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
initializing destination git-repo2-splicemap2-hg repository
abort: syntax error in splicemap(1): child parent1[,parent2] expected
[255]
test invalid splicemap3
$ cat > splicemap <<EOF
> $INVALIDID1 $INVALIDID2
> EOF
$ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
initializing destination git-repo2-splicemap3-hg repository
abort: splicemap entry afd12345af is not a valid revision identifier
[255]
YaNan Xu
convert: add support for converting git submodule (issue3528)...
r17929 convert sub modules
$ hg convert git-repo6 git-repo6-hg
initializing destination git-repo6-hg repository
scanning source...
sorting...
converting...
0 addsubmodule
updating bookmarks
$ hg -R git-repo6-hg log -v
changeset: 0:* (glob)
bookmark: master
tag: tip
user: nottest <test@example.org>
date: Mon Jan 01 00:00:23 2007 +0000
files: .hgsub .hgsubstate
description:
addsubmodule
committer: test <test@example.org>
$ cd git-repo6-hg
$ hg up >/dev/null 2>/dev/null
$ cat .hgsubstate
* git-repo5 (glob)
$ cd git-repo5
$ cat foo
sub
Ross Lagerwall
test-convert-git: stabilize corruption of test git repo...
r18571
$ cd ../..
Siddharth Agarwal
convert: add support to detect git renames and copies...
r22470 make sure rename detection doesn't break removing and adding gitmodules
$ cd git-repo6
$ git mv .gitmodules .gitmodules-renamed
$ commit -a -m 'rename .gitmodules'
$ git mv .gitmodules-renamed .gitmodules
$ commit -a -m 'rename .gitmodules back'
$ cd ..
$ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
$ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
rename .gitmodules
$ hg -R git-repo6-hg status -C --change 'tip^'
A .gitmodules-renamed
R .hgsub
R .hgsubstate
$ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
rename .gitmodules back
$ hg -R git-repo6-hg status -C --change tip
A .hgsub
A .hgsubstate
R .gitmodules-renamed
FUJIWARA Katsunori
convert: detect removal of ".gitmodules" at git source revisions correctly...
r21868 convert the revision removing '.gitmodules' itself (and related
submodules)
$ cd git-repo6
$ git rm .gitmodules
rm '.gitmodules'
$ git rm --cached git-repo5
rm 'git-repo5'
$ commit -a -m 'remove .gitmodules and submodule git-repo5'
$ cd ..
$ hg convert -q git-repo6 git-repo6-hg
$ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
remove .gitmodules and submodule git-repo5
$ hg -R git-repo6-hg tip -T "{file_dels}\n"
.hgsub .hgsubstate
Durham Goode
convert: add convert.git.skipsubmodules option...
r26077 skip submodules in the conversion
$ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True
$ hg -R no-submodules manifest --all
.gitmodules-renamed
Durham Goode
convert: allow customizing git remote prefix...
r25787 convert using a different remote prefix
$ git init git-repo7
Initialized empty Git repository in $TESTTMP/git-repo7/.git/
$ cd git-repo7
Augie Fackler
test-convert-git: work around output format changes in git...
r26040 TODO: it'd be nice to use (?) lines instead of grep -v to handle the
git output variance, but that doesn't currently work in the middle of
a block, so do this for now.
$ touch a && git add a && git commit -am "commit a" | grep -v changed
Durham Goode
convert: allow customizing git remote prefix...
r25787 [master (root-commit) 8ae5f69] commit a
Author: nottest <test@example.org>
create mode 100644 a
$ cd ..
$ git clone git-repo7 git-repo7-client
Cloning into 'git-repo7-client'...
done.
$ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
initializing destination hg-repo7 repository
scanning source...
sorting...
converting...
0 commit a
updating bookmarks
$ hg -R hg-repo7 bookmarks
master 0:03bf38caa4c6
origin/master 0:03bf38caa4c6
Durham Goode
convert: fix git convert using servers branches...
r25905 Run convert when the remote branches have changed
(there was an old bug where the local convert read branches from the server)
$ cd git-repo7
$ echo a >> a
Matt Harbison
test-convert-git: silence commit output for stablity...
r26903 $ git commit -q -am "move master forward"
Durham Goode
convert: fix git convert using servers branches...
r25905 $ cd ..
$ rm -rf hg-repo7
$ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
initializing destination hg-repo7 repository
scanning source...
sorting...
converting...
0 commit a
updating bookmarks
$ hg -R hg-repo7 bookmarks
master 0:03bf38caa4c6
origin/master 0:03bf38caa4c6
Ross Lagerwall
test-convert-git: stabilize corruption of test git repo...
r18571 damaged git repository tests:
In case the hard-coded hashes change, the following commands can be used to
list the hashes and their corresponding types in the repository:
cd git-repo4/.git/objects
find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
cd ../../..
damage git repository by renaming a commit object
$ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
$ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
$ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
Mateusz Kwapich
convert: rewrite calls to Git to use the new shelling mechanism (SEC)...
r28660 abort: cannot retrieve number of commits in git-repo4/.git
Ross Lagerwall
test-convert-git: stabilize corruption of test git repo...
r18571 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
damage git repository by renaming a blob object
$ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
$ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
$ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
$ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
damage git repository by renaming a tree object
$ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
$ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
$ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
Mateusz Kwapich
convert: test for shell injection in git calls (SEC)...
r28663
test for escaping the repo name (CVE-2016-3069)
$ git init '`echo pwned >COMMAND-INJECTION`'
Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/
$ cd '`echo pwned >COMMAND-INJECTION`'
$ git commit -q --allow-empty -m 'empty'
$ cd ..
$ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted'
initializing destination converted repository
scanning source...
sorting...
converting...
0 empty
updating bookmarks
$ test -f COMMAND-INJECTION
[1]