##// END OF EJS Templates
convert: fix history topology when using hg.tagsbranch...
convert: fix history topology when using hg.tagsbranch When using hg.tagsbranch, all conversions fail at transcribing the source repo topology with conversion scenarios interleaving: - initial repo conversion, - then upstream tag - then later incremental conversion The problem is caused by the usage of the last source revid as source revid for the tagnode in the revision map. On a later incremental conversion, when resolving some child commit of the true last source revid, convert will parent the nodes to the tag node. If using tagsbranch you get a bad topology where all incremental commit nodes end up in the tag branch. Analysis and test by Edouard Gomez <ed.gomez@free.fr>

File last commit:

r9431:d1b135f2 default
r9431:d1b135f2 default
Show More
test-convert-tagsbranch-topology
64 lines | 1.4 KiB | text/plain | TextLexer
/ tests / test-convert-tagsbranch-topology
#!/bin/sh
"$TESTDIR/hghave" git || exit 80
echo "[extensions]" >> $HGRCPATH
echo "convert=" >> $HGRCPATH
echo 'hgext.graphlog =' >> $HGRCPATH
echo '[convert]' >> $HGRCPATH
echo 'hg.usebranchnames = True' >> $HGRCPATH
echo 'hg.tagsbranch = tags-update' >> $HGRCPATH
GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
count=10
action()
{
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
git "$@" >/dev/null 2>/dev/null || echo "git command error"
count=`expr $count + 1`
}
glog()
{
hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
}
convertrepo()
{
hg convert --datesort git-repo hg-repo
}
# Build a GIT repo with at least 1 tag
mkdir git-repo
cd git-repo
git init >/dev/null 2>&1
echo a > a
git add a
action commit -m "rev1"
action tag -m "tag1" tag1
cd ..
# Do a first conversion
convertrepo
# Simulate upstream updates after first conversion
cd git-repo
echo b > a
git add a
action commit -m "rev2"
action tag -m "tag2" tag2
cd ..
# Perform an incremental conversion
convertrepo
# Print the log
cd hg-repo
glog