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