Show More
@@ -1,1169 +1,1170 b'' | |||
|
1 | 1 | #require git |
|
2 | 2 | |
|
3 | 3 | $ git config -f $HOME/.gitconfig init.defaultBranch master |
|
4 | 4 | $ git config -f $HOME/.gitconfig core.autocrlf false |
|
5 | $ git config -f $HOME/.gitconfig protocol.file.allow always | |
|
5 | 6 | $ echo "[extensions]" >> $HGRCPATH |
|
6 | 7 | $ echo "convert=" >> $HGRCPATH |
|
7 | 8 | $ cat >> $HGRCPATH <<EOF |
|
8 | 9 | > [subrepos] |
|
9 | 10 | > git:allowed = true |
|
10 | 11 | > EOF |
|
11 | 12 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
12 | 13 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
13 | 14 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE |
|
14 | 15 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
15 | 16 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
16 | 17 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
17 | 18 | $ INVALIDID1=afd12345af |
|
18 | 19 | $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86 |
|
19 | 20 | $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357 |
|
20 | 21 | $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da |
|
21 | 22 | $ count=10 |
|
22 | 23 | $ commit() |
|
23 | 24 | > { |
|
24 | 25 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" |
|
25 | 26 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" |
|
26 | 27 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" |
|
27 | 28 | > count=`expr $count + 1` |
|
28 | 29 | > } |
|
29 | 30 | $ mkdir git-repo |
|
30 | 31 | $ cd git-repo |
|
31 | 32 | $ git init >/dev/null 2>/dev/null |
|
32 | 33 | $ echo a > a |
|
33 | 34 | $ mkdir d |
|
34 | 35 | $ echo b > d/b |
|
35 | 36 | $ git add a d |
|
36 | 37 | $ commit -a -m t1 |
|
37 | 38 | |
|
38 | 39 | Remove the directory, then try to replace it with a file (issue754) |
|
39 | 40 | |
|
40 | 41 | $ git rm -f d/b |
|
41 | 42 | rm 'd/b' |
|
42 | 43 | $ commit -m t2 |
|
43 | 44 | $ echo d > d |
|
44 | 45 | $ git add d |
|
45 | 46 | $ commit -m t3 |
|
46 | 47 | $ echo b >> a |
|
47 | 48 | $ commit -a -m t4.1 |
|
48 | 49 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null |
|
49 | 50 | $ echo c > a |
|
50 | 51 | $ echo a >> a |
|
51 | 52 | $ commit -a -m t4.2 |
|
52 | 53 | $ git checkout master >/dev/null 2>/dev/null |
|
53 | 54 | $ git pull --no-commit . other --no-rebase > /dev/null 2>/dev/null |
|
54 | 55 | $ commit -m 'Merge branch other' |
|
55 | 56 | $ cd .. |
|
56 | 57 | $ hg convert --config extensions.progress= --config progress.assume-tty=1 \ |
|
57 | 58 | > --config progress.delay=0 --config progress.changedelay=0 \ |
|
58 | 59 | > --config progress.refresh=0 --config progress.width=60 \ |
|
59 | 60 | > --config progress.format='topic, bar, number' --datesort git-repo |
|
60 | 61 | \r (no-eol) (esc) |
|
61 | 62 | scanning [======> ] 1/6\r (no-eol) (esc) |
|
62 | 63 | scanning [=============> ] 2/6\r (no-eol) (esc) |
|
63 | 64 | scanning [=====================> ] 3/6\r (no-eol) (esc) |
|
64 | 65 | scanning [============================> ] 4/6\r (no-eol) (esc) |
|
65 | 66 | scanning [===================================> ] 5/6\r (no-eol) (esc) |
|
66 | 67 | scanning [===========================================>] 6/6\r (no-eol) (esc) |
|
67 | 68 | \r (no-eol) (esc) |
|
68 | 69 | \r (no-eol) (esc) |
|
69 | 70 | converting [ ] 0/6\r (no-eol) (esc) |
|
70 | 71 | getting files [==================> ] 1/2\r (no-eol) (esc) |
|
71 | 72 | getting files [======================================>] 2/2\r (no-eol) (esc) |
|
72 | 73 | \r (no-eol) (esc) |
|
73 | 74 | \r (no-eol) (esc) |
|
74 | 75 | converting [======> ] 1/6\r (no-eol) (esc) |
|
75 | 76 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
76 | 77 | \r (no-eol) (esc) |
|
77 | 78 | \r (no-eol) (esc) |
|
78 | 79 | converting [=============> ] 2/6\r (no-eol) (esc) |
|
79 | 80 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
80 | 81 | \r (no-eol) (esc) |
|
81 | 82 | \r (no-eol) (esc) |
|
82 | 83 | converting [====================> ] 3/6\r (no-eol) (esc) |
|
83 | 84 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
84 | 85 | \r (no-eol) (esc) |
|
85 | 86 | \r (no-eol) (esc) |
|
86 | 87 | converting [===========================> ] 4/6\r (no-eol) (esc) |
|
87 | 88 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
88 | 89 | \r (no-eol) (esc) |
|
89 | 90 | \r (no-eol) (esc) |
|
90 | 91 | converting [==================================> ] 5/6\r (no-eol) (esc) |
|
91 | 92 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
92 | 93 | \r (no-eol) (esc) |
|
93 | 94 | assuming destination git-repo-hg |
|
94 | 95 | initializing destination git-repo-hg repository |
|
95 | 96 | scanning source... |
|
96 | 97 | sorting... |
|
97 | 98 | converting... |
|
98 | 99 | 5 t1 |
|
99 | 100 | 4 t2 |
|
100 | 101 | 3 t3 |
|
101 | 102 | 2 t4.1 |
|
102 | 103 | 1 t4.2 |
|
103 | 104 | 0 Merge branch other |
|
104 | 105 | updating bookmarks |
|
105 | 106 | $ hg up -q -R git-repo-hg |
|
106 | 107 | $ hg -R git-repo-hg tip -v |
|
107 | 108 | changeset: 5:c78094926be2 |
|
108 | 109 | bookmark: master |
|
109 | 110 | tag: tip |
|
110 | 111 | parent: 3:f5f5cb45432b |
|
111 | 112 | parent: 4:4e174f80c67c |
|
112 | 113 | user: test <test@example.org> |
|
113 | 114 | date: Mon Jan 01 00:00:15 2007 +0000 |
|
114 | 115 | files: a |
|
115 | 116 | description: |
|
116 | 117 | Merge branch other |
|
117 | 118 | |
|
118 | 119 | |
|
119 | 120 | $ count=10 |
|
120 | 121 | $ mkdir git-repo2 |
|
121 | 122 | $ cd git-repo2 |
|
122 | 123 | $ git init >/dev/null 2>/dev/null |
|
123 | 124 | $ echo foo > foo |
|
124 | 125 | $ git add foo |
|
125 | 126 | $ commit -a -m 'add foo' |
|
126 | 127 | $ echo >> foo |
|
127 | 128 | $ commit -a -m 'change foo' |
|
128 | 129 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null |
|
129 | 130 | $ echo quux >> quux |
|
130 | 131 | $ git add quux |
|
131 | 132 | $ commit -a -m 'add quux' |
|
132 | 133 | $ echo bar > bar |
|
133 | 134 | $ git add bar |
|
134 | 135 | $ commit -a -m 'add bar' |
|
135 | 136 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null |
|
136 | 137 | $ echo baz > baz |
|
137 | 138 | $ git add baz |
|
138 | 139 | $ commit -a -m 'add baz' |
|
139 | 140 | $ git checkout master >/dev/null 2>/dev/null |
|
140 | 141 | $ git pull --no-commit . Bar Baz --no-rebase > /dev/null 2>/dev/null |
|
141 | 142 | $ commit -m 'Octopus merge' |
|
142 | 143 | $ echo bar >> bar |
|
143 | 144 | $ commit -a -m 'change bar' |
|
144 | 145 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null |
|
145 | 146 | $ echo >> foo |
|
146 | 147 | $ commit -a -m 'change foo' |
|
147 | 148 | $ git checkout master >/dev/null 2>/dev/null |
|
148 | 149 | $ git pull --no-commit -s ours . Foo --no-rebase > /dev/null 2>/dev/null |
|
149 | 150 | $ commit -m 'Discard change to foo' |
|
150 | 151 | $ cd .. |
|
151 | 152 | $ glog() |
|
152 | 153 | > { |
|
153 | 154 | > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
154 | 155 | > } |
|
155 | 156 | $ splitrepo() |
|
156 | 157 | > { |
|
157 | 158 | > msg="$1" |
|
158 | 159 | > files="$2" |
|
159 | 160 | > opts=$3 |
|
160 | 161 | > echo "% $files: $msg" |
|
161 | 162 | > prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
162 | 163 | > fmap="$prefix.fmap" |
|
163 | 164 | > repo="$prefix.repo" |
|
164 | 165 | > for i in $files; do |
|
165 | 166 | > echo "include $i" >> "$fmap" |
|
166 | 167 | > done |
|
167 | 168 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" |
|
168 | 169 | > hg up -q -R "$repo" |
|
169 | 170 | > glog -R "$repo" |
|
170 | 171 | > hg -R "$repo" manifest --debug |
|
171 | 172 | > } |
|
172 | 173 | |
|
173 | 174 | full conversion |
|
174 | 175 | |
|
175 | 176 | $ hg convert --datesort git-repo2 fullrepo \ |
|
176 | 177 | > --config extensions.progress= --config progress.assume-tty=1 \ |
|
177 | 178 | > --config progress.delay=0 --config progress.changedelay=0 \ |
|
178 | 179 | > --config progress.refresh=0 --config progress.width=60 \ |
|
179 | 180 | > --config progress.format='topic, bar, number' |
|
180 | 181 | \r (no-eol) (esc) |
|
181 | 182 | scanning [===> ] 1/9\r (no-eol) (esc) |
|
182 | 183 | scanning [========> ] 2/9\r (no-eol) (esc) |
|
183 | 184 | scanning [=============> ] 3/9\r (no-eol) (esc) |
|
184 | 185 | scanning [==================> ] 4/9\r (no-eol) (esc) |
|
185 | 186 | scanning [=======================> ] 5/9\r (no-eol) (esc) |
|
186 | 187 | scanning [============================> ] 6/9\r (no-eol) (esc) |
|
187 | 188 | scanning [=================================> ] 7/9\r (no-eol) (esc) |
|
188 | 189 | scanning [======================================> ] 8/9\r (no-eol) (esc) |
|
189 | 190 | scanning [===========================================>] 9/9\r (no-eol) (esc) |
|
190 | 191 | \r (no-eol) (esc) |
|
191 | 192 | \r (no-eol) (esc) |
|
192 | 193 | converting [ ] 0/9\r (no-eol) (esc) |
|
193 | 194 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
194 | 195 | \r (no-eol) (esc) |
|
195 | 196 | \r (no-eol) (esc) |
|
196 | 197 | converting [===> ] 1/9\r (no-eol) (esc) |
|
197 | 198 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
198 | 199 | \r (no-eol) (esc) |
|
199 | 200 | \r (no-eol) (esc) |
|
200 | 201 | converting [========> ] 2/9\r (no-eol) (esc) |
|
201 | 202 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
202 | 203 | \r (no-eol) (esc) |
|
203 | 204 | \r (no-eol) (esc) |
|
204 | 205 | converting [=============> ] 3/9\r (no-eol) (esc) |
|
205 | 206 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
206 | 207 | \r (no-eol) (esc) |
|
207 | 208 | \r (no-eol) (esc) |
|
208 | 209 | converting [=================> ] 4/9\r (no-eol) (esc) |
|
209 | 210 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
210 | 211 | \r (no-eol) (esc) |
|
211 | 212 | \r (no-eol) (esc) |
|
212 | 213 | converting [======================> ] 5/9\r (no-eol) (esc) |
|
213 | 214 | getting files [===> ] 1/8\r (no-eol) (esc) |
|
214 | 215 | getting files [========> ] 2/8\r (no-eol) (esc) |
|
215 | 216 | getting files [=============> ] 3/8\r (no-eol) (esc) |
|
216 | 217 | getting files [==================> ] 4/8\r (no-eol) (esc) |
|
217 | 218 | getting files [=======================> ] 5/8\r (no-eol) (esc) |
|
218 | 219 | getting files [============================> ] 6/8\r (no-eol) (esc) |
|
219 | 220 | getting files [=================================> ] 7/8\r (no-eol) (esc) |
|
220 | 221 | getting files [======================================>] 8/8\r (no-eol) (esc) |
|
221 | 222 | \r (no-eol) (esc) |
|
222 | 223 | \r (no-eol) (esc) |
|
223 | 224 | converting [===========================> ] 6/9\r (no-eol) (esc) |
|
224 | 225 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
225 | 226 | \r (no-eol) (esc) |
|
226 | 227 | \r (no-eol) (esc) |
|
227 | 228 | converting [===============================> ] 7/9\r (no-eol) (esc) |
|
228 | 229 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
229 | 230 | \r (no-eol) (esc) |
|
230 | 231 | \r (no-eol) (esc) |
|
231 | 232 | converting [====================================> ] 8/9\r (no-eol) (esc) |
|
232 | 233 | getting files [==================> ] 1/2\r (no-eol) (esc) |
|
233 | 234 | getting files [======================================>] 2/2\r (no-eol) (esc) |
|
234 | 235 | \r (no-eol) (esc) |
|
235 | 236 | initializing destination fullrepo repository |
|
236 | 237 | scanning source... |
|
237 | 238 | sorting... |
|
238 | 239 | converting... |
|
239 | 240 | 8 add foo |
|
240 | 241 | 7 change foo |
|
241 | 242 | 6 add quux |
|
242 | 243 | 5 add bar |
|
243 | 244 | 4 add baz |
|
244 | 245 | 3 Octopus merge |
|
245 | 246 | 2 change bar |
|
246 | 247 | 1 change foo |
|
247 | 248 | 0 Discard change to foo |
|
248 | 249 | updating bookmarks |
|
249 | 250 | $ hg up -q -R fullrepo |
|
250 | 251 | $ glog -R fullrepo |
|
251 | 252 | @ 9 "Discard change to foo" files: foo |
|
252 | 253 | |\ |
|
253 | 254 | | o 8 "change foo" files: foo |
|
254 | 255 | | | |
|
255 | 256 | o | 7 "change bar" files: bar |
|
256 | 257 | |/ |
|
257 | 258 | o 6 "(octopus merge fixup)" files: |
|
258 | 259 | |\ |
|
259 | 260 | | o 5 "Octopus merge" files: baz |
|
260 | 261 | | |\ |
|
261 | 262 | o | | 4 "add baz" files: baz |
|
262 | 263 | | | | |
|
263 | 264 | +---o 3 "add bar" files: bar |
|
264 | 265 | | | |
|
265 | 266 | o | 2 "add quux" files: quux |
|
266 | 267 | | | |
|
267 | 268 | | o 1 "change foo" files: foo |
|
268 | 269 | |/ |
|
269 | 270 | o 0 "add foo" files: foo |
|
270 | 271 | |
|
271 | 272 | $ hg -R fullrepo manifest --debug |
|
272 | 273 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
273 | 274 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
274 | 275 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
275 | 276 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
276 | 277 | $ splitrepo 'octopus merge' 'foo bar baz' |
|
277 | 278 | % foo bar baz: octopus merge |
|
278 | 279 | @ 8 "Discard change to foo" files: foo |
|
279 | 280 | |\ |
|
280 | 281 | | o 7 "change foo" files: foo |
|
281 | 282 | | | |
|
282 | 283 | o | 6 "change bar" files: bar |
|
283 | 284 | |/ |
|
284 | 285 | o 5 "(octopus merge fixup)" files: |
|
285 | 286 | |\ |
|
286 | 287 | | o 4 "Octopus merge" files: baz |
|
287 | 288 | | |\ |
|
288 | 289 | o | | 3 "add baz" files: baz |
|
289 | 290 | | | | |
|
290 | 291 | +---o 2 "add bar" files: bar |
|
291 | 292 | | | |
|
292 | 293 | | o 1 "change foo" files: foo |
|
293 | 294 | |/ |
|
294 | 295 | o 0 "add foo" files: foo |
|
295 | 296 | |
|
296 | 297 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
297 | 298 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
298 | 299 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
299 | 300 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' |
|
300 | 301 | % foo baz quux: only some parents of an octopus merge; "discard" a head |
|
301 | 302 | @ 6 "Discard change to foo" files: foo |
|
302 | 303 | | |
|
303 | 304 | o 5 "change foo" files: foo |
|
304 | 305 | | |
|
305 | 306 | o 4 "Octopus merge" files: |
|
306 | 307 | |\ |
|
307 | 308 | | o 3 "add baz" files: baz |
|
308 | 309 | | | |
|
309 | 310 | | o 2 "add quux" files: quux |
|
310 | 311 | | | |
|
311 | 312 | o | 1 "change foo" files: foo |
|
312 | 313 | |/ |
|
313 | 314 | o 0 "add foo" files: foo |
|
314 | 315 | |
|
315 | 316 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
316 | 317 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
317 | 318 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
318 | 319 | |
|
319 | 320 | test importing git renames and copies |
|
320 | 321 | |
|
321 | 322 | $ cd git-repo2 |
|
322 | 323 | $ git mv foo foo-renamed |
|
323 | 324 | since bar is not touched in this commit, this copy will not be detected |
|
324 | 325 | $ cp bar bar-copied |
|
325 | 326 | $ cp baz baz-copied |
|
326 | 327 | $ cp baz baz-copied2 |
|
327 | 328 | $ cp baz ba-copy |
|
328 | 329 | $ echo baz2 >> baz |
|
329 | 330 | $ git add bar-copied baz-copied baz-copied2 ba-copy |
|
330 | 331 | $ commit -a -m 'rename and copy' |
|
331 | 332 | $ cd .. |
|
332 | 333 | |
|
333 | 334 | input validation |
|
334 | 335 | $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo |
|
335 | 336 | config error: convert.git.similarity is not a valid integer ('foo') |
|
336 | 337 | [30] |
|
337 | 338 | $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo |
|
338 | 339 | abort: similarity must be between 0 and 100 |
|
339 | 340 | [255] |
|
340 | 341 | $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo |
|
341 | 342 | abort: similarity must be between 0 and 100 |
|
342 | 343 | [255] |
|
343 | 344 | |
|
344 | 345 | $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo |
|
345 | 346 | $ hg -R fullrepo status -C --change master |
|
346 | 347 | M baz |
|
347 | 348 | A ba-copy |
|
348 | 349 | baz |
|
349 | 350 | A bar-copied |
|
350 | 351 | A baz-copied |
|
351 | 352 | baz |
|
352 | 353 | A baz-copied2 |
|
353 | 354 | baz |
|
354 | 355 | A foo-renamed |
|
355 | 356 | foo |
|
356 | 357 | R foo |
|
357 | 358 | |
|
358 | 359 | Ensure that the modification to the copy source was preserved |
|
359 | 360 | (there was a bug where if the copy dest was alphabetically prior to the copy |
|
360 | 361 | source, the copy source took the contents of the copy dest) |
|
361 | 362 | $ hg cat -r tip fullrepo/baz |
|
362 | 363 | baz |
|
363 | 364 | baz2 |
|
364 | 365 | |
|
365 | 366 | $ cd git-repo2 |
|
366 | 367 | $ echo bar2 >> bar |
|
367 | 368 | $ commit -a -m 'change bar' |
|
368 | 369 | $ cp bar bar-copied2 |
|
369 | 370 | $ git add bar-copied2 |
|
370 | 371 | $ commit -a -m 'copy with no changes' |
|
371 | 372 | $ cd .. |
|
372 | 373 | |
|
373 | 374 | $ hg -q convert --config convert.git.similarity=100 \ |
|
374 | 375 | > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo |
|
375 | 376 | $ hg -R fullrepo status -C --change master |
|
376 | 377 | A bar-copied2 |
|
377 | 378 | bar |
|
378 | 379 | |
|
379 | 380 | renamelimit config option works |
|
380 | 381 | |
|
381 | 382 | $ cd git-repo2 |
|
382 | 383 | $ cat >> copy-source << EOF |
|
383 | 384 | > sc0 |
|
384 | 385 | > sc1 |
|
385 | 386 | > sc2 |
|
386 | 387 | > sc3 |
|
387 | 388 | > sc4 |
|
388 | 389 | > sc5 |
|
389 | 390 | > sc6 |
|
390 | 391 | > EOF |
|
391 | 392 | $ git add copy-source |
|
392 | 393 | $ commit -m 'add copy-source' |
|
393 | 394 | $ cp copy-source source-copy0 |
|
394 | 395 | $ echo 0 >> source-copy0 |
|
395 | 396 | $ cp copy-source source-copy1 |
|
396 | 397 | $ echo 1 >> source-copy1 |
|
397 | 398 | $ git add source-copy0 source-copy1 |
|
398 | 399 | $ commit -a -m 'copy copy-source 2 times' |
|
399 | 400 | $ cd .. |
|
400 | 401 | |
|
401 | 402 | $ hg -q convert --config convert.git.renamelimit=1 \ |
|
402 | 403 | > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo2 |
|
403 | 404 | $ hg -R fullrepo2 status -C --change master |
|
404 | 405 | A source-copy0 |
|
405 | 406 | A source-copy1 |
|
406 | 407 | |
|
407 | 408 | $ hg -q convert --config convert.git.renamelimit=100 \ |
|
408 | 409 | > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo3 |
|
409 | 410 | $ hg -R fullrepo3 status -C --change master |
|
410 | 411 | A source-copy0 |
|
411 | 412 | copy-source |
|
412 | 413 | A source-copy1 |
|
413 | 414 | copy-source |
|
414 | 415 | |
|
415 | 416 | test binary conversion (issue1359) |
|
416 | 417 | |
|
417 | 418 | $ count=19 |
|
418 | 419 | $ mkdir git-repo3 |
|
419 | 420 | $ cd git-repo3 |
|
420 | 421 | $ git init >/dev/null 2>/dev/null |
|
421 | 422 | $ "$PYTHON" -c 'import struct; open("b", "wb").write(b"".join([struct.Struct(">B").pack(i) for i in range(256)])*16)' |
|
422 | 423 | $ git add b |
|
423 | 424 | $ commit -a -m addbinary |
|
424 | 425 | $ cd .. |
|
425 | 426 | |
|
426 | 427 | convert binary file |
|
427 | 428 | |
|
428 | 429 | $ hg convert git-repo3 git-repo3-hg |
|
429 | 430 | initializing destination git-repo3-hg repository |
|
430 | 431 | scanning source... |
|
431 | 432 | sorting... |
|
432 | 433 | converting... |
|
433 | 434 | 0 addbinary |
|
434 | 435 | updating bookmarks |
|
435 | 436 | $ cd git-repo3-hg |
|
436 | 437 | $ hg up -C |
|
437 | 438 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
438 | 439 | $ "$PYTHON" -c 'print(len(open("b", "rb").read()))' |
|
439 | 440 | 4096 |
|
440 | 441 | $ cd .. |
|
441 | 442 | |
|
442 | 443 | test author vs committer |
|
443 | 444 | |
|
444 | 445 | $ mkdir git-repo4 |
|
445 | 446 | $ cd git-repo4 |
|
446 | 447 | $ git init >/dev/null 2>/dev/null |
|
447 | 448 | $ echo >> foo |
|
448 | 449 | $ git add foo |
|
449 | 450 | $ commit -a -m addfoo |
|
450 | 451 | $ echo >> foo |
|
451 | 452 | $ GIT_AUTHOR_NAME="nottest" |
|
452 | 453 | $ commit -a -m addfoo2 |
|
453 | 454 | $ cd .. |
|
454 | 455 | |
|
455 | 456 | convert author committer |
|
456 | 457 | |
|
457 | 458 | $ hg convert git-repo4 git-repo4-hg |
|
458 | 459 | initializing destination git-repo4-hg repository |
|
459 | 460 | scanning source... |
|
460 | 461 | sorting... |
|
461 | 462 | converting... |
|
462 | 463 | 1 addfoo |
|
463 | 464 | 0 addfoo2 |
|
464 | 465 | updating bookmarks |
|
465 | 466 | $ hg -R git-repo4-hg log -v |
|
466 | 467 | changeset: 1:d63e967f93da |
|
467 | 468 | bookmark: master |
|
468 | 469 | tag: tip |
|
469 | 470 | user: nottest <test@example.org> |
|
470 | 471 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
471 | 472 | files: foo |
|
472 | 473 | description: |
|
473 | 474 | addfoo2 |
|
474 | 475 | |
|
475 | 476 | committer: test <test@example.org> |
|
476 | 477 | |
|
477 | 478 | |
|
478 | 479 | changeset: 0:0735477b0224 |
|
479 | 480 | user: test <test@example.org> |
|
480 | 481 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
481 | 482 | files: foo |
|
482 | 483 | description: |
|
483 | 484 | addfoo |
|
484 | 485 | |
|
485 | 486 | |
|
486 | 487 | |
|
487 | 488 | Various combinations of committeractions fail |
|
488 | 489 | |
|
489 | 490 | $ hg --config convert.git.committeractions=messagedifferent,messagealways convert git-repo4 bad-committer |
|
490 | 491 | initializing destination bad-committer repository |
|
491 | 492 | abort: committeractions cannot define both messagedifferent and messagealways |
|
492 | 493 | [255] |
|
493 | 494 | |
|
494 | 495 | $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer |
|
495 | 496 | initializing destination bad-committer repository |
|
496 | 497 | abort: committeractions cannot define both dropcommitter and replaceauthor |
|
497 | 498 | [255] |
|
498 | 499 | |
|
499 | 500 | $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer |
|
500 | 501 | initializing destination bad-committer repository |
|
501 | 502 | abort: committeractions cannot define both dropcommitter and messagealways |
|
502 | 503 | [255] |
|
503 | 504 | |
|
504 | 505 | custom prefix on messagedifferent works |
|
505 | 506 | |
|
506 | 507 | $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix |
|
507 | 508 | initializing destination git-repo4-hg-messagedifferentprefix repository |
|
508 | 509 | scanning source... |
|
509 | 510 | sorting... |
|
510 | 511 | converting... |
|
511 | 512 | 1 addfoo |
|
512 | 513 | 0 addfoo2 |
|
513 | 514 | updating bookmarks |
|
514 | 515 | |
|
515 | 516 | $ hg -R git-repo4-hg-messagedifferentprefix log -v |
|
516 | 517 | changeset: 1:2fe0c98a109d |
|
517 | 518 | bookmark: master |
|
518 | 519 | tag: tip |
|
519 | 520 | user: nottest <test@example.org> |
|
520 | 521 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
521 | 522 | files: foo |
|
522 | 523 | description: |
|
523 | 524 | addfoo2 |
|
524 | 525 | |
|
525 | 526 | different: test <test@example.org> |
|
526 | 527 | |
|
527 | 528 | |
|
528 | 529 | changeset: 0:0735477b0224 |
|
529 | 530 | user: test <test@example.org> |
|
530 | 531 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
531 | 532 | files: foo |
|
532 | 533 | description: |
|
533 | 534 | addfoo |
|
534 | 535 | |
|
535 | 536 | |
|
536 | 537 | |
|
537 | 538 | messagealways will always add the "committer: " line even if committer identical |
|
538 | 539 | |
|
539 | 540 | $ hg --config convert.git.committeractions=messagealways convert git-repo4 git-repo4-hg-messagealways |
|
540 | 541 | initializing destination git-repo4-hg-messagealways repository |
|
541 | 542 | scanning source... |
|
542 | 543 | sorting... |
|
543 | 544 | converting... |
|
544 | 545 | 1 addfoo |
|
545 | 546 | 0 addfoo2 |
|
546 | 547 | updating bookmarks |
|
547 | 548 | |
|
548 | 549 | $ hg -R git-repo4-hg-messagealways log -v |
|
549 | 550 | changeset: 1:8db057d8cd37 |
|
550 | 551 | bookmark: master |
|
551 | 552 | tag: tip |
|
552 | 553 | user: nottest <test@example.org> |
|
553 | 554 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
554 | 555 | files: foo |
|
555 | 556 | description: |
|
556 | 557 | addfoo2 |
|
557 | 558 | |
|
558 | 559 | committer: test <test@example.org> |
|
559 | 560 | |
|
560 | 561 | |
|
561 | 562 | changeset: 0:8f71fe9c98be |
|
562 | 563 | user: test <test@example.org> |
|
563 | 564 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
564 | 565 | files: foo |
|
565 | 566 | description: |
|
566 | 567 | addfoo |
|
567 | 568 | |
|
568 | 569 | committer: test <test@example.org> |
|
569 | 570 | |
|
570 | 571 | |
|
571 | 572 | |
|
572 | 573 | custom prefix on messagealways works |
|
573 | 574 | |
|
574 | 575 | $ hg --config convert.git.committeractions=messagealways=always: convert git-repo4 git-repo4-hg-messagealwaysprefix |
|
575 | 576 | initializing destination git-repo4-hg-messagealwaysprefix repository |
|
576 | 577 | scanning source... |
|
577 | 578 | sorting... |
|
578 | 579 | converting... |
|
579 | 580 | 1 addfoo |
|
580 | 581 | 0 addfoo2 |
|
581 | 582 | updating bookmarks |
|
582 | 583 | |
|
583 | 584 | $ hg -R git-repo4-hg-messagealwaysprefix log -v |
|
584 | 585 | changeset: 1:83c17174de79 |
|
585 | 586 | bookmark: master |
|
586 | 587 | tag: tip |
|
587 | 588 | user: nottest <test@example.org> |
|
588 | 589 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
589 | 590 | files: foo |
|
590 | 591 | description: |
|
591 | 592 | addfoo2 |
|
592 | 593 | |
|
593 | 594 | always: test <test@example.org> |
|
594 | 595 | |
|
595 | 596 | |
|
596 | 597 | changeset: 0:2ac9bcb3534a |
|
597 | 598 | user: test <test@example.org> |
|
598 | 599 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
599 | 600 | files: foo |
|
600 | 601 | description: |
|
601 | 602 | addfoo |
|
602 | 603 | |
|
603 | 604 | always: test <test@example.org> |
|
604 | 605 | |
|
605 | 606 | |
|
606 | 607 | |
|
607 | 608 | replaceauthor replaces author with committer |
|
608 | 609 | |
|
609 | 610 | $ hg --config convert.git.committeractions=replaceauthor convert git-repo4 git-repo4-hg-replaceauthor |
|
610 | 611 | initializing destination git-repo4-hg-replaceauthor repository |
|
611 | 612 | scanning source... |
|
612 | 613 | sorting... |
|
613 | 614 | converting... |
|
614 | 615 | 1 addfoo |
|
615 | 616 | 0 addfoo2 |
|
616 | 617 | updating bookmarks |
|
617 | 618 | |
|
618 | 619 | $ hg -R git-repo4-hg-replaceauthor log -v |
|
619 | 620 | changeset: 1:122c1d8999ea |
|
620 | 621 | bookmark: master |
|
621 | 622 | tag: tip |
|
622 | 623 | user: test <test@example.org> |
|
623 | 624 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
624 | 625 | files: foo |
|
625 | 626 | description: |
|
626 | 627 | addfoo2 |
|
627 | 628 | |
|
628 | 629 | |
|
629 | 630 | changeset: 0:0735477b0224 |
|
630 | 631 | user: test <test@example.org> |
|
631 | 632 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
632 | 633 | files: foo |
|
633 | 634 | description: |
|
634 | 635 | addfoo |
|
635 | 636 | |
|
636 | 637 | |
|
637 | 638 | |
|
638 | 639 | dropcommitter removes the committer |
|
639 | 640 | |
|
640 | 641 | $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter |
|
641 | 642 | initializing destination git-repo4-hg-dropcommitter repository |
|
642 | 643 | scanning source... |
|
643 | 644 | sorting... |
|
644 | 645 | converting... |
|
645 | 646 | 1 addfoo |
|
646 | 647 | 0 addfoo2 |
|
647 | 648 | updating bookmarks |
|
648 | 649 | |
|
649 | 650 | $ hg -R git-repo4-hg-dropcommitter log -v |
|
650 | 651 | changeset: 1:190b2da396cc |
|
651 | 652 | bookmark: master |
|
652 | 653 | tag: tip |
|
653 | 654 | user: nottest <test@example.org> |
|
654 | 655 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
655 | 656 | files: foo |
|
656 | 657 | description: |
|
657 | 658 | addfoo2 |
|
658 | 659 | |
|
659 | 660 | |
|
660 | 661 | changeset: 0:0735477b0224 |
|
661 | 662 | user: test <test@example.org> |
|
662 | 663 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
663 | 664 | files: foo |
|
664 | 665 | description: |
|
665 | 666 | addfoo |
|
666 | 667 | |
|
667 | 668 | |
|
668 | 669 | |
|
669 | 670 | --sourceorder should fail |
|
670 | 671 | |
|
671 | 672 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg |
|
672 | 673 | initializing destination git-repo4-sourcesort-hg repository |
|
673 | 674 | abort: --sourcesort is not supported by this data source |
|
674 | 675 | [255] |
|
675 | 676 | |
|
676 | 677 | test converting certain branches |
|
677 | 678 | |
|
678 | 679 | $ mkdir git-testrevs |
|
679 | 680 | $ cd git-testrevs |
|
680 | 681 | $ git init |
|
681 | 682 | Initialized empty Git repository in $TESTTMP/git-testrevs/.git/ |
|
682 | 683 | $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null |
|
683 | 684 | $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null |
|
684 | 685 | $ git checkout -b goodbranch 'HEAD^' |
|
685 | 686 | Switched to a new branch 'goodbranch' |
|
686 | 687 | $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null |
|
687 | 688 | $ git checkout -b badbranch 'HEAD^' |
|
688 | 689 | Switched to a new branch 'badbranch' |
|
689 | 690 | $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null |
|
690 | 691 | $ cd .. |
|
691 | 692 | $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch |
|
692 | 693 | initializing destination hg-testrevs repository |
|
693 | 694 | scanning source... |
|
694 | 695 | sorting... |
|
695 | 696 | converting... |
|
696 | 697 | 2 first |
|
697 | 698 | 1 good branch commit |
|
698 | 699 | 0 master commit |
|
699 | 700 | updating bookmarks |
|
700 | 701 | $ cd hg-testrevs |
|
701 | 702 | $ hg log -G -T '{rev} {bookmarks}' |
|
702 | 703 | o 2 master |
|
703 | 704 | | |
|
704 | 705 | | o 1 goodbranch |
|
705 | 706 | |/ |
|
706 | 707 | o 0 |
|
707 | 708 | |
|
708 | 709 | $ cd .. |
|
709 | 710 | |
|
710 | 711 | test sub modules |
|
711 | 712 | |
|
712 | 713 | $ mkdir git-repo5 |
|
713 | 714 | $ cd git-repo5 |
|
714 | 715 | $ git init >/dev/null 2>/dev/null |
|
715 | 716 | $ echo 'sub' >> foo |
|
716 | 717 | $ git add foo |
|
717 | 718 | $ commit -a -m 'addfoo' |
|
718 | 719 | $ BASE=`pwd` |
|
719 | 720 | $ cd .. |
|
720 | 721 | $ mkdir git-repo6 |
|
721 | 722 | $ cd git-repo6 |
|
722 | 723 | $ git init >/dev/null 2>/dev/null |
|
723 | 724 | $ git submodule add ${BASE} >/dev/null 2>/dev/null |
|
724 | 725 | $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null |
|
725 | 726 | |
|
726 | 727 | test non-tab whitespace .gitmodules |
|
727 | 728 | |
|
728 | 729 | $ cat >> .gitmodules <<EOF |
|
729 | 730 | > [submodule "git-repo5"] |
|
730 | 731 | > path = git-repo5 |
|
731 | 732 | > url = git-repo5 |
|
732 | 733 | > EOF |
|
733 | 734 | $ git commit -q -a -m "weird white space submodule" |
|
734 | 735 | $ cd .. |
|
735 | 736 | $ hg convert git-repo6 hg-repo6 |
|
736 | 737 | initializing destination hg-repo6 repository |
|
737 | 738 | scanning source... |
|
738 | 739 | sorting... |
|
739 | 740 | converting... |
|
740 | 741 | 1 addsubmodule |
|
741 | 742 | 0 weird white space submodule |
|
742 | 743 | updating bookmarks |
|
743 | 744 | |
|
744 | 745 | $ rm -rf hg-repo6 |
|
745 | 746 | $ cd git-repo6 |
|
746 | 747 | $ git reset --hard 'HEAD^' > /dev/null |
|
747 | 748 | |
|
748 | 749 | test missing .gitmodules |
|
749 | 750 | |
|
750 | 751 | $ git submodule add ../git-repo4 >/dev/null 2>/dev/null |
|
751 | 752 | $ git checkout HEAD -- .gitmodules |
|
752 | 753 | $ git rm .gitmodules |
|
753 | 754 | rm '.gitmodules' |
|
754 | 755 | $ git commit -q -m "remove .gitmodules" .gitmodules |
|
755 | 756 | $ git commit -q -m "missing .gitmodules" |
|
756 | 757 | $ cd .. |
|
757 | 758 | $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist" |
|
758 | 759 | initializing destination hg-repo6 repository |
|
759 | 760 | scanning source... |
|
760 | 761 | sorting... |
|
761 | 762 | converting... |
|
762 | 763 | 2 addsubmodule |
|
763 | 764 | 1 remove .gitmodules |
|
764 | 765 | 0 missing .gitmodules |
|
765 | 766 | warning: cannot read submodules config file in * (glob) |
|
766 | 767 | updating bookmarks |
|
767 | 768 | $ rm -rf hg-repo6 |
|
768 | 769 | $ cd git-repo6 |
|
769 | 770 | $ rm -rf git-repo4 |
|
770 | 771 | $ git reset --hard 'HEAD^^' > /dev/null |
|
771 | 772 | $ cd .. |
|
772 | 773 | |
|
773 | 774 | test invalid splicemap1 |
|
774 | 775 | |
|
775 | 776 | $ cat > splicemap <<EOF |
|
776 | 777 | > $VALIDID1 |
|
777 | 778 | > EOF |
|
778 | 779 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg |
|
779 | 780 | initializing destination git-repo2-splicemap1-hg repository |
|
780 | 781 | abort: syntax error in splicemap(1): child parent1[,parent2] expected |
|
781 | 782 | [255] |
|
782 | 783 | |
|
783 | 784 | test invalid splicemap2 |
|
784 | 785 | |
|
785 | 786 | $ cat > splicemap <<EOF |
|
786 | 787 | > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2 |
|
787 | 788 | > EOF |
|
788 | 789 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg |
|
789 | 790 | initializing destination git-repo2-splicemap2-hg repository |
|
790 | 791 | abort: syntax error in splicemap(1): child parent1[,parent2] expected |
|
791 | 792 | [255] |
|
792 | 793 | |
|
793 | 794 | test invalid splicemap3 |
|
794 | 795 | |
|
795 | 796 | $ cat > splicemap <<EOF |
|
796 | 797 | > $INVALIDID1 $INVALIDID2 |
|
797 | 798 | > EOF |
|
798 | 799 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg |
|
799 | 800 | initializing destination git-repo2-splicemap3-hg repository |
|
800 | 801 | abort: splicemap entry afd12345af is not a valid revision identifier |
|
801 | 802 | [255] |
|
802 | 803 | |
|
803 | 804 | convert sub modules |
|
804 | 805 | $ hg convert git-repo6 git-repo6-hg |
|
805 | 806 | initializing destination git-repo6-hg repository |
|
806 | 807 | scanning source... |
|
807 | 808 | sorting... |
|
808 | 809 | converting... |
|
809 | 810 | 0 addsubmodule |
|
810 | 811 | updating bookmarks |
|
811 | 812 | $ hg -R git-repo6-hg log -v |
|
812 | 813 | changeset: 0:* (glob) |
|
813 | 814 | bookmark: master |
|
814 | 815 | tag: tip |
|
815 | 816 | user: nottest <test@example.org> |
|
816 | 817 | date: Mon Jan 01 00:00:23 2007 +0000 |
|
817 | 818 | files: .hgsub .hgsubstate |
|
818 | 819 | description: |
|
819 | 820 | addsubmodule |
|
820 | 821 | |
|
821 | 822 | committer: test <test@example.org> |
|
822 | 823 | |
|
823 | 824 | |
|
824 | 825 | |
|
825 | 826 | $ cd git-repo6-hg |
|
826 | 827 | $ hg up >/dev/null 2>/dev/null |
|
827 | 828 | $ cat .hgsubstate |
|
828 | 829 | * git-repo5 (glob) |
|
829 | 830 | $ cd git-repo5 |
|
830 | 831 | $ cat foo |
|
831 | 832 | sub |
|
832 | 833 | |
|
833 | 834 | $ cd ../.. |
|
834 | 835 | |
|
835 | 836 | make sure rename detection doesn't break removing and adding gitmodules |
|
836 | 837 | |
|
837 | 838 | $ cd git-repo6 |
|
838 | 839 | $ git mv .gitmodules .gitmodules-renamed |
|
839 | 840 | $ commit -a -m 'rename .gitmodules' |
|
840 | 841 | $ git mv .gitmodules-renamed .gitmodules |
|
841 | 842 | $ commit -a -m 'rename .gitmodules back' |
|
842 | 843 | $ cd .. |
|
843 | 844 | |
|
844 | 845 | $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg |
|
845 | 846 | $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n" |
|
846 | 847 | rename .gitmodules |
|
847 | 848 | $ hg -R git-repo6-hg status -C --change 'tip^' |
|
848 | 849 | A .gitmodules-renamed |
|
849 | 850 | R .hgsub |
|
850 | 851 | R .hgsubstate |
|
851 | 852 | $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n" |
|
852 | 853 | rename .gitmodules back |
|
853 | 854 | $ hg -R git-repo6-hg status -C --change tip |
|
854 | 855 | A .hgsub |
|
855 | 856 | A .hgsubstate |
|
856 | 857 | R .gitmodules-renamed |
|
857 | 858 | |
|
858 | 859 | convert the revision removing '.gitmodules' itself (and related |
|
859 | 860 | submodules) |
|
860 | 861 | |
|
861 | 862 | $ cd git-repo6 |
|
862 | 863 | $ git rm .gitmodules |
|
863 | 864 | rm '.gitmodules' |
|
864 | 865 | $ git rm --cached git-repo5 |
|
865 | 866 | rm 'git-repo5' |
|
866 | 867 | $ commit -a -m 'remove .gitmodules and submodule git-repo5' |
|
867 | 868 | $ cd .. |
|
868 | 869 | |
|
869 | 870 | $ hg convert -q git-repo6 git-repo6-hg |
|
870 | 871 | $ hg -R git-repo6-hg tip -T "{desc|firstline}\n" |
|
871 | 872 | remove .gitmodules and submodule git-repo5 |
|
872 | 873 | $ hg -R git-repo6-hg tip -T "{file_dels}\n" |
|
873 | 874 | .hgsub .hgsubstate |
|
874 | 875 | |
|
875 | 876 | skip submodules in the conversion |
|
876 | 877 | |
|
877 | 878 | $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True |
|
878 | 879 | $ hg -R no-submodules manifest --all |
|
879 | 880 | .gitmodules-renamed |
|
880 | 881 | |
|
881 | 882 | convert using a different remote prefix |
|
882 | 883 | $ git init git-repo7 |
|
883 | 884 | Initialized empty Git repository in $TESTTMP/git-repo7/.git/ |
|
884 | 885 | $ cd git-repo7 |
|
885 | 886 | TODO: it'd be nice to use (?) lines instead of grep -v to handle the |
|
886 | 887 | git output variance, but that doesn't currently work in the middle of |
|
887 | 888 | a block, so do this for now. |
|
888 | 889 | $ touch a && git add a && git commit -am "commit a" | grep -v changed |
|
889 | 890 | [master (root-commit) 8ae5f69] commit a |
|
890 | 891 | Author: nottest <test@example.org> |
|
891 | 892 | create mode 100644 a |
|
892 | 893 | $ cd .. |
|
893 | 894 | $ git clone git-repo7 git-repo7-client |
|
894 | 895 | Cloning into 'git-repo7-client'... |
|
895 | 896 | done. |
|
896 | 897 | $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7 |
|
897 | 898 | initializing destination hg-repo7 repository |
|
898 | 899 | scanning source... |
|
899 | 900 | sorting... |
|
900 | 901 | converting... |
|
901 | 902 | 0 commit a |
|
902 | 903 | updating bookmarks |
|
903 | 904 | $ hg -R hg-repo7 bookmarks |
|
904 | 905 | master 0:03bf38caa4c6 |
|
905 | 906 | origin/master 0:03bf38caa4c6 |
|
906 | 907 | |
|
907 | 908 | Run convert when the remote branches have changed |
|
908 | 909 | (there was an old bug where the local convert read branches from the server) |
|
909 | 910 | |
|
910 | 911 | $ cd git-repo7 |
|
911 | 912 | $ echo a >> a |
|
912 | 913 | $ git commit -q -am "move master forward" |
|
913 | 914 | $ cd .. |
|
914 | 915 | $ rm -rf hg-repo7 |
|
915 | 916 | $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7 |
|
916 | 917 | initializing destination hg-repo7 repository |
|
917 | 918 | scanning source... |
|
918 | 919 | sorting... |
|
919 | 920 | converting... |
|
920 | 921 | 0 commit a |
|
921 | 922 | updating bookmarks |
|
922 | 923 | $ hg -R hg-repo7 bookmarks |
|
923 | 924 | master 0:03bf38caa4c6 |
|
924 | 925 | origin/master 0:03bf38caa4c6 |
|
925 | 926 | |
|
926 | 927 | damaged git repository tests: |
|
927 | 928 | In case the hard-coded hashes change, the following commands can be used to |
|
928 | 929 | list the hashes and their corresponding types in the repository: |
|
929 | 930 | cd git-repo4/.git/objects |
|
930 | 931 | find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t |
|
931 | 932 | cd ../../.. |
|
932 | 933 | |
|
933 | 934 | damage git repository by renaming a commit object |
|
934 | 935 | $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
|
935 | 936 | $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp |
|
936 | 937 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
937 | 938 | abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git |
|
938 | 939 | $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ |
|
939 | 940 | damage git repository by renaming a blob object |
|
940 | 941 | |
|
941 | 942 | $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc |
|
942 | 943 | $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp |
|
943 | 944 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
944 | 945 | abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc |
|
945 | 946 | $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ |
|
946 | 947 | damage git repository by renaming a tree object |
|
947 | 948 | |
|
948 | 949 | $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635 |
|
949 | 950 | $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp |
|
950 | 951 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
951 | 952 | abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
|
952 | 953 | |
|
953 | 954 | #if no-windows git19 |
|
954 | 955 | |
|
955 | 956 | test for escaping the repo name (CVE-2016-3069) |
|
956 | 957 | |
|
957 | 958 | $ git init '`echo pwned >COMMAND-INJECTION`' |
|
958 | 959 | Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/ |
|
959 | 960 | $ cd '`echo pwned >COMMAND-INJECTION`' |
|
960 | 961 | $ git commit -q --allow-empty -m 'empty' |
|
961 | 962 | $ cd .. |
|
962 | 963 | $ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted' |
|
963 | 964 | initializing destination converted repository |
|
964 | 965 | scanning source... |
|
965 | 966 | sorting... |
|
966 | 967 | converting... |
|
967 | 968 | 0 empty |
|
968 | 969 | updating bookmarks |
|
969 | 970 | $ test -f COMMAND-INJECTION |
|
970 | 971 | [1] |
|
971 | 972 | |
|
972 | 973 | test for safely passing paths to git (CVE-2016-3105) |
|
973 | 974 | |
|
974 | 975 | $ git init 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' |
|
975 | 976 | Initialized empty Git repository in $TESTTMP/ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #/.git/ |
|
976 | 977 | $ cd 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' |
|
977 | 978 | $ git commit -q --allow-empty -m 'empty' |
|
978 | 979 | $ cd .. |
|
979 | 980 | $ hg convert 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' 'converted-git-ext' |
|
980 | 981 | initializing destination converted-git-ext repository |
|
981 | 982 | scanning source... |
|
982 | 983 | sorting... |
|
983 | 984 | converting... |
|
984 | 985 | 0 empty |
|
985 | 986 | updating bookmarks |
|
986 | 987 | $ test -f GIT-EXT-COMMAND-INJECTION |
|
987 | 988 | [1] |
|
988 | 989 | |
|
989 | 990 | #endif |
|
990 | 991 | |
|
991 | 992 | Conversion of extra commit metadata to extras works |
|
992 | 993 | |
|
993 | 994 | $ git init gitextras >/dev/null 2>/dev/null |
|
994 | 995 | $ cd gitextras |
|
995 | 996 | $ touch foo |
|
996 | 997 | $ git add foo |
|
997 | 998 | $ commit -m initial |
|
998 | 999 | $ echo 1 > foo |
|
999 | 1000 | $ tree=`git write-tree` |
|
1000 | 1001 | |
|
1001 | 1002 | Git doesn't provider a user-facing API to write extra metadata into the |
|
1002 | 1003 | commit, so create the commit object by hand |
|
1003 | 1004 | |
|
1004 | 1005 | $ git hash-object -t commit -w --stdin << EOF |
|
1005 | 1006 | > tree ${tree} |
|
1006 | 1007 | > parent ba6b1344e977ece9e00958dbbf17f1f09384b2c1 |
|
1007 | 1008 | > author test <test@example.com> 1000000000 +0000 |
|
1008 | 1009 | > committer test <test@example.com> 1000000000 +0000 |
|
1009 | 1010 | > extra-1 extra-1 |
|
1010 | 1011 | > extra-2 extra-2 with space |
|
1011 | 1012 | > convert_revision 0000aaaabbbbccccddddeeee |
|
1012 | 1013 | > |
|
1013 | 1014 | > message with extras |
|
1014 | 1015 | > EOF |
|
1015 | 1016 | 8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1016 | 1017 | |
|
1017 | 1018 | $ git reset --hard 8123727c8361a4117d1a2d80e0c4e7d70c757f18 > /dev/null |
|
1018 | 1019 | |
|
1019 | 1020 | $ cd .. |
|
1020 | 1021 | |
|
1021 | 1022 | convert will not retain custom metadata keys by default |
|
1022 | 1023 | |
|
1023 | 1024 | $ hg convert gitextras hgextras1 |
|
1024 | 1025 | initializing destination hgextras1 repository |
|
1025 | 1026 | scanning source... |
|
1026 | 1027 | sorting... |
|
1027 | 1028 | converting... |
|
1028 | 1029 | 1 initial |
|
1029 | 1030 | 0 message with extras |
|
1030 | 1031 | updating bookmarks |
|
1031 | 1032 | |
|
1032 | 1033 | $ hg -R hgextras1 log --debug -r 1 |
|
1033 | 1034 | changeset: 1:e13a39880f68479127b2a80fa0b448cc8524aa09 |
|
1034 | 1035 | bookmark: master |
|
1035 | 1036 | tag: tip |
|
1036 | 1037 | phase: draft |
|
1037 | 1038 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1038 | 1039 | parent: -1:0000000000000000000000000000000000000000 |
|
1039 | 1040 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1040 | 1041 | user: test <test@example.com> |
|
1041 | 1042 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1042 | 1043 | extra: branch=default |
|
1043 | 1044 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1044 | 1045 | description: |
|
1045 | 1046 | message with extras |
|
1046 | 1047 | |
|
1047 | 1048 | |
|
1048 | 1049 | |
|
1049 | 1050 | Attempting to convert a banned extra is disallowed |
|
1050 | 1051 | |
|
1051 | 1052 | $ hg convert --config convert.git.extrakeys=tree,parent gitextras hgextras-banned |
|
1052 | 1053 | initializing destination hgextras-banned repository |
|
1053 | 1054 | abort: copying of extra key is forbidden: parent, tree |
|
1054 | 1055 | [255] |
|
1055 | 1056 | |
|
1056 | 1057 | Converting a specific extra works |
|
1057 | 1058 | |
|
1058 | 1059 | $ hg convert --config convert.git.extrakeys=extra-1 gitextras hgextras2 |
|
1059 | 1060 | initializing destination hgextras2 repository |
|
1060 | 1061 | scanning source... |
|
1061 | 1062 | sorting... |
|
1062 | 1063 | converting... |
|
1063 | 1064 | 1 initial |
|
1064 | 1065 | 0 message with extras |
|
1065 | 1066 | updating bookmarks |
|
1066 | 1067 | |
|
1067 | 1068 | $ hg -R hgextras2 log --debug -r 1 |
|
1068 | 1069 | changeset: 1:d40fb205d58597e6ecfd55b16f198be5bf436391 |
|
1069 | 1070 | bookmark: master |
|
1070 | 1071 | tag: tip |
|
1071 | 1072 | phase: draft |
|
1072 | 1073 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1073 | 1074 | parent: -1:0000000000000000000000000000000000000000 |
|
1074 | 1075 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1075 | 1076 | user: test <test@example.com> |
|
1076 | 1077 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1077 | 1078 | extra: branch=default |
|
1078 | 1079 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1079 | 1080 | extra: extra-1=extra-1 |
|
1080 | 1081 | description: |
|
1081 | 1082 | message with extras |
|
1082 | 1083 | |
|
1083 | 1084 | |
|
1084 | 1085 | |
|
1085 | 1086 | Converting multiple extras works |
|
1086 | 1087 | |
|
1087 | 1088 | $ hg convert --config convert.git.extrakeys=extra-1,extra-2 gitextras hgextras3 |
|
1088 | 1089 | initializing destination hgextras3 repository |
|
1089 | 1090 | scanning source... |
|
1090 | 1091 | sorting... |
|
1091 | 1092 | converting... |
|
1092 | 1093 | 1 initial |
|
1093 | 1094 | 0 message with extras |
|
1094 | 1095 | updating bookmarks |
|
1095 | 1096 | |
|
1096 | 1097 | $ hg -R hgextras3 log --debug -r 1 |
|
1097 | 1098 | changeset: 1:0105af33379e7b6491501fd34141b7af700fe125 |
|
1098 | 1099 | bookmark: master |
|
1099 | 1100 | tag: tip |
|
1100 | 1101 | phase: draft |
|
1101 | 1102 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1102 | 1103 | parent: -1:0000000000000000000000000000000000000000 |
|
1103 | 1104 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1104 | 1105 | user: test <test@example.com> |
|
1105 | 1106 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1106 | 1107 | extra: branch=default |
|
1107 | 1108 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1108 | 1109 | extra: extra-1=extra-1 |
|
1109 | 1110 | extra: extra-2=extra-2 with space |
|
1110 | 1111 | description: |
|
1111 | 1112 | message with extras |
|
1112 | 1113 | |
|
1113 | 1114 | |
|
1114 | 1115 | |
|
1115 | 1116 | convert.git.saverev can be disabled to prevent convert_revision from being written |
|
1116 | 1117 | |
|
1117 | 1118 | $ hg convert --config convert.git.saverev=false gitextras hgextras4 |
|
1118 | 1119 | initializing destination hgextras4 repository |
|
1119 | 1120 | scanning source... |
|
1120 | 1121 | sorting... |
|
1121 | 1122 | converting... |
|
1122 | 1123 | 1 initial |
|
1123 | 1124 | 0 message with extras |
|
1124 | 1125 | updating bookmarks |
|
1125 | 1126 | |
|
1126 | 1127 | $ hg -R hgextras4 log --debug -r 1 |
|
1127 | 1128 | changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c |
|
1128 | 1129 | bookmark: master |
|
1129 | 1130 | tag: tip |
|
1130 | 1131 | phase: draft |
|
1131 | 1132 | parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d |
|
1132 | 1133 | parent: -1:0000000000000000000000000000000000000000 |
|
1133 | 1134 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1134 | 1135 | user: test <test@example.com> |
|
1135 | 1136 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1136 | 1137 | extra: branch=default |
|
1137 | 1138 | description: |
|
1138 | 1139 | message with extras |
|
1139 | 1140 | |
|
1140 | 1141 | |
|
1141 | 1142 | |
|
1142 | 1143 | convert.git.saverev and convert.git.extrakeys can be combined to preserve |
|
1143 | 1144 | convert_revision from source |
|
1144 | 1145 | |
|
1145 | 1146 | $ hg convert --config convert.git.saverev=false --config convert.git.extrakeys=convert_revision gitextras hgextras5 |
|
1146 | 1147 | initializing destination hgextras5 repository |
|
1147 | 1148 | scanning source... |
|
1148 | 1149 | sorting... |
|
1149 | 1150 | converting... |
|
1150 | 1151 | 1 initial |
|
1151 | 1152 | 0 message with extras |
|
1152 | 1153 | updating bookmarks |
|
1153 | 1154 | |
|
1154 | 1155 | $ hg -R hgextras5 log --debug -r 1 |
|
1155 | 1156 | changeset: 1:574d85931544d4542007664fee3747360e85ee28 |
|
1156 | 1157 | bookmark: master |
|
1157 | 1158 | tag: tip |
|
1158 | 1159 | phase: draft |
|
1159 | 1160 | parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d |
|
1160 | 1161 | parent: -1:0000000000000000000000000000000000000000 |
|
1161 | 1162 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1162 | 1163 | user: test <test@example.com> |
|
1163 | 1164 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1164 | 1165 | extra: branch=default |
|
1165 | 1166 | extra: convert_revision=0000aaaabbbbccccddddeeee |
|
1166 | 1167 | description: |
|
1167 | 1168 | message with extras |
|
1168 | 1169 | |
|
1169 | 1170 |
General Comments 0
You need to be logged in to leave comments.
Login now