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