Show More
@@ -1,515 +1,517 b'' | |||
|
1 | 1 | #require git |
|
2 | 2 | |
|
3 | 3 | $ echo "[core]" >> $HOME/.gitconfig |
|
4 | 4 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
5 | 5 | $ echo "[core]" >> $HOME/.gitconfig |
|
6 | 6 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
7 | 7 | $ echo "[extensions]" >> $HGRCPATH |
|
8 | 8 | $ echo "convert=" >> $HGRCPATH |
|
9 | 9 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
10 | 10 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
11 | 11 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE |
|
12 | 12 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
13 | 13 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
14 | 14 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
15 | 15 | $ INVALIDID1=afd12345af |
|
16 | 16 | $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86 |
|
17 | 17 | $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357 |
|
18 | 18 | $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da |
|
19 | 19 | $ count=10 |
|
20 | 20 | $ commit() |
|
21 | 21 | > { |
|
22 | 22 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" |
|
23 | 23 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" |
|
24 | 24 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" |
|
25 | 25 | > count=`expr $count + 1` |
|
26 | 26 | > } |
|
27 | 27 | $ mkdir git-repo |
|
28 | 28 | $ cd git-repo |
|
29 | 29 | $ git init-db >/dev/null 2>/dev/null |
|
30 | 30 | $ echo a > a |
|
31 | 31 | $ mkdir d |
|
32 | 32 | $ echo b > d/b |
|
33 | 33 | $ git add a d |
|
34 | 34 | $ commit -a -m t1 |
|
35 | 35 | |
|
36 | 36 | Remove the directory, then try to replace it with a file (issue754) |
|
37 | 37 | |
|
38 | 38 | $ git rm -f d/b |
|
39 | 39 | rm 'd/b' |
|
40 | 40 | $ commit -m t2 |
|
41 | 41 | $ echo d > d |
|
42 | 42 | $ git add d |
|
43 | 43 | $ commit -m t3 |
|
44 | 44 | $ echo b >> a |
|
45 | 45 | $ commit -a -m t4.1 |
|
46 | 46 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null |
|
47 | 47 | $ echo c > a |
|
48 | 48 | $ echo a >> a |
|
49 | 49 | $ commit -a -m t4.2 |
|
50 | 50 | $ git checkout master >/dev/null 2>/dev/null |
|
51 | 51 | $ git pull --no-commit . other > /dev/null 2>/dev/null |
|
52 | 52 | $ commit -m 'Merge branch other' |
|
53 | 53 | $ cd .. |
|
54 | 54 | $ hg convert --config extensions.progress= --config progress.assume-tty=1 \ |
|
55 | 55 | > --config progress.delay=0 --config progress.changedelay=0 \ |
|
56 | 56 | > --config progress.refresh=0 --config progress.width=60 \ |
|
57 | 57 | > --datesort git-repo |
|
58 | 58 | \r (no-eol) (esc) |
|
59 | 59 | scanning [======> ] 1/6\r (no-eol) (esc) |
|
60 | 60 | scanning [=============> ] 2/6\r (no-eol) (esc) |
|
61 | 61 | scanning [=====================> ] 3/6\r (no-eol) (esc) |
|
62 | 62 | scanning [============================> ] 4/6\r (no-eol) (esc) |
|
63 | 63 | scanning [===================================> ] 5/6\r (no-eol) (esc) |
|
64 | 64 | scanning [===========================================>] 6/6\r (no-eol) (esc) |
|
65 | 65 | \r (no-eol) (esc) |
|
66 | 66 | \r (no-eol) (esc) |
|
67 | 67 | converting [ ] 0/6\r (no-eol) (esc) |
|
68 | 68 | getting files [==================> ] 1/2\r (no-eol) (esc) |
|
69 | 69 | getting files [======================================>] 2/2\r (no-eol) (esc) |
|
70 | 70 | \r (no-eol) (esc) |
|
71 | 71 | \r (no-eol) (esc) |
|
72 | 72 | converting [======> ] 1/6\r (no-eol) (esc) |
|
73 | 73 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
74 | 74 | \r (no-eol) (esc) |
|
75 | 75 | \r (no-eol) (esc) |
|
76 | 76 | converting [=============> ] 2/6\r (no-eol) (esc) |
|
77 | 77 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
78 | 78 | \r (no-eol) (esc) |
|
79 | 79 | \r (no-eol) (esc) |
|
80 | 80 | converting [====================> ] 3/6\r (no-eol) (esc) |
|
81 | 81 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
82 | 82 | \r (no-eol) (esc) |
|
83 | 83 | \r (no-eol) (esc) |
|
84 | 84 | converting [===========================> ] 4/6\r (no-eol) (esc) |
|
85 | 85 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
86 | 86 | \r (no-eol) (esc) |
|
87 | 87 | \r (no-eol) (esc) |
|
88 | 88 | converting [==================================> ] 5/6\r (no-eol) (esc) |
|
89 | 89 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
90 | 90 | \r (no-eol) (esc) |
|
91 | 91 | assuming destination git-repo-hg |
|
92 | 92 | initializing destination git-repo-hg repository |
|
93 | 93 | scanning source... |
|
94 | 94 | sorting... |
|
95 | 95 | converting... |
|
96 | 96 | 5 t1 |
|
97 | 97 | 4 t2 |
|
98 | 98 | 3 t3 |
|
99 | 99 | 2 t4.1 |
|
100 | 100 | 1 t4.2 |
|
101 | 101 | 0 Merge branch other |
|
102 | 102 | updating bookmarks |
|
103 | 103 | $ hg up -q -R git-repo-hg |
|
104 | 104 | $ hg -R git-repo-hg tip -v |
|
105 | 105 | changeset: 5:c78094926be2 |
|
106 | 106 | bookmark: master |
|
107 | 107 | tag: tip |
|
108 | 108 | parent: 3:f5f5cb45432b |
|
109 | 109 | parent: 4:4e174f80c67c |
|
110 | 110 | user: test <test@example.org> |
|
111 | 111 | date: Mon Jan 01 00:00:15 2007 +0000 |
|
112 | 112 | files: a |
|
113 | 113 | description: |
|
114 | 114 | Merge branch other |
|
115 | 115 | |
|
116 | 116 | |
|
117 | 117 | $ count=10 |
|
118 | 118 | $ mkdir git-repo2 |
|
119 | 119 | $ cd git-repo2 |
|
120 | 120 | $ git init-db >/dev/null 2>/dev/null |
|
121 | 121 | $ echo foo > foo |
|
122 | 122 | $ git add foo |
|
123 | 123 | $ commit -a -m 'add foo' |
|
124 | 124 | $ echo >> foo |
|
125 | 125 | $ commit -a -m 'change foo' |
|
126 | 126 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null |
|
127 | 127 | $ echo quux >> quux |
|
128 | 128 | $ git add quux |
|
129 | 129 | $ commit -a -m 'add quux' |
|
130 | 130 | $ echo bar > bar |
|
131 | 131 | $ git add bar |
|
132 | 132 | $ commit -a -m 'add bar' |
|
133 | 133 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null |
|
134 | 134 | $ echo baz > baz |
|
135 | 135 | $ git add baz |
|
136 | 136 | $ commit -a -m 'add baz' |
|
137 | 137 | $ git checkout master >/dev/null 2>/dev/null |
|
138 | 138 | $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null |
|
139 | 139 | $ commit -m 'Octopus merge' |
|
140 | 140 | $ echo bar >> bar |
|
141 | 141 | $ commit -a -m 'change bar' |
|
142 | 142 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null |
|
143 | 143 | $ echo >> foo |
|
144 | 144 | $ commit -a -m 'change foo' |
|
145 | 145 | $ git checkout master >/dev/null 2>/dev/null |
|
146 | 146 | $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null |
|
147 | 147 | $ commit -m 'Discard change to foo' |
|
148 | 148 | $ cd .. |
|
149 | 149 | $ glog() |
|
150 | 150 | > { |
|
151 | 151 | > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
152 | 152 | > } |
|
153 | 153 | $ splitrepo() |
|
154 | 154 | > { |
|
155 | 155 | > msg="$1" |
|
156 | 156 | > files="$2" |
|
157 | 157 | > opts=$3 |
|
158 | 158 | > echo "% $files: $msg" |
|
159 | 159 | > prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
160 | 160 | > fmap="$prefix.fmap" |
|
161 | 161 | > repo="$prefix.repo" |
|
162 | 162 | > for i in $files; do |
|
163 | 163 | > echo "include $i" >> "$fmap" |
|
164 | 164 | > done |
|
165 | 165 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" |
|
166 | 166 | > hg up -q -R "$repo" |
|
167 | 167 | > glog -R "$repo" |
|
168 | 168 | > hg -R "$repo" manifest --debug |
|
169 | 169 | > } |
|
170 | 170 | |
|
171 | 171 | full conversion |
|
172 | 172 | |
|
173 | 173 | $ hg -q convert --datesort git-repo2 fullrepo |
|
174 | 174 | $ hg up -q -R fullrepo |
|
175 | 175 | $ glog -R fullrepo |
|
176 | 176 | @ 9 "Discard change to foo" files: foo |
|
177 | 177 | |\ |
|
178 | 178 | | o 8 "change foo" files: foo |
|
179 | 179 | | | |
|
180 | 180 | o | 7 "change bar" files: bar |
|
181 | 181 | |/ |
|
182 | 182 | o 6 "(octopus merge fixup)" files: |
|
183 | 183 | |\ |
|
184 | 184 | | o 5 "Octopus merge" files: baz |
|
185 | 185 | | |\ |
|
186 | 186 | o | | 4 "add baz" files: baz |
|
187 | 187 | | | | |
|
188 | 188 | +---o 3 "add bar" files: bar |
|
189 | 189 | | | |
|
190 | 190 | o | 2 "add quux" files: quux |
|
191 | 191 | | | |
|
192 | 192 | | o 1 "change foo" files: foo |
|
193 | 193 | |/ |
|
194 | 194 | o 0 "add foo" files: foo |
|
195 | 195 | |
|
196 | 196 | $ hg -R fullrepo manifest --debug |
|
197 | 197 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
198 | 198 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
199 | 199 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
200 | 200 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
201 | 201 | $ splitrepo 'octopus merge' 'foo bar baz' |
|
202 | 202 | % foo bar baz: octopus merge |
|
203 | 203 | @ 8 "Discard change to foo" files: foo |
|
204 | 204 | |\ |
|
205 | 205 | | o 7 "change foo" files: foo |
|
206 | 206 | | | |
|
207 | 207 | o | 6 "change bar" files: bar |
|
208 | 208 | |/ |
|
209 | 209 | o 5 "(octopus merge fixup)" files: |
|
210 | 210 | |\ |
|
211 | 211 | | o 4 "Octopus merge" files: baz |
|
212 | 212 | | |\ |
|
213 | 213 | o | | 3 "add baz" files: baz |
|
214 | 214 | | | | |
|
215 | 215 | +---o 2 "add bar" files: bar |
|
216 | 216 | | | |
|
217 | 217 | | o 1 "change foo" files: foo |
|
218 | 218 | |/ |
|
219 | 219 | o 0 "add foo" files: foo |
|
220 | 220 | |
|
221 | 221 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
222 | 222 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
223 | 223 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
224 | 224 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' |
|
225 | 225 | % foo baz quux: only some parents of an octopus merge; "discard" a head |
|
226 | 226 | @ 6 "Discard change to foo" files: foo |
|
227 | 227 | | |
|
228 | 228 | o 5 "change foo" files: foo |
|
229 | 229 | | |
|
230 | 230 | o 4 "Octopus merge" files: |
|
231 | 231 | |\ |
|
232 | 232 | | o 3 "add baz" files: baz |
|
233 | 233 | | | |
|
234 | 234 | | o 2 "add quux" files: quux |
|
235 | 235 | | | |
|
236 | 236 | o | 1 "change foo" files: foo |
|
237 | 237 | |/ |
|
238 | 238 | o 0 "add foo" files: foo |
|
239 | 239 | |
|
240 | 240 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
241 | 241 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
242 | 242 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
243 | 243 | |
|
244 | 244 | test importing git renames and copies |
|
245 | 245 | |
|
246 | 246 | $ cd git-repo2 |
|
247 | 247 | $ git mv foo foo-renamed |
|
248 | 248 | since bar is not touched in this commit, this copy will not be detected |
|
249 | 249 | $ cp bar bar-copied |
|
250 | 250 | $ cp baz baz-copied |
|
251 | 251 | $ cp baz baz-copied2 |
|
252 | 252 | $ echo baz2 >> baz |
|
253 | 253 | $ git add bar-copied baz-copied baz-copied2 |
|
254 | 254 | $ commit -a -m 'rename and copy' |
|
255 | 255 | $ cd .. |
|
256 | 256 | |
|
257 | 257 | input validation |
|
258 | 258 | $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo |
|
259 | 259 | abort: convert.git.similarity is not an integer ('foo') |
|
260 | 260 | [255] |
|
261 | 261 | $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo |
|
262 | 262 | abort: similarity must be between 0 and 100 |
|
263 | 263 | [255] |
|
264 | 264 | $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo |
|
265 | 265 | abort: similarity must be between 0 and 100 |
|
266 | 266 | [255] |
|
267 | 267 | |
|
268 | 268 | $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo |
|
269 | 269 | $ hg -R fullrepo status -C --change master |
|
270 | 270 | M baz |
|
271 | 271 | A bar-copied |
|
272 | 272 | A baz-copied |
|
273 | 273 | baz |
|
274 | 274 | A baz-copied2 |
|
275 | 275 | baz |
|
276 | 276 | A foo-renamed |
|
277 | 277 | foo |
|
278 | 278 | R foo |
|
279 | 279 | |
|
280 | 280 | $ cd git-repo2 |
|
281 | $ echo bar2 >> bar | |
|
282 | $ commit -a -m 'change bar' | |
|
281 | 283 | $ cp bar bar-copied2 |
|
282 | 284 | $ git add bar-copied2 |
|
283 | 285 | $ commit -a -m 'copy with no changes' |
|
284 | 286 | $ cd .. |
|
285 | 287 | |
|
286 | 288 | $ hg -q convert --config convert.git.similarity=100 \ |
|
287 | 289 | > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo |
|
288 | 290 | $ hg -R fullrepo status -C --change master |
|
289 | 291 | A bar-copied2 |
|
290 | 292 | bar |
|
291 | 293 | |
|
292 | 294 | test binary conversion (issue1359) |
|
293 | 295 | |
|
294 | 296 | $ count=19 |
|
295 | 297 | $ mkdir git-repo3 |
|
296 | 298 | $ cd git-repo3 |
|
297 | 299 | $ git init-db >/dev/null 2>/dev/null |
|
298 | 300 | $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' |
|
299 | 301 | $ git add b |
|
300 | 302 | $ commit -a -m addbinary |
|
301 | 303 | $ cd .. |
|
302 | 304 | |
|
303 | 305 | convert binary file |
|
304 | 306 | |
|
305 | 307 | $ hg convert git-repo3 git-repo3-hg |
|
306 | 308 | initializing destination git-repo3-hg repository |
|
307 | 309 | scanning source... |
|
308 | 310 | sorting... |
|
309 | 311 | converting... |
|
310 | 312 | 0 addbinary |
|
311 | 313 | updating bookmarks |
|
312 | 314 | $ cd git-repo3-hg |
|
313 | 315 | $ hg up -C |
|
314 | 316 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
315 | 317 | $ python -c 'print len(file("b", "rb").read())' |
|
316 | 318 | 4096 |
|
317 | 319 | $ cd .. |
|
318 | 320 | |
|
319 | 321 | test author vs committer |
|
320 | 322 | |
|
321 | 323 | $ mkdir git-repo4 |
|
322 | 324 | $ cd git-repo4 |
|
323 | 325 | $ git init-db >/dev/null 2>/dev/null |
|
324 | 326 | $ echo >> foo |
|
325 | 327 | $ git add foo |
|
326 | 328 | $ commit -a -m addfoo |
|
327 | 329 | $ echo >> foo |
|
328 | 330 | $ GIT_AUTHOR_NAME="nottest" |
|
329 | 331 | $ commit -a -m addfoo2 |
|
330 | 332 | $ cd .. |
|
331 | 333 | |
|
332 | 334 | convert author committer |
|
333 | 335 | |
|
334 | 336 | $ hg convert git-repo4 git-repo4-hg |
|
335 | 337 | initializing destination git-repo4-hg repository |
|
336 | 338 | scanning source... |
|
337 | 339 | sorting... |
|
338 | 340 | converting... |
|
339 | 341 | 1 addfoo |
|
340 | 342 | 0 addfoo2 |
|
341 | 343 | updating bookmarks |
|
342 | 344 | $ hg -R git-repo4-hg log -v |
|
343 | 345 | changeset: 1:d63e967f93da |
|
344 | 346 | bookmark: master |
|
345 | 347 | tag: tip |
|
346 | 348 | user: nottest <test@example.org> |
|
347 | 349 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
348 | 350 | files: foo |
|
349 | 351 | description: |
|
350 | 352 | addfoo2 |
|
351 | 353 | |
|
352 | 354 | committer: test <test@example.org> |
|
353 | 355 | |
|
354 | 356 | |
|
355 | 357 | changeset: 0:0735477b0224 |
|
356 | 358 | user: test <test@example.org> |
|
357 | 359 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
358 | 360 | files: foo |
|
359 | 361 | description: |
|
360 | 362 | addfoo |
|
361 | 363 | |
|
362 | 364 | |
|
363 | 365 | |
|
364 | 366 | --sourceorder should fail |
|
365 | 367 | |
|
366 | 368 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg |
|
367 | 369 | initializing destination git-repo4-sourcesort-hg repository |
|
368 | 370 | abort: --sourcesort is not supported by this data source |
|
369 | 371 | [255] |
|
370 | 372 | |
|
371 | 373 | test sub modules |
|
372 | 374 | |
|
373 | 375 | $ mkdir git-repo5 |
|
374 | 376 | $ cd git-repo5 |
|
375 | 377 | $ git init-db >/dev/null 2>/dev/null |
|
376 | 378 | $ echo 'sub' >> foo |
|
377 | 379 | $ git add foo |
|
378 | 380 | $ commit -a -m 'addfoo' |
|
379 | 381 | $ BASE=`pwd` |
|
380 | 382 | $ cd .. |
|
381 | 383 | $ mkdir git-repo6 |
|
382 | 384 | $ cd git-repo6 |
|
383 | 385 | $ git init-db >/dev/null 2>/dev/null |
|
384 | 386 | $ git submodule add ${BASE} >/dev/null 2>/dev/null |
|
385 | 387 | $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null |
|
386 | 388 | $ cd .. |
|
387 | 389 | |
|
388 | 390 | test invalid splicemap1 |
|
389 | 391 | |
|
390 | 392 | $ cat > splicemap <<EOF |
|
391 | 393 | > $VALIDID1 |
|
392 | 394 | > EOF |
|
393 | 395 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg |
|
394 | 396 | initializing destination git-repo2-splicemap1-hg repository |
|
395 | 397 | abort: syntax error in splicemap(1): child parent1[,parent2] expected |
|
396 | 398 | [255] |
|
397 | 399 | |
|
398 | 400 | test invalid splicemap2 |
|
399 | 401 | |
|
400 | 402 | $ cat > splicemap <<EOF |
|
401 | 403 | > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2 |
|
402 | 404 | > EOF |
|
403 | 405 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg |
|
404 | 406 | initializing destination git-repo2-splicemap2-hg repository |
|
405 | 407 | abort: syntax error in splicemap(1): child parent1[,parent2] expected |
|
406 | 408 | [255] |
|
407 | 409 | |
|
408 | 410 | test invalid splicemap3 |
|
409 | 411 | |
|
410 | 412 | $ cat > splicemap <<EOF |
|
411 | 413 | > $INVALIDID1 $INVALIDID2 |
|
412 | 414 | > EOF |
|
413 | 415 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg |
|
414 | 416 | initializing destination git-repo2-splicemap3-hg repository |
|
415 | 417 | abort: splicemap entry afd12345af is not a valid revision identifier |
|
416 | 418 | [255] |
|
417 | 419 | |
|
418 | 420 | convert sub modules |
|
419 | 421 | $ hg convert git-repo6 git-repo6-hg |
|
420 | 422 | initializing destination git-repo6-hg repository |
|
421 | 423 | scanning source... |
|
422 | 424 | sorting... |
|
423 | 425 | converting... |
|
424 | 426 | 0 addsubmodule |
|
425 | 427 | updating bookmarks |
|
426 | 428 | $ hg -R git-repo6-hg log -v |
|
427 | 429 | changeset: 0:* (glob) |
|
428 | 430 | bookmark: master |
|
429 | 431 | tag: tip |
|
430 | 432 | user: nottest <test@example.org> |
|
431 | 433 | date: Mon Jan 01 00:00:23 2007 +0000 |
|
432 | 434 | files: .hgsub .hgsubstate |
|
433 | 435 | description: |
|
434 | 436 | addsubmodule |
|
435 | 437 | |
|
436 | 438 | committer: test <test@example.org> |
|
437 | 439 | |
|
438 | 440 | |
|
439 | 441 | |
|
440 | 442 | $ cd git-repo6-hg |
|
441 | 443 | $ hg up >/dev/null 2>/dev/null |
|
442 | 444 | $ cat .hgsubstate |
|
443 | 445 | * git-repo5 (glob) |
|
444 | 446 | $ cd git-repo5 |
|
445 | 447 | $ cat foo |
|
446 | 448 | sub |
|
447 | 449 | |
|
448 | 450 | $ cd ../.. |
|
449 | 451 | |
|
450 | 452 | make sure rename detection doesn't break removing and adding gitmodules |
|
451 | 453 | |
|
452 | 454 | $ cd git-repo6 |
|
453 | 455 | $ git mv .gitmodules .gitmodules-renamed |
|
454 | 456 | $ commit -a -m 'rename .gitmodules' |
|
455 | 457 | $ git mv .gitmodules-renamed .gitmodules |
|
456 | 458 | $ commit -a -m 'rename .gitmodules back' |
|
457 | 459 | $ cd .. |
|
458 | 460 | |
|
459 | 461 | $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg |
|
460 | 462 | $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n" |
|
461 | 463 | rename .gitmodules |
|
462 | 464 | $ hg -R git-repo6-hg status -C --change 'tip^' |
|
463 | 465 | A .gitmodules-renamed |
|
464 | 466 | R .hgsub |
|
465 | 467 | R .hgsubstate |
|
466 | 468 | $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n" |
|
467 | 469 | rename .gitmodules back |
|
468 | 470 | $ hg -R git-repo6-hg status -C --change tip |
|
469 | 471 | A .hgsub |
|
470 | 472 | A .hgsubstate |
|
471 | 473 | R .gitmodules-renamed |
|
472 | 474 | |
|
473 | 475 | convert the revision removing '.gitmodules' itself (and related |
|
474 | 476 | submodules) |
|
475 | 477 | |
|
476 | 478 | $ cd git-repo6 |
|
477 | 479 | $ git rm .gitmodules |
|
478 | 480 | rm '.gitmodules' |
|
479 | 481 | $ git rm --cached git-repo5 |
|
480 | 482 | rm 'git-repo5' |
|
481 | 483 | $ commit -a -m 'remove .gitmodules and submodule git-repo5' |
|
482 | 484 | $ cd .. |
|
483 | 485 | |
|
484 | 486 | $ hg convert -q git-repo6 git-repo6-hg |
|
485 | 487 | $ hg -R git-repo6-hg tip -T "{desc|firstline}\n" |
|
486 | 488 | remove .gitmodules and submodule git-repo5 |
|
487 | 489 | $ hg -R git-repo6-hg tip -T "{file_dels}\n" |
|
488 | 490 | .hgsub .hgsubstate |
|
489 | 491 | |
|
490 | 492 | damaged git repository tests: |
|
491 | 493 | In case the hard-coded hashes change, the following commands can be used to |
|
492 | 494 | list the hashes and their corresponding types in the repository: |
|
493 | 495 | cd git-repo4/.git/objects |
|
494 | 496 | find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t |
|
495 | 497 | cd ../../.. |
|
496 | 498 | |
|
497 | 499 | damage git repository by renaming a commit object |
|
498 | 500 | $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
|
499 | 501 | $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp |
|
500 | 502 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
501 | 503 | abort: cannot read tags from git-repo4/.git |
|
502 | 504 | $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ |
|
503 | 505 | damage git repository by renaming a blob object |
|
504 | 506 | |
|
505 | 507 | $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc |
|
506 | 508 | $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp |
|
507 | 509 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
508 | 510 | abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc |
|
509 | 511 | $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ |
|
510 | 512 | damage git repository by renaming a tree object |
|
511 | 513 | |
|
512 | 514 | $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635 |
|
513 | 515 | $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp |
|
514 | 516 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
515 | 517 | abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
General Comments 0
You need to be logged in to leave comments.
Login now