2014-08-06 20:43:59 +04:00
|
|
|
#require svn svn-bindings
|
2010-09-21 20:40:33 +04:00
|
|
|
|
2011-03-01 19:01:17 +03:00
|
|
|
$ cat >> $HGRCPATH <<EOF
|
2010-09-21 20:40:33 +04:00
|
|
|
> [extensions]
|
2012-08-08 20:10:37 +04:00
|
|
|
> convert =
|
2010-09-21 20:40:33 +04:00
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ svnadmin create svn-repo
|
|
|
|
$ svnadmin load -q svn-repo < "$TESTDIR/svn/branches.svndump"
|
|
|
|
|
|
|
|
Convert trunk and branches
|
|
|
|
|
|
|
|
$ cat > branchmap <<EOF
|
|
|
|
> old3 newbranch
|
2012-08-08 20:10:37 +04:00
|
|
|
>
|
2012-02-28 13:06:35 +04:00
|
|
|
>
|
2010-09-21 20:40:33 +04:00
|
|
|
> EOF
|
|
|
|
$ hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg
|
|
|
|
initializing destination A-hg repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
10 init projA
|
|
|
|
9 hello
|
|
|
|
8 branch trunk, remove c and dir
|
|
|
|
7 change a
|
|
|
|
6 change b
|
|
|
|
5 move and update c
|
|
|
|
4 move and update c
|
|
|
|
3 change b again
|
|
|
|
2 move to old2
|
|
|
|
1 move back to old
|
|
|
|
0 last change to a
|
|
|
|
|
2011-03-18 00:17:27 +03:00
|
|
|
Test template keywords
|
|
|
|
|
|
|
|
$ hg -R A-hg log --template '{rev} {svnuuid}{svnpath}@{svnrev}\n'
|
|
|
|
10 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@10
|
|
|
|
9 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@9
|
|
|
|
8 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old2@8
|
|
|
|
7 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@7
|
|
|
|
6 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@6
|
|
|
|
5 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@6
|
|
|
|
4 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@5
|
|
|
|
3 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@4
|
|
|
|
2 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@3
|
|
|
|
1 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@2
|
|
|
|
0 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@1
|
|
|
|
|
2010-09-21 20:40:33 +04:00
|
|
|
Convert again
|
|
|
|
|
|
|
|
$ hg convert --branchmap=branchmap --datesort svn-repo A-hg
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
0 branch trunk@1 into old3
|
|
|
|
|
|
|
|
$ cd A-hg
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
|
2010-09-21 20:40:33 +04:00
|
|
|
o branch=newbranch 11 branch trunk@1 into old3 files:
|
|
|
|
|
|
|
|
|
| o branch= 10 last change to a files: a
|
|
|
|
| |
|
|
|
|
| | o branch=old 9 move back to old files:
|
|
|
|
| | |
|
|
|
|
| | o branch=old2 8 move to old2 files:
|
|
|
|
| | |
|
|
|
|
| | o branch=old 7 change b again files: b
|
|
|
|
| | |
|
|
|
|
| o | branch= 6 move and update c files: b
|
|
|
|
| | |
|
|
|
|
| | o branch=old 5 move and update c files: c
|
|
|
|
| | |
|
|
|
|
| | o branch=old 4 change b files: b
|
|
|
|
| | |
|
|
|
|
| o | branch= 3 change a files: a
|
|
|
|
| | |
|
|
|
|
| | o branch=old 2 branch trunk, remove c and dir files: c
|
|
|
|
| |/
|
|
|
|
| o branch= 1 hello files: a b c dir/e
|
|
|
|
|/
|
|
|
|
o branch= 0 init projA files:
|
|
|
|
|
|
|
|
|
|
|
|
$ hg branches
|
2011-05-02 21:20:29 +04:00
|
|
|
newbranch 11:a6d7cc050ad1
|
|
|
|
default 10:6e2b33404495
|
|
|
|
old 9:93c4b0f99529
|
|
|
|
old2 8:b52884d7bead (inactive)
|
2010-09-21 20:40:33 +04:00
|
|
|
$ hg tags -q
|
|
|
|
tip
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
Test hg failing to call itself
|
|
|
|
|
2012-08-03 19:59:21 +04:00
|
|
|
$ HG=foobar hg convert svn-repo B-hg 2>&1 | grep abort
|
2010-09-21 20:40:33 +04:00
|
|
|
abort: Mercurial failed to run itself, check hg executable is in PATH
|
2014-01-28 07:00:23 +04:00
|
|
|
|
|
|
|
Convert 'trunk' to branch other than 'default'
|
|
|
|
|
|
|
|
$ cat > branchmap <<EOF
|
2015-07-14 16:40:56 +03:00
|
|
|
> default hgtrunk
|
2014-01-28 07:00:23 +04:00
|
|
|
>
|
|
|
|
>
|
|
|
|
> EOF
|
|
|
|
$ hg convert --branchmap=branchmap --datesort -r 10 svn-repo C-hg
|
|
|
|
initializing destination C-hg repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
10 init projA
|
|
|
|
9 hello
|
|
|
|
8 branch trunk, remove c and dir
|
|
|
|
7 change a
|
|
|
|
6 change b
|
|
|
|
5 move and update c
|
|
|
|
4 move and update c
|
|
|
|
3 change b again
|
|
|
|
2 move to old2
|
|
|
|
1 move back to old
|
|
|
|
0 last change to a
|
|
|
|
|
|
|
|
$ cd C-hg
|
2015-07-14 16:40:56 +03:00
|
|
|
$ hg branches --template '{branch}\n'
|
|
|
|
hgtrunk
|
|
|
|
old
|
|
|
|
old2
|
2014-01-28 07:00:23 +04:00
|
|
|
$ cd ..
|