tests/test-convert-tagsbranch-topology
author Sol Jerome <sol.jerome@gmail.com>
Tue, 17 Aug 2010 17:38:19 -0500
branchstable
changeset 12051 ff5cec76b1c5
parent 9431 d1b135f2f415
permissions -rwxr-xr-x
util: avoid using hashlib on Python < 2.5 (issue2278) The following patch allows the use of python2.4 with a standalone hashlib rather than assuming that python2.5 is in use when hashlib is imported successfully.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9431
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
"$TESTDIR/hghave" git || exit 80
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
echo "[extensions]" >> $HGRCPATH
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
echo "convert=" >> $HGRCPATH
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
echo 'hgext.graphlog =' >> $HGRCPATH
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
echo '[convert]' >> $HGRCPATH
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
echo 'hg.usebranchnames = True' >> $HGRCPATH
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
echo 'hg.tagsbranch = tags-update' >> $HGRCPATH
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
count=10
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
action()
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
{
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
    GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
    GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
    git "$@" >/dev/null 2>/dev/null || echo "git command error"
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
    count=`expr $count + 1`
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
}
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
glog()
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
{
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
    hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
}
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
convertrepo()
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
{
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
    hg convert --datesort git-repo hg-repo
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
}
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
# Build a GIT repo with at least 1 tag
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
mkdir git-repo
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
cd git-repo
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
git init >/dev/null 2>&1
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
echo a > a
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
git add a
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
action commit -m "rev1"
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
action tag -m "tag1" tag1
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
cd ..
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
# Do a first conversion
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
convertrepo
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
# Simulate upstream  updates after first conversion
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
cd git-repo
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
echo b > a
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
git add a
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
action commit -m "rev2"
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
action tag -m "tag2" tag2
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
cd ..
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
# Perform an incremental conversion
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
convertrepo
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    62
# Print the log
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
cd hg-repo
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    64
glog