tests/test-convert-svn-branches
author Martin Geisler <mg@daimi.au.dk>
Tue, 09 Sep 2008 21:32:39 +0200
changeset 7013 f56e788fa292
parent 6851 6ec941b6003d
child 7475 90d8dfb481e7
permissions -rwxr-xr-x
i18n: mark help strings for translation The gettext function is just another name for the normal _ function and it is used for translating docstrings when using _ would make pygettext.py output a warning.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
"$TESTDIR/hghave" svn svn-bindings || exit 80
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
fix_path()
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
{
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
    tr '\\' /
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
}
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
echo "[extensions]" >> $HGRCPATH
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
echo "convert = " >> $HGRCPATH
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
echo "hgext.graphlog =" >> $HGRCPATH
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
svnadmin create svn-repo
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
svnpath=`pwd | fix_path`
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
# SVN wants all paths to start with a slash. Unfortunately,
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
# Windows ones don't. Handle that.
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
expr $svnpath : "\/" > /dev/null
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
if [ $? -ne 0 ]; then
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
    svnpath='/'$svnpath
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
fi
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
echo % initial svn import
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
mkdir projA
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
cd projA
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
mkdir trunk
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
mkdir branches
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
mkdir tags
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
cd ..
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
svnurl=file://$svnpath/svn-repo/projA
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
svn import -m "init projA" projA $svnurl | fix_path
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
echo % update svn repository
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
svn co $svnurl A | fix_path
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
cd A
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    38
echo a > trunk/a
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    39
echo b > trunk/b
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    40
echo c > trunk/c
6491
2bdd43246c95 convert: check svn branches are directories
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    41
# Add a file within branches, used to confuse branch detection
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    42
echo d > branches/notinbranch
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    43
svn add trunk/a trunk/b trunk/c branches/notinbranch
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
svn ci -m hello
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    46
echo % branch to old
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
svn copy trunk branches/old
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    48
svn rm branches/old/c
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    49
svn ci -m "branch trunk, remove c"
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
svn up
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
echo % update trunk
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    53
"$TESTDIR/svn-safe-append.py" a trunk/a
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    54
svn ci -m "change a"
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
echo % update old branch
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    57
"$TESTDIR/svn-safe-append.py" b branches/old/b
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    58
svn ci -m "change b"
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
echo % create a cross-branch revision
6851
6ec941b6003d Fix subversion tests with svn 1.5
Patrick Mezard <pmezard@gmail.com>
parents: 6540
diff changeset
    61
svn move trunk/b branches/old/c
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    62
"$TESTDIR/svn-safe-append.py" c branches/old/c
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    63
svn ci -m "move and update c"
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    64
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
echo % update old branch again
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    66
"$TESTDIR/svn-safe-append.py" b branches/old/b
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    67
svn ci -m "change b again"
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
6540
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    69
echo % move back and forth between branch of similar names
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    70
# This used to generate fake copy records
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    71
svn up
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    72
svn move branches/old branches/old2
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    73
svn ci -m "move to old2"
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    74
svn move branches/old2 branches/old
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    75
svn ci -m "move back to old"
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    76
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    77
echo % update trunk again
6537
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    78
"$TESTDIR/svn-safe-append.py" a trunk/a
b6a24c273c30 test-convert-svn-branches: short identifiers are more legible
Patrick Mezard <pmezard@gmail.com>
parents: 6491
diff changeset
    79
svn ci -m "last change to a"
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    80
cd ..
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    81
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    82
echo % convert trunk and branches
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    83
hg convert --datesort $svnurl A-hg
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    84
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    85
echo % branch again from a converted revision
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    86
cd A
6540
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    87
svn copy -r 1 $svnurl/trunk branches/old3
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    88
svn ci -m "branch trunk@1 into old3"
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    89
cd ..
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    90
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    91
echo % convert again
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    92
hg convert --datesort $svnurl A-hg
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    93
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    94
cd A-hg
6540
55bd855fc0af convert: improve subversion branch filtering
Patrick Mezard <pmezard@gmail.com>
parents: 6537
diff changeset
    95
hg glog --template 'branch=#branches# #rev# #desc|firstline# files: #files#\n'
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    96
hg branches | sed 's/:.*/:/'
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    97
hg tags -q
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    98
cd ..