1 handle hg
2
3 mkdir git
4 cd git
5
6 env GIT_AUTHOR_NAME='Russ Cox'
7 env GIT_AUTHOR_EMAIL='rsc@golang.org'
8 env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
9 env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
10
11 git init
12
13 at 2018-04-17T15:43:22-04:00
14 unquote ''
15 cp stdout README
16 git add README
17 git commit -a -m 'empty README'
18 git branch -m master
19 git tag v1.2.3
20
21 at 2018-04-17T15:45:48-04:00
22 git branch v2
23 git checkout v2
24 echo 'v2'
25 cp stdout v2
26 git add v2
27 git commit -a -m 'v2'
28 git tag v2.3
29 git tag v2.0.1
30 git branch v2.3.4
31 git tag branch-v2.3.4
32
33 at 2018-04-17T16:00:19-04:00
34 echo 'intermediate'
35 cp stdout foo.txt
36 git add foo.txt
37 git commit -a -m 'intermediate'
38
39 at 2018-04-17T16:00:32-04:00
40 echo 'another'
41 cp stdout another.txt
42 git add another.txt
43 git commit -a -m 'another'
44 git tag v2.0.2
45 git tag branch-v2
46
47 at 2018-04-17T16:16:52-04:00
48 git checkout master
49 git branch v3
50 git checkout v3
51 mkdir v3/sub/dir
52 echo 'v3/sub/dir/file'
53 cp stdout v3/sub/dir/file.txt
54 git add v3
55 git commit -a -m 'add v3/sub/dir/file.txt'
56 git tag branch-v3
57
58 at 2018-04-17T22:23:00-04:00
59 git checkout master
60 git tag -a v1.2.4-annotated -m 'v1.2.4-annotated'
61
62 cd ..
63
64 hg init
65 hg convert --datesort ./git .
66 rm ./git
67
68 hg update -C v2
69 hg branch v2
70 unquote ''
71 cp stdout dummy
72 hg add dummy
73 hg 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.
81 hg update -r 4
82
83 hg branch v3
84 unquote ''
85 cp stdout dummy
86 hg add dummy
87 hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:15:45-04:00' -m 'dummy'
88
89 hg update v2.3.4
90 hg branch v2.3.4
91 unquote ''
92 cp stdout dummy
93 hg add dummy
94 hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:16:10-04:00' -m 'dummy'
95
96 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
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.
104 hg book v2 -r 3 --force
105 hg book v2.3.4 -r 1 --force
106 hg book v3 -r 5 --force
107
108 hg log -G --debug
109
110 hg tags
111 cmp 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).
124 hg branches
125 ? cmp stdout .hg-branches
126 stdout 'v2\s+6:9a4f43d231ec'
127 stdout 'v2.3.4\s+9:18518c07eb8e'
128 stdout 'v3\s+7:a2cad8a2b1bb'
129 stdout 'default\s+5:'
130
131 # Likewise, bookmark v3 ends up on the nondeterministic commit.
132 hg bookmarks
133 ? cmp stdout .hg-bookmarks
134 stdout 'master\s+0:41964ddce118'
135 stdout 'v2\s+3:8f49ee7a6ddc'
136 stdout 'v2.3.4\s+1:88fde824ec8b'
137 stdout 'v3\s+5:.*'
138
139 -- .hg-branches --
140 v2.3.4 9:18518c07eb8e
141 v3 7:a2cad8a2b1bb
142 v2 6:9a4f43d231ec
143 -- .hg-tags --
144 tip 9:18518c07eb8e
145 v2.0.2 3:8f49ee7a6ddc
146 v2.3 1:88fde824ec8b
147 v2.0.1 1:88fde824ec8b
148 v1.2.4-annotated 0:41964ddce118
149 v1.2.3 0:41964ddce118
150 -- .hg-bookmarks --
151 master 0:41964ddce118
152 v2 3:8f49ee7a6ddc
153 v2.3.4 1:88fde824ec8b
154
View as plain text