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