2018-01-23 23:09:16 +03:00
|
|
|
$ . helpers-usechg.sh
|
|
|
|
|
2014-08-06 20:43:59 +04:00
|
|
|
#require svn svn-bindings
|
2010-09-21 20:40:33 +04:00
|
|
|
|
2016-03-11 08:47:39 +03:00
|
|
|
$ filter_svn_output () {
|
2016-03-14 18:14:53 +03:00
|
|
|
> egrep -v 'Committing|Updating|(^$)' | sed -e 's/done$//' || true
|
2016-03-11 08:47:39 +03: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 =
|
2011-02-25 21:01:30 +03:00
|
|
|
> [convert]
|
|
|
|
> svn.trunk = mytrunk
|
2010-09-21 20:40:33 +04:00
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ svnadmin create svn-repo
|
2012-06-26 05:35:22 +04:00
|
|
|
$ SVNREPOPATH=`pwd`/svn-repo
|
|
|
|
#if windows
|
2014-10-15 23:35:59 +04:00
|
|
|
$ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
|
2012-06-26 05:35:22 +04:00
|
|
|
#else
|
2014-10-15 23:35:59 +04:00
|
|
|
$ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
|
2012-06-26 05:35:22 +04:00
|
|
|
#endif
|
2013-04-26 05:01:00 +04:00
|
|
|
$ INVALIDREVISIONID=svn:x2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk@1
|
|
|
|
$ VALIDREVISIONID=svn:a2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk/mytrunk@1
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
|
|
Now test that it works with trunk/tags layout, but no branches yet.
|
|
|
|
|
|
|
|
Initial svn import
|
|
|
|
|
|
|
|
$ mkdir projB
|
|
|
|
$ cd projB
|
2011-02-25 21:01:30 +03:00
|
|
|
$ mkdir mytrunk
|
2010-09-21 20:40:33 +04:00
|
|
|
$ mkdir tags
|
|
|
|
$ cd ..
|
|
|
|
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | filter_svn_output | sort
|
2017-12-11 06:50:57 +03:00
|
|
|
Adding projB/mytrunk
|
|
|
|
Adding projB/tags
|
2010-09-21 20:40:33 +04:00
|
|
|
Committed revision 1.
|
|
|
|
|
|
|
|
Update svn repository
|
|
|
|
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn co "$SVNREPOURL/proj%20B/mytrunk" B | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
Checked out revision 1.
|
|
|
|
$ cd B
|
|
|
|
$ echo hello > 'letter .txt'
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn add 'letter .txt' | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
A letter .txt
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn ci -m hello | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
Adding letter .txt
|
|
|
|
Transmitting file data .
|
|
|
|
Committed revision 2.
|
|
|
|
|
2015-06-08 22:44:30 +03:00
|
|
|
$ svn-safe-append.py world 'letter .txt'
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn ci -m world | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
Sending letter .txt
|
|
|
|
Transmitting file data .
|
|
|
|
Committed revision 3.
|
|
|
|
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn copy -m "tag v0.1" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.1" | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
Committed revision 4.
|
|
|
|
|
2015-06-08 22:44:30 +03:00
|
|
|
$ svn-safe-append.py 'nice day today!' 'letter .txt'
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn ci -m "nice day" | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
Sending letter .txt
|
|
|
|
Transmitting file data .
|
|
|
|
Committed revision 5.
|
|
|
|
$ cd ..
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
Convert to hg once and also test localtimezone option
|
2010-09-21 20:40:33 +04:00
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
NOTE: This doesn't check all time zones -- it merely determines that
|
|
|
|
the configuration option is taking effect.
|
|
|
|
|
|
|
|
An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected
|
|
|
|
since it does not use DST (unlike other U.S. time zones) and is always
|
|
|
|
a fixed difference from UTC.
|
|
|
|
|
|
|
|
$ TZ=US/Hawaii hg convert --config convert.localtimezone=True "$SVNREPOURL/proj%20B" B-hg
|
2010-09-21 20:40:33 +04:00
|
|
|
initializing destination B-hg repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
3 init projB
|
|
|
|
2 hello
|
|
|
|
1 world
|
|
|
|
0 nice day
|
|
|
|
updating tags
|
|
|
|
|
|
|
|
Update svn repository again
|
|
|
|
|
|
|
|
$ cd B
|
2015-06-08 22:44:30 +03:00
|
|
|
$ svn-safe-append.py "see second letter" 'letter .txt'
|
2010-09-21 20:40:33 +04:00
|
|
|
$ echo "nice to meet you" > letter2.txt
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn add letter2.txt | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
A letter2.txt
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn ci -m "second letter" | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
Sending letter .txt
|
|
|
|
Adding letter2.txt
|
|
|
|
Transmitting file data ..
|
|
|
|
Committed revision 6.
|
|
|
|
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn copy -m "tag v0.2" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.2" | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
Committed revision 7.
|
|
|
|
|
2015-06-08 22:44:30 +03:00
|
|
|
$ svn-safe-append.py "blah-blah-blah" letter2.txt
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn ci -m "work in progress" | filter_svn_output
|
2010-09-21 20:40:33 +04:00
|
|
|
Sending letter2.txt
|
|
|
|
Transmitting file data .
|
|
|
|
Committed revision 8.
|
|
|
|
$ cd ..
|
|
|
|
|
2012-06-26 05:35:22 +04:00
|
|
|
$ hg convert -s svn "$SVNREPOURL/proj%20B/non-existent-path" dest
|
2011-05-01 19:35:05 +04:00
|
|
|
initializing destination dest repository
|
|
|
|
abort: no revision found in module /proj B/non-existent-path
|
|
|
|
[255]
|
|
|
|
|
2010-09-21 20:40:33 +04:00
|
|
|
########################################
|
|
|
|
|
|
|
|
Test incremental conversion
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
$ TZ=US/Hawaii hg convert --config convert.localtimezone=True "$SVNREPOURL/proj%20B" B-hg
|
2010-09-21 20:40:33 +04:00
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
1 second letter
|
|
|
|
0 work in progress
|
|
|
|
updating tags
|
|
|
|
|
|
|
|
$ cd B-hg
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --template '{rev} {desc|firstline} date: {date|date} files: {files}\n'
|
2012-11-19 02:26:50 +04:00
|
|
|
o 7 update tags date: * +0000 files: .hgtags (glob)
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 6 work in progress date: * -1000 files: letter2.txt (glob)
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 5 second letter date: * -1000 files: letter .txt letter2.txt (glob)
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 4 update tags date: * +0000 files: .hgtags (glob)
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 3 nice day date: * -1000 files: letter .txt (glob)
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 2 world date: * -1000 files: letter .txt (glob)
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 1 hello date: * -1000 files: letter .txt (glob)
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 0 init projB date: * -1000 files: (glob)
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
|
|
$ hg tags -q
|
|
|
|
tip
|
|
|
|
v0.2
|
|
|
|
v0.1
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
Test filemap
|
|
|
|
$ echo 'include letter2.txt' > filemap
|
2012-06-26 05:35:22 +04:00
|
|
|
$ hg convert --filemap filemap "$SVNREPOURL/proj%20B/mytrunk" fmap
|
2010-09-21 20:40:33 +04:00
|
|
|
initializing destination fmap repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
5 init projB
|
|
|
|
4 hello
|
|
|
|
3 world
|
|
|
|
2 nice day
|
|
|
|
1 second letter
|
|
|
|
0 work in progress
|
2011-02-25 21:01:30 +03:00
|
|
|
$ hg -R fmap branch -q
|
|
|
|
default
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G -R fmap --template '{rev} {desc|firstline} files: {files}\n'
|
2010-09-21 20:40:33 +04:00
|
|
|
o 1 work in progress files: letter2.txt
|
|
|
|
|
|
|
|
|
o 0 second letter files: letter2.txt
|
|
|
|
|
convert: introduce --full for converting all files
Convert will normally only process files that were changed in a source
revision, apply the filemap, and record it has a change in the target
repository. (If it ends up not really changing anything, nothing changes.)
That means that _if_ the filemap is changed before continuing an incremental
convert, the change will only kick in when the files it affects are modified in
a source revision and thus processed.
With --full, convert will make a full conversion every time and process
all files in the source repo and remove target repo files that shouldn't be
there. Filemap changes will thus kick in on the first converted revision, no
matter what is changed.
This flag should in most cases not make any difference but will make convert
significantly slower.
Other names has been considered for this feature, such as "resync", "sync",
"checkunmodified", "all" or "allfiles", but I found that they were less obvious
and required more explanation than "full" and were harder to describe
consistently.
2014-08-27 00:03:32 +04:00
|
|
|
Convert with --full adds and removes files that didn't change
|
|
|
|
|
|
|
|
$ cd B
|
|
|
|
$ echo >> "letter .txt"
|
2016-03-11 08:47:39 +03:00
|
|
|
$ svn ci -m 'nothing' | filter_svn_output
|
convert: introduce --full for converting all files
Convert will normally only process files that were changed in a source
revision, apply the filemap, and record it has a change in the target
repository. (If it ends up not really changing anything, nothing changes.)
That means that _if_ the filemap is changed before continuing an incremental
convert, the change will only kick in when the files it affects are modified in
a source revision and thus processed.
With --full, convert will make a full conversion every time and process
all files in the source repo and remove target repo files that shouldn't be
there. Filemap changes will thus kick in on the first converted revision, no
matter what is changed.
This flag should in most cases not make any difference but will make convert
significantly slower.
Other names has been considered for this feature, such as "resync", "sync",
"checkunmodified", "all" or "allfiles", but I found that they were less obvious
and required more explanation than "full" and were harder to describe
consistently.
2014-08-27 00:03:32 +04:00
|
|
|
Sending letter .txt
|
|
|
|
Transmitting file data .
|
|
|
|
Committed revision 9.
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ echo 'rename letter2.txt letter3.txt' > filemap
|
|
|
|
$ hg convert --filemap filemap --full "$SVNREPOURL/proj%20B/mytrunk" fmap
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
0 nothing
|
|
|
|
$ hg -R fmap st --change tip
|
|
|
|
A letter .txt
|
|
|
|
A letter3.txt
|
|
|
|
R letter2.txt
|
|
|
|
|
2013-04-26 05:01:00 +04:00
|
|
|
test invalid splicemap1
|
|
|
|
|
|
|
|
$ cat > splicemap <<EOF
|
|
|
|
> $INVALIDREVISIONID $VALIDREVISIONID
|
|
|
|
> EOF
|
|
|
|
$ hg convert --splicemap splicemap "$SVNREPOURL/proj%20B/mytrunk" smap
|
|
|
|
initializing destination smap repository
|
|
|
|
abort: splicemap entry svn:x2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk@1 is not a valid revision identifier
|
|
|
|
[255]
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
|
|
Test stop revision
|
2012-06-26 05:35:22 +04:00
|
|
|
$ hg convert --rev 1 "$SVNREPOURL/proj%20B/mytrunk" stoprev
|
2010-09-21 20:40:33 +04:00
|
|
|
initializing destination stoprev repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
0 init projB
|
2011-02-25 21:01:30 +03:00
|
|
|
$ hg -R stoprev branch -q
|
|
|
|
default
|
2010-09-21 20:40:33 +04:00
|
|
|
|
|
|
|
Check convert_revision extra-records.
|
|
|
|
This is also the only place testing more than one extra field in a revision.
|
|
|
|
|
|
|
|
$ cd stoprev
|
|
|
|
$ hg tip --debug | grep extra
|
|
|
|
extra: branch=default
|
2011-02-25 21:01:30 +03:00
|
|
|
extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re)
|
2010-09-21 20:40:33 +04:00
|
|
|
$ cd ..
|
2012-04-18 16:04:58 +04:00
|
|
|
|
2014-02-07 20:29:37 +04:00
|
|
|
Test converting empty heads (issue3347).
|
|
|
|
Also tests getting logs directly without debugsvnlog.
|
2012-04-18 16:04:58 +04:00
|
|
|
|
|
|
|
$ svnadmin create svn-empty
|
|
|
|
$ svnadmin load -q svn-empty < "$TESTDIR/svn/empty.svndump"
|
2014-02-07 20:29:37 +04:00
|
|
|
$ hg --config convert.svn.trunk= --config convert.svn.debugsvnlog=0 convert svn-empty
|
2012-04-18 16:04:58 +04:00
|
|
|
assuming destination svn-empty-hg
|
|
|
|
initializing destination svn-empty-hg repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
1 init projA
|
|
|
|
0 adddir
|
2012-06-26 05:35:22 +04:00
|
|
|
$ hg --config convert.svn.trunk= convert "$SVNREPOURL/../svn-empty/trunk"
|
2012-04-18 16:04:58 +04:00
|
|
|
assuming destination trunk-hg
|
|
|
|
initializing destination trunk-hg repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
1 init projA
|
|
|
|
0 adddir
|
2014-12-12 23:53:17 +03:00
|
|
|
|
|
|
|
Test that a too-new repository format is properly rejected:
|
|
|
|
$ mv svn-empty/format format
|
|
|
|
$ echo 999 > svn-empty/format
|
|
|
|
It's important that this command explicitly specify svn, otherwise it
|
|
|
|
can have surprising side effects (like falling back to a perforce
|
|
|
|
depot that can be seen from the test environment and slurping from that.)
|
|
|
|
$ hg convert --source-type svn svn-empty this-will-fail
|
|
|
|
initializing destination this-will-fail repository
|
|
|
|
file:/*/$TESTTMP/svn-empty does not look like a Subversion repository to libsvn version 1.*.* (glob)
|
|
|
|
abort: svn-empty: missing or unsupported repository
|
|
|
|
[255]
|
|
|
|
$ mv format svn-empty/format
|