##// END OF EJS Templates
test-convert-git: drop a git warning that doesn't occur on Windows...
Matt Harbison -
r26970:6d99cc89 default
parent child Browse files
Show More
@@ -1,731 +1,730 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 convert --datesort git-repo2 fullrepo \
173 $ hg convert --datesort git-repo2 fullrepo \
174 > --config extensions.progress= --config progress.assume-tty=1 \
174 > --config extensions.progress= --config progress.assume-tty=1 \
175 > --config progress.delay=0 --config progress.changedelay=0 \
175 > --config progress.delay=0 --config progress.changedelay=0 \
176 > --config progress.refresh=0 --config progress.width=60
176 > --config progress.refresh=0 --config progress.width=60
177 \r (no-eol) (esc)
177 \r (no-eol) (esc)
178 scanning [===> ] 1/9\r (no-eol) (esc)
178 scanning [===> ] 1/9\r (no-eol) (esc)
179 scanning [========> ] 2/9\r (no-eol) (esc)
179 scanning [========> ] 2/9\r (no-eol) (esc)
180 scanning [=============> ] 3/9\r (no-eol) (esc)
180 scanning [=============> ] 3/9\r (no-eol) (esc)
181 scanning [==================> ] 4/9\r (no-eol) (esc)
181 scanning [==================> ] 4/9\r (no-eol) (esc)
182 scanning [=======================> ] 5/9\r (no-eol) (esc)
182 scanning [=======================> ] 5/9\r (no-eol) (esc)
183 scanning [============================> ] 6/9\r (no-eol) (esc)
183 scanning [============================> ] 6/9\r (no-eol) (esc)
184 scanning [=================================> ] 7/9\r (no-eol) (esc)
184 scanning [=================================> ] 7/9\r (no-eol) (esc)
185 scanning [======================================> ] 8/9\r (no-eol) (esc)
185 scanning [======================================> ] 8/9\r (no-eol) (esc)
186 scanning [===========================================>] 9/9\r (no-eol) (esc)
186 scanning [===========================================>] 9/9\r (no-eol) (esc)
187 \r (no-eol) (esc)
187 \r (no-eol) (esc)
188 \r (no-eol) (esc)
188 \r (no-eol) (esc)
189 converting [ ] 0/9\r (no-eol) (esc)
189 converting [ ] 0/9\r (no-eol) (esc)
190 getting files [======================================>] 1/1\r (no-eol) (esc)
190 getting files [======================================>] 1/1\r (no-eol) (esc)
191 \r (no-eol) (esc)
191 \r (no-eol) (esc)
192 \r (no-eol) (esc)
192 \r (no-eol) (esc)
193 converting [===> ] 1/9\r (no-eol) (esc)
193 converting [===> ] 1/9\r (no-eol) (esc)
194 getting files [======================================>] 1/1\r (no-eol) (esc)
194 getting files [======================================>] 1/1\r (no-eol) (esc)
195 \r (no-eol) (esc)
195 \r (no-eol) (esc)
196 \r (no-eol) (esc)
196 \r (no-eol) (esc)
197 converting [========> ] 2/9\r (no-eol) (esc)
197 converting [========> ] 2/9\r (no-eol) (esc)
198 getting files [======================================>] 1/1\r (no-eol) (esc)
198 getting files [======================================>] 1/1\r (no-eol) (esc)
199 \r (no-eol) (esc)
199 \r (no-eol) (esc)
200 \r (no-eol) (esc)
200 \r (no-eol) (esc)
201 converting [=============> ] 3/9\r (no-eol) (esc)
201 converting [=============> ] 3/9\r (no-eol) (esc)
202 getting files [======================================>] 1/1\r (no-eol) (esc)
202 getting files [======================================>] 1/1\r (no-eol) (esc)
203 \r (no-eol) (esc)
203 \r (no-eol) (esc)
204 \r (no-eol) (esc)
204 \r (no-eol) (esc)
205 converting [=================> ] 4/9\r (no-eol) (esc)
205 converting [=================> ] 4/9\r (no-eol) (esc)
206 getting files [======================================>] 1/1\r (no-eol) (esc)
206 getting files [======================================>] 1/1\r (no-eol) (esc)
207 \r (no-eol) (esc)
207 \r (no-eol) (esc)
208 \r (no-eol) (esc)
208 \r (no-eol) (esc)
209 converting [======================> ] 5/9\r (no-eol) (esc)
209 converting [======================> ] 5/9\r (no-eol) (esc)
210 getting files [===> ] 1/8\r (no-eol) (esc)
210 getting files [===> ] 1/8\r (no-eol) (esc)
211 getting files [========> ] 2/8\r (no-eol) (esc)
211 getting files [========> ] 2/8\r (no-eol) (esc)
212 getting files [=============> ] 3/8\r (no-eol) (esc)
212 getting files [=============> ] 3/8\r (no-eol) (esc)
213 getting files [==================> ] 4/8\r (no-eol) (esc)
213 getting files [==================> ] 4/8\r (no-eol) (esc)
214 getting files [=======================> ] 5/8\r (no-eol) (esc)
214 getting files [=======================> ] 5/8\r (no-eol) (esc)
215 getting files [============================> ] 6/8\r (no-eol) (esc)
215 getting files [============================> ] 6/8\r (no-eol) (esc)
216 getting files [=================================> ] 7/8\r (no-eol) (esc)
216 getting files [=================================> ] 7/8\r (no-eol) (esc)
217 getting files [======================================>] 8/8\r (no-eol) (esc)
217 getting files [======================================>] 8/8\r (no-eol) (esc)
218 \r (no-eol) (esc)
218 \r (no-eol) (esc)
219 \r (no-eol) (esc)
219 \r (no-eol) (esc)
220 converting [===========================> ] 6/9\r (no-eol) (esc)
220 converting [===========================> ] 6/9\r (no-eol) (esc)
221 getting files [======================================>] 1/1\r (no-eol) (esc)
221 getting files [======================================>] 1/1\r (no-eol) (esc)
222 \r (no-eol) (esc)
222 \r (no-eol) (esc)
223 \r (no-eol) (esc)
223 \r (no-eol) (esc)
224 converting [===============================> ] 7/9\r (no-eol) (esc)
224 converting [===============================> ] 7/9\r (no-eol) (esc)
225 getting files [======================================>] 1/1\r (no-eol) (esc)
225 getting files [======================================>] 1/1\r (no-eol) (esc)
226 \r (no-eol) (esc)
226 \r (no-eol) (esc)
227 \r (no-eol) (esc)
227 \r (no-eol) (esc)
228 converting [====================================> ] 8/9\r (no-eol) (esc)
228 converting [====================================> ] 8/9\r (no-eol) (esc)
229 getting files [==================> ] 1/2\r (no-eol) (esc)
229 getting files [==================> ] 1/2\r (no-eol) (esc)
230 getting files [======================================>] 2/2\r (no-eol) (esc)
230 getting files [======================================>] 2/2\r (no-eol) (esc)
231 \r (no-eol) (esc)
231 \r (no-eol) (esc)
232 initializing destination fullrepo repository
232 initializing destination fullrepo repository
233 scanning source...
233 scanning source...
234 sorting...
234 sorting...
235 converting...
235 converting...
236 8 add foo
236 8 add foo
237 7 change foo
237 7 change foo
238 6 add quux
238 6 add quux
239 5 add bar
239 5 add bar
240 4 add baz
240 4 add baz
241 3 Octopus merge
241 3 Octopus merge
242 2 change bar
242 2 change bar
243 1 change foo
243 1 change foo
244 0 Discard change to foo
244 0 Discard change to foo
245 updating bookmarks
245 updating bookmarks
246 $ hg up -q -R fullrepo
246 $ hg up -q -R fullrepo
247 $ glog -R fullrepo
247 $ glog -R fullrepo
248 @ 9 "Discard change to foo" files: foo
248 @ 9 "Discard change to foo" files: foo
249 |\
249 |\
250 | o 8 "change foo" files: foo
250 | o 8 "change foo" files: foo
251 | |
251 | |
252 o | 7 "change bar" files: bar
252 o | 7 "change bar" files: bar
253 |/
253 |/
254 o 6 "(octopus merge fixup)" files:
254 o 6 "(octopus merge fixup)" files:
255 |\
255 |\
256 | o 5 "Octopus merge" files: baz
256 | o 5 "Octopus merge" files: baz
257 | |\
257 | |\
258 o | | 4 "add baz" files: baz
258 o | | 4 "add baz" files: baz
259 | | |
259 | | |
260 +---o 3 "add bar" files: bar
260 +---o 3 "add bar" files: bar
261 | |
261 | |
262 o | 2 "add quux" files: quux
262 o | 2 "add quux" files: quux
263 | |
263 | |
264 | o 1 "change foo" files: foo
264 | o 1 "change foo" files: foo
265 |/
265 |/
266 o 0 "add foo" files: foo
266 o 0 "add foo" files: foo
267
267
268 $ hg -R fullrepo manifest --debug
268 $ hg -R fullrepo manifest --debug
269 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
269 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
270 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
270 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
271 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
271 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
272 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
272 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
273 $ splitrepo 'octopus merge' 'foo bar baz'
273 $ splitrepo 'octopus merge' 'foo bar baz'
274 % foo bar baz: octopus merge
274 % foo bar baz: octopus merge
275 @ 8 "Discard change to foo" files: foo
275 @ 8 "Discard change to foo" files: foo
276 |\
276 |\
277 | o 7 "change foo" files: foo
277 | o 7 "change foo" files: foo
278 | |
278 | |
279 o | 6 "change bar" files: bar
279 o | 6 "change bar" files: bar
280 |/
280 |/
281 o 5 "(octopus merge fixup)" files:
281 o 5 "(octopus merge fixup)" files:
282 |\
282 |\
283 | o 4 "Octopus merge" files: baz
283 | o 4 "Octopus merge" files: baz
284 | |\
284 | |\
285 o | | 3 "add baz" files: baz
285 o | | 3 "add baz" files: baz
286 | | |
286 | | |
287 +---o 2 "add bar" files: bar
287 +---o 2 "add bar" files: bar
288 | |
288 | |
289 | o 1 "change foo" files: foo
289 | o 1 "change foo" files: foo
290 |/
290 |/
291 o 0 "add foo" files: foo
291 o 0 "add foo" files: foo
292
292
293 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
293 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
294 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
294 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
295 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
295 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
296 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
296 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
297 % foo baz quux: only some parents of an octopus merge; "discard" a head
297 % foo baz quux: only some parents of an octopus merge; "discard" a head
298 @ 6 "Discard change to foo" files: foo
298 @ 6 "Discard change to foo" files: foo
299 |
299 |
300 o 5 "change foo" files: foo
300 o 5 "change foo" files: foo
301 |
301 |
302 o 4 "Octopus merge" files:
302 o 4 "Octopus merge" files:
303 |\
303 |\
304 | o 3 "add baz" files: baz
304 | o 3 "add baz" files: baz
305 | |
305 | |
306 | o 2 "add quux" files: quux
306 | o 2 "add quux" files: quux
307 | |
307 | |
308 o | 1 "change foo" files: foo
308 o | 1 "change foo" files: foo
309 |/
309 |/
310 o 0 "add foo" files: foo
310 o 0 "add foo" files: foo
311
311
312 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
312 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
313 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
313 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
314 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
314 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
315
315
316 test importing git renames and copies
316 test importing git renames and copies
317
317
318 $ cd git-repo2
318 $ cd git-repo2
319 $ git mv foo foo-renamed
319 $ git mv foo foo-renamed
320 since bar is not touched in this commit, this copy will not be detected
320 since bar is not touched in this commit, this copy will not be detected
321 $ cp bar bar-copied
321 $ cp bar bar-copied
322 $ cp baz baz-copied
322 $ cp baz baz-copied
323 $ cp baz baz-copied2
323 $ cp baz baz-copied2
324 $ cp baz ba-copy
324 $ cp baz ba-copy
325 $ echo baz2 >> baz
325 $ echo baz2 >> baz
326 $ git add bar-copied baz-copied baz-copied2 ba-copy
326 $ git add bar-copied baz-copied baz-copied2 ba-copy
327 $ commit -a -m 'rename and copy'
327 $ commit -a -m 'rename and copy'
328 $ cd ..
328 $ cd ..
329
329
330 input validation
330 input validation
331 $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
331 $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
332 abort: convert.git.similarity is not an integer ('foo')
332 abort: convert.git.similarity is not an integer ('foo')
333 [255]
333 [255]
334 $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
334 $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
335 abort: similarity must be between 0 and 100
335 abort: similarity must be between 0 and 100
336 [255]
336 [255]
337 $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
337 $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
338 abort: similarity must be between 0 and 100
338 abort: similarity must be between 0 and 100
339 [255]
339 [255]
340
340
341 $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
341 $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
342 $ hg -R fullrepo status -C --change master
342 $ hg -R fullrepo status -C --change master
343 M baz
343 M baz
344 A ba-copy
344 A ba-copy
345 baz
345 baz
346 A bar-copied
346 A bar-copied
347 A baz-copied
347 A baz-copied
348 baz
348 baz
349 A baz-copied2
349 A baz-copied2
350 baz
350 baz
351 A foo-renamed
351 A foo-renamed
352 foo
352 foo
353 R foo
353 R foo
354
354
355 Ensure that the modification to the copy source was preserved
355 Ensure that the modification to the copy source was preserved
356 (there was a bug where if the copy dest was alphabetically prior to the copy
356 (there was a bug where if the copy dest was alphabetically prior to the copy
357 source, the copy source took the contents of the copy dest)
357 source, the copy source took the contents of the copy dest)
358 $ hg cat -r tip fullrepo/baz
358 $ hg cat -r tip fullrepo/baz
359 baz
359 baz
360 baz2
360 baz2
361
361
362 $ cd git-repo2
362 $ cd git-repo2
363 $ echo bar2 >> bar
363 $ echo bar2 >> bar
364 $ commit -a -m 'change bar'
364 $ commit -a -m 'change bar'
365 $ cp bar bar-copied2
365 $ cp bar bar-copied2
366 $ git add bar-copied2
366 $ git add bar-copied2
367 $ commit -a -m 'copy with no changes'
367 $ commit -a -m 'copy with no changes'
368 $ cd ..
368 $ cd ..
369
369
370 $ hg -q convert --config convert.git.similarity=100 \
370 $ hg -q convert --config convert.git.similarity=100 \
371 > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
371 > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
372 $ hg -R fullrepo status -C --change master
372 $ hg -R fullrepo status -C --change master
373 A bar-copied2
373 A bar-copied2
374 bar
374 bar
375
375
376 test binary conversion (issue1359)
376 test binary conversion (issue1359)
377
377
378 $ count=19
378 $ count=19
379 $ mkdir git-repo3
379 $ mkdir git-repo3
380 $ cd git-repo3
380 $ cd git-repo3
381 $ git init-db >/dev/null 2>/dev/null
381 $ git init-db >/dev/null 2>/dev/null
382 $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
382 $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
383 $ git add b
383 $ git add b
384 $ commit -a -m addbinary
384 $ commit -a -m addbinary
385 $ cd ..
385 $ cd ..
386
386
387 convert binary file
387 convert binary file
388
388
389 $ hg convert git-repo3 git-repo3-hg
389 $ hg convert git-repo3 git-repo3-hg
390 initializing destination git-repo3-hg repository
390 initializing destination git-repo3-hg repository
391 scanning source...
391 scanning source...
392 sorting...
392 sorting...
393 converting...
393 converting...
394 0 addbinary
394 0 addbinary
395 updating bookmarks
395 updating bookmarks
396 $ cd git-repo3-hg
396 $ cd git-repo3-hg
397 $ hg up -C
397 $ hg up -C
398 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
398 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
399 $ $PYTHON -c 'print len(file("b", "rb").read())'
399 $ $PYTHON -c 'print len(file("b", "rb").read())'
400 4096
400 4096
401 $ cd ..
401 $ cd ..
402
402
403 test author vs committer
403 test author vs committer
404
404
405 $ mkdir git-repo4
405 $ mkdir git-repo4
406 $ cd git-repo4
406 $ cd git-repo4
407 $ git init-db >/dev/null 2>/dev/null
407 $ git init-db >/dev/null 2>/dev/null
408 $ echo >> foo
408 $ echo >> foo
409 $ git add foo
409 $ git add foo
410 $ commit -a -m addfoo
410 $ commit -a -m addfoo
411 $ echo >> foo
411 $ echo >> foo
412 $ GIT_AUTHOR_NAME="nottest"
412 $ GIT_AUTHOR_NAME="nottest"
413 $ commit -a -m addfoo2
413 $ commit -a -m addfoo2
414 $ cd ..
414 $ cd ..
415
415
416 convert author committer
416 convert author committer
417
417
418 $ hg convert git-repo4 git-repo4-hg
418 $ hg convert git-repo4 git-repo4-hg
419 initializing destination git-repo4-hg repository
419 initializing destination git-repo4-hg repository
420 scanning source...
420 scanning source...
421 sorting...
421 sorting...
422 converting...
422 converting...
423 1 addfoo
423 1 addfoo
424 0 addfoo2
424 0 addfoo2
425 updating bookmarks
425 updating bookmarks
426 $ hg -R git-repo4-hg log -v
426 $ hg -R git-repo4-hg log -v
427 changeset: 1:d63e967f93da
427 changeset: 1:d63e967f93da
428 bookmark: master
428 bookmark: master
429 tag: tip
429 tag: tip
430 user: nottest <test@example.org>
430 user: nottest <test@example.org>
431 date: Mon Jan 01 00:00:21 2007 +0000
431 date: Mon Jan 01 00:00:21 2007 +0000
432 files: foo
432 files: foo
433 description:
433 description:
434 addfoo2
434 addfoo2
435
435
436 committer: test <test@example.org>
436 committer: test <test@example.org>
437
437
438
438
439 changeset: 0:0735477b0224
439 changeset: 0:0735477b0224
440 user: test <test@example.org>
440 user: test <test@example.org>
441 date: Mon Jan 01 00:00:20 2007 +0000
441 date: Mon Jan 01 00:00:20 2007 +0000
442 files: foo
442 files: foo
443 description:
443 description:
444 addfoo
444 addfoo
445
445
446
446
447
447
448 --sourceorder should fail
448 --sourceorder should fail
449
449
450 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
450 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
451 initializing destination git-repo4-sourcesort-hg repository
451 initializing destination git-repo4-sourcesort-hg repository
452 abort: --sourcesort is not supported by this data source
452 abort: --sourcesort is not supported by this data source
453 [255]
453 [255]
454
454
455 test converting certain branches
455 test converting certain branches
456
456
457 $ mkdir git-testrevs
457 $ mkdir git-testrevs
458 $ cd git-testrevs
458 $ cd git-testrevs
459 $ git init
459 $ git init
460 Initialized empty Git repository in $TESTTMP/git-testrevs/.git/
460 Initialized empty Git repository in $TESTTMP/git-testrevs/.git/
461 $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null
461 $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null
462 $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null
462 $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null
463 $ git checkout -b goodbranch 'HEAD^'
463 $ git checkout -b goodbranch 'HEAD^'
464 Switched to a new branch 'goodbranch'
464 Switched to a new branch 'goodbranch'
465 $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null
465 $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null
466 $ git checkout -b badbranch 'HEAD^'
466 $ git checkout -b badbranch 'HEAD^'
467 Switched to a new branch 'badbranch'
467 Switched to a new branch 'badbranch'
468 $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null
468 $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null
469 $ cd ..
469 $ cd ..
470 $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch
470 $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch
471 initializing destination hg-testrevs repository
471 initializing destination hg-testrevs repository
472 scanning source...
472 scanning source...
473 sorting...
473 sorting...
474 converting...
474 converting...
475 2 first
475 2 first
476 1 good branch commit
476 1 good branch commit
477 0 master commit
477 0 master commit
478 updating bookmarks
478 updating bookmarks
479 $ cd hg-testrevs
479 $ cd hg-testrevs
480 $ hg log -G -T '{rev} {bookmarks}'
480 $ hg log -G -T '{rev} {bookmarks}'
481 o 2 master
481 o 2 master
482 |
482 |
483 | o 1 goodbranch
483 | o 1 goodbranch
484 |/
484 |/
485 o 0
485 o 0
486
486
487 $ cd ..
487 $ cd ..
488
488
489 test sub modules
489 test sub modules
490
490
491 $ mkdir git-repo5
491 $ mkdir git-repo5
492 $ cd git-repo5
492 $ cd git-repo5
493 $ git init-db >/dev/null 2>/dev/null
493 $ git init-db >/dev/null 2>/dev/null
494 $ echo 'sub' >> foo
494 $ echo 'sub' >> foo
495 $ git add foo
495 $ git add foo
496 $ commit -a -m 'addfoo'
496 $ commit -a -m 'addfoo'
497 $ BASE=`pwd`
497 $ BASE=`pwd`
498 $ cd ..
498 $ cd ..
499 $ mkdir git-repo6
499 $ mkdir git-repo6
500 $ cd git-repo6
500 $ cd git-repo6
501 $ git init-db >/dev/null 2>/dev/null
501 $ git init-db >/dev/null 2>/dev/null
502 $ git submodule add ${BASE} >/dev/null 2>/dev/null
502 $ git submodule add ${BASE} >/dev/null 2>/dev/null
503 $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
503 $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
504
504
505 test non-tab whitespace .gitmodules
505 test non-tab whitespace .gitmodules
506
506
507 $ cat >> .gitmodules <<EOF
507 $ cat >> .gitmodules <<EOF
508 > [submodule "git-repo5"]
508 > [submodule "git-repo5"]
509 > path = git-repo5
509 > path = git-repo5
510 > url = git-repo5
510 > url = git-repo5
511 > EOF
511 > EOF
512 $ git commit -q -a -m "weird white space submodule"
512 $ git commit -q -a -m "weird white space submodule"
513 $ cd ..
513 $ cd ..
514 $ hg convert git-repo6 hg-repo6
514 $ hg convert git-repo6 hg-repo6
515 initializing destination hg-repo6 repository
515 initializing destination hg-repo6 repository
516 scanning source...
516 scanning source...
517 sorting...
517 sorting...
518 converting...
518 converting...
519 1 addsubmodule
519 1 addsubmodule
520 0 weird white space submodule
520 0 weird white space submodule
521 updating bookmarks
521 updating bookmarks
522
522
523 $ rm -rf hg-repo6
523 $ rm -rf hg-repo6
524 $ cd git-repo6
524 $ cd git-repo6
525 $ git reset --hard 'HEAD^' > /dev/null
525 $ git reset --hard 'HEAD^' > /dev/null
526
526
527 test missing .gitmodules
527 test missing .gitmodules
528
528
529 $ git submodule add ../git-repo4 >/dev/null 2>/dev/null
529 $ git submodule add ../git-repo4 >/dev/null 2>/dev/null
530 $ git checkout HEAD .gitmodules
530 $ git checkout HEAD .gitmodules
531 $ git rm .gitmodules
531 $ git rm .gitmodules
532 rm '.gitmodules'
532 rm '.gitmodules'
533 $ git commit -q -m "remove .gitmodules" .gitmodules
533 $ git commit -q -m "remove .gitmodules" .gitmodules
534 $ git commit -q -m "missing .gitmodules"
534 $ git commit -q -m "missing .gitmodules"
535 $ cd ..
535 $ cd ..
536 $ hg convert git-repo6 hg-repo6 --traceback
536 $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist"
537 fatal: Path '.gitmodules' does not exist in '*' (glob)
538 initializing destination hg-repo6 repository
537 initializing destination hg-repo6 repository
539 scanning source...
538 scanning source...
540 sorting...
539 sorting...
541 converting...
540 converting...
542 2 addsubmodule
541 2 addsubmodule
543 1 remove .gitmodules
542 1 remove .gitmodules
544 0 missing .gitmodules
543 0 missing .gitmodules
545 warning: cannot read submodules config file in * (glob)
544 warning: cannot read submodules config file in * (glob)
546 updating bookmarks
545 updating bookmarks
547 $ rm -rf hg-repo6
546 $ rm -rf hg-repo6
548 $ cd git-repo6
547 $ cd git-repo6
549 $ rm -rf git-repo4
548 $ rm -rf git-repo4
550 $ git reset --hard 'HEAD^^' > /dev/null
549 $ git reset --hard 'HEAD^^' > /dev/null
551 $ cd ..
550 $ cd ..
552
551
553 test invalid splicemap1
552 test invalid splicemap1
554
553
555 $ cat > splicemap <<EOF
554 $ cat > splicemap <<EOF
556 > $VALIDID1
555 > $VALIDID1
557 > EOF
556 > EOF
558 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
557 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
559 initializing destination git-repo2-splicemap1-hg repository
558 initializing destination git-repo2-splicemap1-hg repository
560 abort: syntax error in splicemap(1): child parent1[,parent2] expected
559 abort: syntax error in splicemap(1): child parent1[,parent2] expected
561 [255]
560 [255]
562
561
563 test invalid splicemap2
562 test invalid splicemap2
564
563
565 $ cat > splicemap <<EOF
564 $ cat > splicemap <<EOF
566 > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
565 > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
567 > EOF
566 > EOF
568 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
567 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
569 initializing destination git-repo2-splicemap2-hg repository
568 initializing destination git-repo2-splicemap2-hg repository
570 abort: syntax error in splicemap(1): child parent1[,parent2] expected
569 abort: syntax error in splicemap(1): child parent1[,parent2] expected
571 [255]
570 [255]
572
571
573 test invalid splicemap3
572 test invalid splicemap3
574
573
575 $ cat > splicemap <<EOF
574 $ cat > splicemap <<EOF
576 > $INVALIDID1 $INVALIDID2
575 > $INVALIDID1 $INVALIDID2
577 > EOF
576 > EOF
578 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
577 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
579 initializing destination git-repo2-splicemap3-hg repository
578 initializing destination git-repo2-splicemap3-hg repository
580 abort: splicemap entry afd12345af is not a valid revision identifier
579 abort: splicemap entry afd12345af is not a valid revision identifier
581 [255]
580 [255]
582
581
583 convert sub modules
582 convert sub modules
584 $ hg convert git-repo6 git-repo6-hg
583 $ hg convert git-repo6 git-repo6-hg
585 initializing destination git-repo6-hg repository
584 initializing destination git-repo6-hg repository
586 scanning source...
585 scanning source...
587 sorting...
586 sorting...
588 converting...
587 converting...
589 0 addsubmodule
588 0 addsubmodule
590 updating bookmarks
589 updating bookmarks
591 $ hg -R git-repo6-hg log -v
590 $ hg -R git-repo6-hg log -v
592 changeset: 0:* (glob)
591 changeset: 0:* (glob)
593 bookmark: master
592 bookmark: master
594 tag: tip
593 tag: tip
595 user: nottest <test@example.org>
594 user: nottest <test@example.org>
596 date: Mon Jan 01 00:00:23 2007 +0000
595 date: Mon Jan 01 00:00:23 2007 +0000
597 files: .hgsub .hgsubstate
596 files: .hgsub .hgsubstate
598 description:
597 description:
599 addsubmodule
598 addsubmodule
600
599
601 committer: test <test@example.org>
600 committer: test <test@example.org>
602
601
603
602
604
603
605 $ cd git-repo6-hg
604 $ cd git-repo6-hg
606 $ hg up >/dev/null 2>/dev/null
605 $ hg up >/dev/null 2>/dev/null
607 $ cat .hgsubstate
606 $ cat .hgsubstate
608 * git-repo5 (glob)
607 * git-repo5 (glob)
609 $ cd git-repo5
608 $ cd git-repo5
610 $ cat foo
609 $ cat foo
611 sub
610 sub
612
611
613 $ cd ../..
612 $ cd ../..
614
613
615 make sure rename detection doesn't break removing and adding gitmodules
614 make sure rename detection doesn't break removing and adding gitmodules
616
615
617 $ cd git-repo6
616 $ cd git-repo6
618 $ git mv .gitmodules .gitmodules-renamed
617 $ git mv .gitmodules .gitmodules-renamed
619 $ commit -a -m 'rename .gitmodules'
618 $ commit -a -m 'rename .gitmodules'
620 $ git mv .gitmodules-renamed .gitmodules
619 $ git mv .gitmodules-renamed .gitmodules
621 $ commit -a -m 'rename .gitmodules back'
620 $ commit -a -m 'rename .gitmodules back'
622 $ cd ..
621 $ cd ..
623
622
624 $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
623 $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
625 $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
624 $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
626 rename .gitmodules
625 rename .gitmodules
627 $ hg -R git-repo6-hg status -C --change 'tip^'
626 $ hg -R git-repo6-hg status -C --change 'tip^'
628 A .gitmodules-renamed
627 A .gitmodules-renamed
629 R .hgsub
628 R .hgsub
630 R .hgsubstate
629 R .hgsubstate
631 $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
630 $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
632 rename .gitmodules back
631 rename .gitmodules back
633 $ hg -R git-repo6-hg status -C --change tip
632 $ hg -R git-repo6-hg status -C --change tip
634 A .hgsub
633 A .hgsub
635 A .hgsubstate
634 A .hgsubstate
636 R .gitmodules-renamed
635 R .gitmodules-renamed
637
636
638 convert the revision removing '.gitmodules' itself (and related
637 convert the revision removing '.gitmodules' itself (and related
639 submodules)
638 submodules)
640
639
641 $ cd git-repo6
640 $ cd git-repo6
642 $ git rm .gitmodules
641 $ git rm .gitmodules
643 rm '.gitmodules'
642 rm '.gitmodules'
644 $ git rm --cached git-repo5
643 $ git rm --cached git-repo5
645 rm 'git-repo5'
644 rm 'git-repo5'
646 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
645 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
647 $ cd ..
646 $ cd ..
648
647
649 $ hg convert -q git-repo6 git-repo6-hg
648 $ hg convert -q git-repo6 git-repo6-hg
650 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
649 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
651 remove .gitmodules and submodule git-repo5
650 remove .gitmodules and submodule git-repo5
652 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
651 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
653 .hgsub .hgsubstate
652 .hgsub .hgsubstate
654
653
655 skip submodules in the conversion
654 skip submodules in the conversion
656
655
657 $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True
656 $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True
658 $ hg -R no-submodules manifest --all
657 $ hg -R no-submodules manifest --all
659 .gitmodules-renamed
658 .gitmodules-renamed
660
659
661 convert using a different remote prefix
660 convert using a different remote prefix
662 $ git init git-repo7
661 $ git init git-repo7
663 Initialized empty Git repository in $TESTTMP/git-repo7/.git/
662 Initialized empty Git repository in $TESTTMP/git-repo7/.git/
664 $ cd git-repo7
663 $ cd git-repo7
665 TODO: it'd be nice to use (?) lines instead of grep -v to handle the
664 TODO: it'd be nice to use (?) lines instead of grep -v to handle the
666 git output variance, but that doesn't currently work in the middle of
665 git output variance, but that doesn't currently work in the middle of
667 a block, so do this for now.
666 a block, so do this for now.
668 $ touch a && git add a && git commit -am "commit a" | grep -v changed
667 $ touch a && git add a && git commit -am "commit a" | grep -v changed
669 [master (root-commit) 8ae5f69] commit a
668 [master (root-commit) 8ae5f69] commit a
670 Author: nottest <test@example.org>
669 Author: nottest <test@example.org>
671 create mode 100644 a
670 create mode 100644 a
672 $ cd ..
671 $ cd ..
673 $ git clone git-repo7 git-repo7-client
672 $ git clone git-repo7 git-repo7-client
674 Cloning into 'git-repo7-client'...
673 Cloning into 'git-repo7-client'...
675 done.
674 done.
676 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
675 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
677 initializing destination hg-repo7 repository
676 initializing destination hg-repo7 repository
678 scanning source...
677 scanning source...
679 sorting...
678 sorting...
680 converting...
679 converting...
681 0 commit a
680 0 commit a
682 updating bookmarks
681 updating bookmarks
683 $ hg -R hg-repo7 bookmarks
682 $ hg -R hg-repo7 bookmarks
684 master 0:03bf38caa4c6
683 master 0:03bf38caa4c6
685 origin/master 0:03bf38caa4c6
684 origin/master 0:03bf38caa4c6
686
685
687 Run convert when the remote branches have changed
686 Run convert when the remote branches have changed
688 (there was an old bug where the local convert read branches from the server)
687 (there was an old bug where the local convert read branches from the server)
689
688
690 $ cd git-repo7
689 $ cd git-repo7
691 $ echo a >> a
690 $ echo a >> a
692 $ git commit -q -am "move master forward"
691 $ git commit -q -am "move master forward"
693 $ cd ..
692 $ cd ..
694 $ rm -rf hg-repo7
693 $ rm -rf hg-repo7
695 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
694 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
696 initializing destination hg-repo7 repository
695 initializing destination hg-repo7 repository
697 scanning source...
696 scanning source...
698 sorting...
697 sorting...
699 converting...
698 converting...
700 0 commit a
699 0 commit a
701 updating bookmarks
700 updating bookmarks
702 $ hg -R hg-repo7 bookmarks
701 $ hg -R hg-repo7 bookmarks
703 master 0:03bf38caa4c6
702 master 0:03bf38caa4c6
704 origin/master 0:03bf38caa4c6
703 origin/master 0:03bf38caa4c6
705
704
706 damaged git repository tests:
705 damaged git repository tests:
707 In case the hard-coded hashes change, the following commands can be used to
706 In case the hard-coded hashes change, the following commands can be used to
708 list the hashes and their corresponding types in the repository:
707 list the hashes and their corresponding types in the repository:
709 cd git-repo4/.git/objects
708 cd git-repo4/.git/objects
710 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
709 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
711 cd ../../..
710 cd ../../..
712
711
713 damage git repository by renaming a commit object
712 damage git repository by renaming a commit object
714 $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
713 $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
715 $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
714 $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
716 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
715 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
717 abort: cannot read tags from git-repo4/.git
716 abort: cannot read tags from git-repo4/.git
718 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
717 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
719 damage git repository by renaming a blob object
718 damage git repository by renaming a blob object
720
719
721 $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
720 $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
722 $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
721 $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
723 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
722 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
724 abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
723 abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
725 $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
724 $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
726 damage git repository by renaming a tree object
725 damage git repository by renaming a tree object
727
726
728 $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
727 $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
729 $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
728 $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
730 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
729 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
731 abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
730 abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
General Comments 0
You need to be logged in to leave comments. Login now