1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
handle hg
mkdir git
cd git
env GIT_AUTHOR_NAME='Russ Cox'
env GIT_AUTHOR_EMAIL='rsc@golang.org'
env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
git init
at 2018-04-17T15:43:22-04:00
unquote ''
cp stdout README
git add README
git commit -a -m 'empty README'
git branch -m master
git tag v1.2.3
at 2018-04-17T15:45:48-04:00
git branch v2
git checkout v2
echo 'v2'
cp stdout v2
git add v2
git commit -a -m 'v2'
git tag v2.3
git tag v2.0.1
git branch v2.3.4
git tag branch-v2.3.4
at 2018-04-17T16:00:19-04:00
echo 'intermediate'
cp stdout foo.txt
git add foo.txt
git commit -a -m 'intermediate'
at 2018-04-17T16:00:32-04:00
echo 'another'
cp stdout another.txt
git add another.txt
git commit -a -m 'another'
git tag v2.0.2
git tag branch-v2
at 2018-04-17T16:16:52-04:00
git checkout master
git branch v3
git checkout v3
mkdir v3/sub/dir
echo 'v3/sub/dir/file'
cp stdout v3/sub/dir/file.txt
git add v3
git commit -a -m 'add v3/sub/dir/file.txt'
git tag branch-v3
at 2018-04-17T22:23:00-04:00
git checkout master
git tag -a v1.2.4-annotated -m 'v1.2.4-annotated'
cd ..
hg init
hg convert --datesort ./git .
rm ./git
hg update -C v2
hg branch v2
unquote ''
cp stdout dummy
hg add dummy
hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:15:24-04:00' -m 'dummy'
# 'hg convert' blindly stamps a tag-update commit at the end of whatever branch
# happened to contain the last converted commit — in this case, v3. However, the
# original vcs-test.golang.org copy of this repo had this commit on the v3
# branch as a descendent of 'add v3/sub/dir/file.txt', so that's where we put it
# here. That leaves the convert-repo 'update tags' commit only reachable as the
# head of the default branch.
hg update -r 4
hg branch v3
unquote ''
cp stdout dummy
hg add dummy
hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:15:45-04:00' -m 'dummy'
hg update v2.3.4
hg branch v2.3.4
unquote ''
cp stdout dummy
hg add dummy
hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:16:10-04:00' -m 'dummy'
hg tag --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:16:30-04:00' -m 'Removed tag branch-v2, branch-v3, branch-v2.3.4' --remove branch-v2 branch-v3 branch-v2.3.4
# Adding commits to the above branches updates both the branch heads and the
# corresponding bookmarks.
# But apparently at some point it did not do so? The original copy of this repo
# had bookmarks pointing to the base of each branch instead of the tip. 🤔
# Either way, force the bookmarks we care about to match the original copy of
# the repo.
hg book v2 -r 3 --force
hg book v2.3.4 -r 1 --force
hg book v3 -r 5 --force
hg log -G --debug
hg tags
cmp stdout .hg-tags
# 'hg convert' leaves an 'update tags' commit on the default branch, and that
# commit always uses the current date (so is not reproducible). Fortunately,
# that commit lands on the 'default' branch and is not tagged as 'tip', so it
# seems to be mostly harmless. However, because it is nondeterministic we
# should avoid listing it here.
#
# Unfortunately, some of our builders are still running Debian 9 “Stretch”,
# which shipped with a version of 'hg' that does not support 'hg branch -r'
# to list branches for specific versions. Although Stretch is past its
# end-of-life date, we need to keep the builders happy until they can be
# turned down (https://go.dev/issue/56414).
hg branches
? cmp stdout .hg-branches
stdout 'v2\s+6:9a4f43d231ec'
stdout 'v2.3.4\s+9:18518c07eb8e'
stdout 'v3\s+7:a2cad8a2b1bb'
stdout 'default\s+5:'
# Likewise, bookmark v3 ends up on the nondeterministic commit.
hg bookmarks
? cmp stdout .hg-bookmarks
stdout 'master\s+0:41964ddce118'
stdout 'v2\s+3:8f49ee7a6ddc'
stdout 'v2.3.4\s+1:88fde824ec8b'
stdout 'v3\s+5:.*'
-- .hg-branches --
v2.3.4 9:18518c07eb8e
v3 7:a2cad8a2b1bb
v2 6:9a4f43d231ec
-- .hg-tags --
tip 9:18518c07eb8e
v2.0.2 3:8f49ee7a6ddc
v2.3 1:88fde824ec8b
v2.0.1 1:88fde824ec8b
v1.2.4-annotated 0:41964ddce118
v1.2.3 0:41964ddce118
-- .hg-bookmarks --
master 0:41964ddce118
v2 3:8f49ee7a6ddc
v2.3.4 1:88fde824ec8b
|