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