1
2  $ cat <<EOF >> $HGRCPATH
3  > [extensions]
4  > convert =
5  > [convert]
6  > hg.tagsbranch = 0
7  > EOF
8  $ hg init source
9  $ cd source
10  $ echo a > a
11  $ hg ci -qAm adda
12
13Add a merge with one parent in the same branch
14
15  $ echo a >> a
16  $ hg ci -qAm changea
17  $ hg up -qC 0
18  $ hg branch branch0
19  marked working directory as branch branch0
20  (branches are permanent and global, did you want a bookmark?)
21  $ echo b > b
22  $ hg ci -qAm addb
23  $ hg up -qC
24  $ hg merge default
25  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26  (branch merge, don't forget to commit)
27  $ hg ci -qm mergeab
28  $ hg tag -ql mergeab
29  $ cd ..
30
31Miss perl... sometimes
32
33  $ cat > filter.py <<EOF
34  > from __future__ import absolute_import
35  > import re
36  > import sys
37  >
38  > r = re.compile(r'^(?:\d+|pulling from)')
39  > sys.stdout.writelines([l for l in sys.stdin if r.search(l)])
40  > EOF
41
42convert
43
44  $ hg convert -v --config convert.hg.clonebranches=1 source dest |
45  >     "$PYTHON" filter.py
46  3 adda
47  2 changea
48  1 addb
49  pulling from default into branch0
50  1 changesets found
51  0 mergeab
52  pulling from default into branch0
53  1 changesets found
54
55Add a merge with both parents and child in different branches
56
57  $ cd source
58  $ hg branch branch1
59  marked working directory as branch branch1
60  $ echo a > file1
61  $ hg ci -qAm c1
62  $ hg up -qC mergeab
63  $ hg branch branch2
64  marked working directory as branch branch2
65  $ echo a > file2
66  $ hg ci -qAm c2
67  $ hg merge branch1
68  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69  (branch merge, don't forget to commit)
70  $ hg branch branch3
71  marked working directory as branch branch3
72  $ hg ci -qAm c3
73  $ cd ..
74
75incremental conversion
76
77  $ hg convert -v --config convert.hg.clonebranches=1 source dest |
78  >     "$PYTHON" filter.py
79  2 c1
80  pulling from branch0 into branch1
81  4 changesets found
82  1 c2
83  pulling from branch0 into branch2
84  4 changesets found
85  0 c3
86  pulling from branch1 into branch3
87  5 changesets found
88  pulling from branch2 into branch3
89  1 changesets found
90