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