tests/test-convert-svn-source
changeset 6401 635c57cf0de8
parent 5954 851402e53337
child 6439 c1b47c0fd2b6
equal deleted inserted replaced
6400:c237b27e1350 6401:635c57cf0de8
     7     tr '\\' /
     7     tr '\\' /
     8 }
     8 }
     9 
     9 
    10 echo "[extensions]" >> $HGRCPATH
    10 echo "[extensions]" >> $HGRCPATH
    11 echo "convert = " >> $HGRCPATH
    11 echo "convert = " >> $HGRCPATH
       
    12 echo 'hgext.graphlog =' >> $HGRCPATH
    12 
    13 
    13 svnadmin create svn-repo
    14 svnadmin create svn-repo
    14 
       
    15 echo % initial svn import
       
    16 mkdir t
       
    17 cd t
       
    18 echo a > a
       
    19 cd ..
       
    20 
    15 
    21 svnpath=`pwd | fix_path`
    16 svnpath=`pwd | fix_path`
    22 # SVN wants all paths to start with a slash. Unfortunately,
    17 # SVN wants all paths to start with a slash. Unfortunately,
    23 # Windows ones don't. Handle that.
    18 # Windows ones don't. Handle that.
    24 expr $svnpath : "\/" > /dev/null
    19 expr $svnpath : "\/" > /dev/null
    25 if [ $? -ne 0 ]; then
    20 if [ $? -ne 0 ]; then
    26     svnpath='/'$svnpath
    21     svnpath='/'$svnpath
    27 fi
    22 fi
    28 
       
    29 svnurl=file://$svnpath/svn-repo/trunk/test
       
    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 -v $svnurl | sed 's/source:.*/source:/'
       
    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 echo % test stop revision
       
    62 hg convert --rev 1 $svnurl stoprev
       
    63 # Check convert_revision extra-records.
       
    64 # This is also the only place testing more than one extra field
       
    65 # in a revision.
       
    66 hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/'
       
    67 
       
    68 ########################################
       
    69 
       
    70 echo "# now tests that it works with trunk/branches/tags layout"
       
    71 echo
       
    72 echo % initial svn import
       
    73 mkdir projA
       
    74 cd projA
       
    75 mkdir trunk
       
    76 mkdir branches
       
    77 mkdir tags
       
    78 cd ..
       
    79 
       
    80 svnurl=file://$svnpath/svn-repo/projA
       
    81 svn import -m "init projA" projA $svnurl | fix_path
       
    82 
       
    83 
       
    84 echo % update svn repository
       
    85 svn co $svnurl/trunk A | fix_path
       
    86 cd A
       
    87 echo hello > letter.txt
       
    88 svn add letter.txt
       
    89 svn ci -m hello
       
    90 
       
    91 echo world >> letter.txt
       
    92 svn ci -m world
       
    93 
       
    94 svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1
       
    95 
       
    96 echo 'nice day today!' >> letter.txt
       
    97 svn ci -m "nice day"
       
    98 cd ..
       
    99 
       
   100 echo % convert to hg once
       
   101 hg convert $svnurl A-hg
       
   102 
       
   103 echo % update svn repository again
       
   104 cd A
       
   105 echo "see second letter" >> letter.txt
       
   106 # Put it in a subdirectory to test duplicate file records
       
   107 # from svn source (issue 714)
       
   108 mkdir todo
       
   109 echo "nice to meet you" > todo/letter2.txt
       
   110 svn add todo
       
   111 svn ci -m "second letter"
       
   112 
       
   113 svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2
       
   114 
       
   115 echo "blah-blah-blah" >> todo/letter2.txt
       
   116 svn ci -m "work in progress"
       
   117 cd ..
       
   118 
       
   119 echo % test incremental conversion
       
   120 hg convert $svnurl A-hg
       
   121 
       
   122 cd A-hg
       
   123 hg glog --template '#rev# #desc|firstline# files: #files#\n'
       
   124 hg tags -q
       
   125 cd ..
       
   126 
       
   127 ########################################
       
   128 
    23 
   129 echo "# now tests that it works with trunk/tags layout, but no branches yet"
    24 echo "# now tests that it works with trunk/tags layout, but no branches yet"
   130 echo
    25 echo
   131 echo % initial svn import
    26 echo % initial svn import
   132 mkdir projB
    27 mkdir projB
   169 
    64 
   170 echo "blah-blah-blah" >> letter2.txt
    65 echo "blah-blah-blah" >> letter2.txt
   171 svn ci -m "work in progress"
    66 svn ci -m "work in progress"
   172 cd ..
    67 cd ..
   173 
    68 
       
    69 ########################################
       
    70 
   174 echo % test incremental conversion
    71 echo % test incremental conversion
   175 hg convert $svnurl B-hg
    72 hg convert $svnurl B-hg
   176 
    73 
   177 cd B-hg
    74 cd B-hg
   178 hg glog --template '#rev# #desc|firstline# files: #files#\n'
    75 hg glog --template '#rev# #desc|firstline# files: #files#\n'
   179 hg tags -q
    76 hg tags -q
   180 cd ..
    77 cd ..
       
    78 
       
    79 echo % test filemap
       
    80 echo 'include letter2.txt' > filemap
       
    81 hg convert --filemap filemap $svnurl/trunk fmap
       
    82 hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n'
       
    83 
       
    84 echo % test stop revision
       
    85 hg convert --rev 1 $svnurl/trunk stoprev
       
    86 # Check convert_revision extra-records.
       
    87 # This is also the only place testing more than one extra field
       
    88 # in a revision.
       
    89 hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/'