Mercurial > hg > mercurial-source
annotate tests/test-convert-tagsbranch-topology @ 9431:d1b135f2f415
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>
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 06 Sep 2009 15:29:14 +0200 |
parents | |
children |
rev | line source |
---|---|
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 |