tests/test-convert-svn-source
changeset 5513 f0c58fd4b798
parent 5462 91a522a69c13
child 5782 7eb1146b72ec
equal deleted inserted replaced
5512:8cd26ccc68f8 5513:f0c58fd4b798
       
     1 #!/bin/sh
       
     2 
       
     3 "$TESTDIR/hghave" svn svn-bindings || exit 80
       
     4 
       
     5 fix_path()
       
     6 {
       
     7     tr '\\' /
       
     8 }
       
     9 
       
    10 echo "[extensions]" >> $HGRCPATH
       
    11 echo "convert = " >> $HGRCPATH
       
    12 
       
    13 svnadmin create svn-repo
       
    14 
       
    15 echo % initial svn import
       
    16 mkdir t
       
    17 cd t
       
    18 echo a > a
       
    19 cd ..
       
    20 
       
    21 svnpath=`pwd | fix_path`
       
    22 # SVN wants all paths to start with a slash. Unfortunately,
       
    23 # Windows ones don't. Handle that.
       
    24 expr $svnpath : "\/" > /dev/null
       
    25 if [ $? -ne 0 ]; then
       
    26     svnpath='/'$svnpath
       
    27 fi
       
    28 
       
    29 svnurl=file://$svnpath/svn-repo/trunk
       
    30 svn import -m init t $svnurl | fix_path
       
    31 
       
    32 echo % update svn repository
       
    33 svn co $svnurl t2 | fix_path
       
    34 cd t2
       
    35 echo b >> a
       
    36 echo b > b
       
    37 svn add b
       
    38 svn ci -m changea
       
    39 cd ..
       
    40 
       
    41 echo % convert to hg once
       
    42 hg convert $svnurl
       
    43 
       
    44 echo % update svn repository again
       
    45 cd t2
       
    46 echo c >> a
       
    47 echo c >> b
       
    48 svn ci -m changeb
       
    49 cd ..
       
    50 
       
    51 echo % test incremental conversion
       
    52 hg convert $svnurl
       
    53 
       
    54 echo % test filemap
       
    55 echo 'include b' > filemap
       
    56 hg convert --filemap filemap $svnurl fmap
       
    57 echo '[extensions]' >> $HGRCPATH
       
    58 echo 'hgext.graphlog =' >> $HGRCPATH
       
    59 hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n'
       
    60 
       
    61 ########################################
       
    62 
       
    63 echo "# now tests that it works with trunk/branches/tags layout"
       
    64 echo
       
    65 echo % initial svn import
       
    66 mkdir projA
       
    67 cd projA
       
    68 mkdir trunk
       
    69 mkdir branches
       
    70 mkdir tags
       
    71 cd ..
       
    72 
       
    73 svnurl=file://$svnpath/svn-repo/projA
       
    74 svn import -m "init projA" projA $svnurl | fix_path
       
    75 
       
    76 
       
    77 echo % update svn repository
       
    78 svn co $svnurl/trunk A | fix_path
       
    79 cd A
       
    80 echo hello > letter.txt
       
    81 svn add letter.txt
       
    82 svn ci -m hello
       
    83 
       
    84 echo world >> letter.txt
       
    85 svn ci -m world
       
    86 
       
    87 svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1
       
    88 
       
    89 echo 'nice day today!' >> letter.txt
       
    90 svn ci -m "nice day"
       
    91 cd ..
       
    92 
       
    93 echo % convert to hg once
       
    94 hg convert $svnurl A-hg
       
    95 
       
    96 echo % update svn repository again
       
    97 cd A
       
    98 echo "see second letter" >> letter.txt
       
    99 echo "nice to meet you" > letter2.txt
       
   100 svn add letter2.txt
       
   101 svn ci -m "second letter"
       
   102 
       
   103 svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2
       
   104 
       
   105 echo "blah-blah-blah" >> letter2.txt
       
   106 svn ci -m "work in progress"
       
   107 cd ..
       
   108 
       
   109 echo % test incremental conversion
       
   110 hg convert $svnurl A-hg
       
   111 
       
   112 cd A-hg
       
   113 hg glog --template '#rev# #desc|firstline# files: #files#\n'
       
   114 hg tags -q
       
   115 cd ..