tests/test-convert-svn-move
author Patrick Mezard <pmezard@gmail.com>
Sat, 29 Mar 2008 17:14:47 +0100
changeset 6396 18eeabae6148
parent 5957 971a17af5982
child 6439 c1b47c0fd2b6
permissions -rwxr-xr-x
test-convert-mtn: test directory deletion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
"$TESTDIR/hghave" svn svn-bindings || exit 80
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
fix_path()
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
{
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
    tr '\\' /
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
}
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
echo "[extensions]" >> $HGRCPATH
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
echo "convert = " >> $HGRCPATH
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
echo "hgext.graphlog =" >> $HGRCPATH
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
svnadmin create svn-repo
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
svnpath=`pwd | fix_path`
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
# SVN wants all paths to start with a slash. Unfortunately,
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
# Windows ones don't. Handle that.
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
expr $svnpath : "\/" > /dev/null
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
if [ $? -ne 0 ]; then
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
    svnpath='/'$svnpath
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
fi
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
echo % initial svn import
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
mkdir projA
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
cd projA
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
mkdir trunk
5957
971a17af5982 convert: prevent svn branches to leave the root module tree
Patrick Mezard <pmezard@gmail.com>
parents: 5955
diff changeset
    28
echo a > trunk/a
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
mkdir trunk/d1
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
echo b > trunk/d1/b
5957
971a17af5982 convert: prevent svn branches to leave the root module tree
Patrick Mezard <pmezard@gmail.com>
parents: 5955
diff changeset
    31
echo c > trunk/d1/c
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
cd ..
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
svnurl=file://$svnpath/svn-repo/projA
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
svn import -m "init projA" projA $svnurl | fix_path
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
# Build a module renaming chain which used to confuse the converter.
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
echo % update svn repository
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
svn co $svnurl A | fix_path
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
cd A
5957
971a17af5982 convert: prevent svn branches to leave the root module tree
Patrick Mezard <pmezard@gmail.com>
parents: 5955
diff changeset
    41
echo a >> trunk/a
971a17af5982 convert: prevent svn branches to leave the root module tree
Patrick Mezard <pmezard@gmail.com>
parents: 5955
diff changeset
    42
echo c >> trunk/d1/c
971a17af5982 convert: prevent svn branches to leave the root module tree
Patrick Mezard <pmezard@gmail.com>
parents: 5955
diff changeset
    43
svn ci -m commitbeforemove
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
svn mv $svnurl/trunk $svnurl/subproject -m movedtrunk
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
svn up
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
mkdir subproject/trunk
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
svn add subproject/trunk
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
svn ci -m createtrunk
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
mkdir subproject/branches
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
svn add subproject/branches
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
svn ci -m createbranches
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
svn mv $svnurl/subproject/d1 $svnurl/subproject/trunk/d1 -m moved1
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
svn up
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
echo b >> subproject/trunk/d1/b
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
svn ci -m changeb
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
svn mv $svnurl/subproject/trunk/d1 $svnurl/subproject/branches/d1 -m moved1again
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
cd ..
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
echo % convert trunk and branches
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
hg convert --datesort $svnurl/subproject A-hg
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    62
cd A-hg
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
hg glog --template '#rev# #desc|firstline# files: #files#\n'
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    64
hg branches | sed 's/:.*/:/'
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
cd ..