tests/test-convert-svn-move
author Dirkjan Ochtman <dirkjan@ochtman.nl>
Wed, 02 Jul 2008 11:31:19 +0200
changeset 6795 c228ae4bc89c
parent 6546 075b2c9aed37
child 6851 6ec941b6003d
permissions -rwxr-xr-x
merge the backout head
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
6543
a6e2e60b34d0 convert: handle past or foreign partial svn copies
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    30
mkdir trunk/d2
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
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
    32
echo c > trunk/d1/c
6543
a6e2e60b34d0 convert: handle past or foreign partial svn copies
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    33
echo d > trunk/d2/d
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
cd ..
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
svnurl=file://$svnpath/svn-repo/projA
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
svn import -m "init projA" projA $svnurl | fix_path
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
# 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
    40
echo % update svn repository
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
svn co $svnurl A | fix_path
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
cd A
6439
c1b47c0fd2b6 convert: fix test-convert-svn-* problems with mtime not changing
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 5957
diff changeset
    43
"$TESTDIR/svn-safe-append.py" a trunk/a
c1b47c0fd2b6 convert: fix test-convert-svn-* problems with mtime not changing
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 5957
diff changeset
    44
"$TESTDIR/svn-safe-append.py" c trunk/d1/c
5957
971a17af5982 convert: prevent svn branches to leave the root module tree
Patrick Mezard <pmezard@gmail.com>
parents: 5955
diff changeset
    45
svn ci -m commitbeforemove
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
svn mv $svnurl/trunk $svnurl/subproject -m movedtrunk
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
svn up
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
mkdir subproject/trunk
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
svn add subproject/trunk
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
svn ci -m createtrunk
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
mkdir subproject/branches
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
svn add subproject/branches
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
svn ci -m createbranches
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
svn mv $svnurl/subproject/d1 $svnurl/subproject/trunk/d1 -m moved1
6543
a6e2e60b34d0 convert: handle past or foreign partial svn copies
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    55
svn mv $svnurl/subproject/d2 $svnurl/subproject/trunk/d2 -m moved2
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
svn up
6439
c1b47c0fd2b6 convert: fix test-convert-svn-* problems with mtime not changing
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 5957
diff changeset
    57
"$TESTDIR/svn-safe-append.py" b subproject/trunk/d1/b
6543
a6e2e60b34d0 convert: handle past or foreign partial svn copies
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    58
svn rm subproject/trunk/d2
a6e2e60b34d0 convert: handle past or foreign partial svn copies
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    59
svn ci -m "changeb and rm d2"
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
svn mv $svnurl/subproject/trunk/d1 $svnurl/subproject/branches/d1 -m moved1again
6546
075b2c9aed37 convert: fix svn file copy detection code
Patrick Mezard <pmezard@gmail.com>
parents: 6543
diff changeset
    61
echo % copy a file from a past revision
075b2c9aed37 convert: fix svn file copy detection code
Patrick Mezard <pmezard@gmail.com>
parents: 6543
diff changeset
    62
svn copy -r 7 $svnurl/subproject/trunk/d2/d $svnurl/subproject/trunk -m copyfilefrompast
6543
a6e2e60b34d0 convert: handle past or foreign partial svn copies
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    63
echo % copy a directory from a past revision
a6e2e60b34d0 convert: handle past or foreign partial svn copies
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    64
svn copy -r 7 $svnurl/subproject/trunk/d2 $svnurl/subproject/trunk -m copydirfrompast
5955
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
cd ..
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    67
echo % convert trunk and branches
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
hg convert --datesort $svnurl/subproject A-hg
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    70
cd A-hg
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    71
hg glog --template '#rev# #desc|firstline# files: #files#\n'
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    72
hg branches | sed 's/:.*/:/'
c4496b7c10ce convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    73
cd ..