##// END OF EJS Templates
tests-subrepo-git: make the "pwned" message output in a stable order...
Danek Duvall -
r29256:1f8b861b stable
parent child Browse files
Show More
@@ -1,1167 +1,1171 b''
1 #require git
1 #require git
2
2
3 make git commits repeatable
3 make git commits repeatable
4
4
5 $ echo "[core]" >> $HOME/.gitconfig
5 $ echo "[core]" >> $HOME/.gitconfig
6 $ echo "autocrlf = false" >> $HOME/.gitconfig
6 $ echo "autocrlf = false" >> $HOME/.gitconfig
7 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
7 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
8 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
8 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
9 $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE
9 $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE
10 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
10 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
11 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
11 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
12 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
12 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
13 $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM
13 $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM
14
14
15 root hg repo
15 root hg repo
16
16
17 $ hg init t
17 $ hg init t
18 $ cd t
18 $ cd t
19 $ echo a > a
19 $ echo a > a
20 $ hg add a
20 $ hg add a
21 $ hg commit -m a
21 $ hg commit -m a
22 $ cd ..
22 $ cd ..
23
23
24 new external git repo
24 new external git repo
25
25
26 $ mkdir gitroot
26 $ mkdir gitroot
27 $ cd gitroot
27 $ cd gitroot
28 $ git init -q
28 $ git init -q
29 $ echo g > g
29 $ echo g > g
30 $ git add g
30 $ git add g
31 $ git commit -q -m g
31 $ git commit -q -m g
32
32
33 add subrepo clone
33 add subrepo clone
34
34
35 $ cd ../t
35 $ cd ../t
36 $ echo 's = [git]../gitroot' > .hgsub
36 $ echo 's = [git]../gitroot' > .hgsub
37 $ git clone -q ../gitroot s
37 $ git clone -q ../gitroot s
38 $ hg add .hgsub
38 $ hg add .hgsub
39 $ hg commit -m 'new git subrepo'
39 $ hg commit -m 'new git subrepo'
40 $ hg debugsub
40 $ hg debugsub
41 path s
41 path s
42 source ../gitroot
42 source ../gitroot
43 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
43 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
44
44
45 record a new commit from upstream from a different branch
45 record a new commit from upstream from a different branch
46
46
47 $ cd ../gitroot
47 $ cd ../gitroot
48 $ git checkout -q -b testing
48 $ git checkout -q -b testing
49 $ echo gg >> g
49 $ echo gg >> g
50 $ git commit -q -a -m gg
50 $ git commit -q -a -m gg
51
51
52 $ cd ../t/s
52 $ cd ../t/s
53 $ git pull -q >/dev/null 2>/dev/null
53 $ git pull -q >/dev/null 2>/dev/null
54 $ git checkout -q -b testing origin/testing >/dev/null
54 $ git checkout -q -b testing origin/testing >/dev/null
55
55
56 $ cd ..
56 $ cd ..
57 $ hg status --subrepos
57 $ hg status --subrepos
58 M s/g
58 M s/g
59 $ hg commit -m 'update git subrepo'
59 $ hg commit -m 'update git subrepo'
60 $ hg debugsub
60 $ hg debugsub
61 path s
61 path s
62 source ../gitroot
62 source ../gitroot
63 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
63 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
64
64
65 make $GITROOT pushable, by replacing it with a clone with nothing checked out
65 make $GITROOT pushable, by replacing it with a clone with nothing checked out
66
66
67 $ cd ..
67 $ cd ..
68 $ git clone gitroot gitrootbare --bare -q
68 $ git clone gitroot gitrootbare --bare -q
69 $ rm -rf gitroot
69 $ rm -rf gitroot
70 $ mv gitrootbare gitroot
70 $ mv gitrootbare gitroot
71
71
72 clone root
72 clone root
73
73
74 $ cd t
74 $ cd t
75 $ hg clone . ../tc 2> /dev/null
75 $ hg clone . ../tc 2> /dev/null
76 updating to branch default
76 updating to branch default
77 cloning subrepo s from $TESTTMP/gitroot
77 cloning subrepo s from $TESTTMP/gitroot
78 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 $ cd ../tc
79 $ cd ../tc
80 $ hg debugsub
80 $ hg debugsub
81 path s
81 path s
82 source ../gitroot
82 source ../gitroot
83 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
83 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
84
84
85 update to previous substate
85 update to previous substate
86
86
87 $ hg update 1 -q
87 $ hg update 1 -q
88 $ cat s/g
88 $ cat s/g
89 g
89 g
90 $ hg debugsub
90 $ hg debugsub
91 path s
91 path s
92 source ../gitroot
92 source ../gitroot
93 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
93 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
94
94
95 clone root, make local change
95 clone root, make local change
96
96
97 $ cd ../t
97 $ cd ../t
98 $ hg clone . ../ta 2> /dev/null
98 $ hg clone . ../ta 2> /dev/null
99 updating to branch default
99 updating to branch default
100 cloning subrepo s from $TESTTMP/gitroot
100 cloning subrepo s from $TESTTMP/gitroot
101 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
102
102
103 $ cd ../ta
103 $ cd ../ta
104 $ echo ggg >> s/g
104 $ echo ggg >> s/g
105 $ hg status --subrepos
105 $ hg status --subrepos
106 M s/g
106 M s/g
107 $ hg diff --subrepos
107 $ hg diff --subrepos
108 diff --git a/s/g b/s/g
108 diff --git a/s/g b/s/g
109 index 089258f..85341ee 100644
109 index 089258f..85341ee 100644
110 --- a/s/g
110 --- a/s/g
111 +++ b/s/g
111 +++ b/s/g
112 @@ -1,2 +1,3 @@
112 @@ -1,2 +1,3 @@
113 g
113 g
114 gg
114 gg
115 +ggg
115 +ggg
116 $ hg commit --subrepos -m ggg
116 $ hg commit --subrepos -m ggg
117 committing subrepository s
117 committing subrepository s
118 $ hg debugsub
118 $ hg debugsub
119 path s
119 path s
120 source ../gitroot
120 source ../gitroot
121 revision 79695940086840c99328513acbe35f90fcd55e57
121 revision 79695940086840c99328513acbe35f90fcd55e57
122
122
123 clone root separately, make different local change
123 clone root separately, make different local change
124
124
125 $ cd ../t
125 $ cd ../t
126 $ hg clone . ../tb 2> /dev/null
126 $ hg clone . ../tb 2> /dev/null
127 updating to branch default
127 updating to branch default
128 cloning subrepo s from $TESTTMP/gitroot
128 cloning subrepo s from $TESTTMP/gitroot
129 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
129 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
130
130
131 $ cd ../tb/s
131 $ cd ../tb/s
132 $ hg status --subrepos
132 $ hg status --subrepos
133 $ echo f > f
133 $ echo f > f
134 $ hg status --subrepos
134 $ hg status --subrepos
135 ? s/f
135 ? s/f
136 $ hg add .
136 $ hg add .
137 adding f
137 adding f
138 $ git add f
138 $ git add f
139 $ cd ..
139 $ cd ..
140
140
141 $ hg status --subrepos
141 $ hg status --subrepos
142 A s/f
142 A s/f
143 $ hg commit --subrepos -m f
143 $ hg commit --subrepos -m f
144 committing subrepository s
144 committing subrepository s
145 $ hg debugsub
145 $ hg debugsub
146 path s
146 path s
147 source ../gitroot
147 source ../gitroot
148 revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
148 revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
149
149
150 user b push changes
150 user b push changes
151
151
152 $ hg push 2>/dev/null
152 $ hg push 2>/dev/null
153 pushing to $TESTTMP/t (glob)
153 pushing to $TESTTMP/t (glob)
154 pushing branch testing of subrepo s
154 pushing branch testing of subrepo s
155 searching for changes
155 searching for changes
156 adding changesets
156 adding changesets
157 adding manifests
157 adding manifests
158 adding file changes
158 adding file changes
159 added 1 changesets with 1 changes to 1 files
159 added 1 changesets with 1 changes to 1 files
160
160
161 user a pulls, merges, commits
161 user a pulls, merges, commits
162
162
163 $ cd ../ta
163 $ cd ../ta
164 $ hg pull
164 $ hg pull
165 pulling from $TESTTMP/t (glob)
165 pulling from $TESTTMP/t (glob)
166 searching for changes
166 searching for changes
167 adding changesets
167 adding changesets
168 adding manifests
168 adding manifests
169 adding file changes
169 adding file changes
170 added 1 changesets with 1 changes to 1 files (+1 heads)
170 added 1 changesets with 1 changes to 1 files (+1 heads)
171 (run 'hg heads' to see heads, 'hg merge' to merge)
171 (run 'hg heads' to see heads, 'hg merge' to merge)
172 $ hg merge 2>/dev/null
172 $ hg merge 2>/dev/null
173 subrepository s diverged (local revision: 7969594, remote revision: aa84837)
173 subrepository s diverged (local revision: 7969594, remote revision: aa84837)
174 (M)erge, keep (l)ocal or keep (r)emote? m
174 (M)erge, keep (l)ocal or keep (r)emote? m
175 pulling subrepo s from $TESTTMP/gitroot
175 pulling subrepo s from $TESTTMP/gitroot
176 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 (branch merge, don't forget to commit)
177 (branch merge, don't forget to commit)
178 $ hg st --subrepos s
178 $ hg st --subrepos s
179 A s/f
179 A s/f
180 $ cat s/f
180 $ cat s/f
181 f
181 f
182 $ cat s/g
182 $ cat s/g
183 g
183 g
184 gg
184 gg
185 ggg
185 ggg
186 $ hg commit --subrepos -m 'merge'
186 $ hg commit --subrepos -m 'merge'
187 committing subrepository s
187 committing subrepository s
188 $ hg status --subrepos --rev 1:5
188 $ hg status --subrepos --rev 1:5
189 M .hgsubstate
189 M .hgsubstate
190 M s/g
190 M s/g
191 A s/f
191 A s/f
192 $ hg debugsub
192 $ hg debugsub
193 path s
193 path s
194 source ../gitroot
194 source ../gitroot
195 revision f47b465e1bce645dbf37232a00574aa1546ca8d3
195 revision f47b465e1bce645dbf37232a00574aa1546ca8d3
196 $ hg push 2>/dev/null
196 $ hg push 2>/dev/null
197 pushing to $TESTTMP/t (glob)
197 pushing to $TESTTMP/t (glob)
198 pushing branch testing of subrepo s
198 pushing branch testing of subrepo s
199 searching for changes
199 searching for changes
200 adding changesets
200 adding changesets
201 adding manifests
201 adding manifests
202 adding file changes
202 adding file changes
203 added 2 changesets with 2 changes to 1 files
203 added 2 changesets with 2 changes to 1 files
204
204
205 make upstream git changes
205 make upstream git changes
206
206
207 $ cd ..
207 $ cd ..
208 $ git clone -q gitroot gitclone
208 $ git clone -q gitroot gitclone
209 $ cd gitclone
209 $ cd gitclone
210 $ echo ff >> f
210 $ echo ff >> f
211 $ git commit -q -a -m ff
211 $ git commit -q -a -m ff
212 $ echo fff >> f
212 $ echo fff >> f
213 $ git commit -q -a -m fff
213 $ git commit -q -a -m fff
214 $ git push origin testing 2>/dev/null
214 $ git push origin testing 2>/dev/null
215
215
216 make and push changes to hg without updating the subrepo
216 make and push changes to hg without updating the subrepo
217
217
218 $ cd ../t
218 $ cd ../t
219 $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.'
219 $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.'
220 updating to branch default
220 updating to branch default
221 cloning subrepo s from $TESTTMP/gitroot
221 cloning subrepo s from $TESTTMP/gitroot
222 checking out detached HEAD in subrepo s
222 checking out detached HEAD in subrepo s
223 check out a git branch if you intend to make changes
223 check out a git branch if you intend to make changes
224 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 $ cd ../td
225 $ cd ../td
226 $ echo aa >> a
226 $ echo aa >> a
227 $ hg commit -m aa
227 $ hg commit -m aa
228 $ hg push
228 $ hg push
229 pushing to $TESTTMP/t (glob)
229 pushing to $TESTTMP/t (glob)
230 searching for changes
230 searching for changes
231 adding changesets
231 adding changesets
232 adding manifests
232 adding manifests
233 adding file changes
233 adding file changes
234 added 1 changesets with 1 changes to 1 files
234 added 1 changesets with 1 changes to 1 files
235
235
236 sync to upstream git, distribute changes
236 sync to upstream git, distribute changes
237
237
238 $ cd ../ta
238 $ cd ../ta
239 $ hg pull -u -q
239 $ hg pull -u -q
240 $ cd s
240 $ cd s
241 $ git pull -q >/dev/null 2>/dev/null
241 $ git pull -q >/dev/null 2>/dev/null
242 $ cd ..
242 $ cd ..
243 $ hg commit -m 'git upstream sync'
243 $ hg commit -m 'git upstream sync'
244 $ hg debugsub
244 $ hg debugsub
245 path s
245 path s
246 source ../gitroot
246 source ../gitroot
247 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
247 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
248 $ hg push -q
248 $ hg push -q
249
249
250 $ cd ../tb
250 $ cd ../tb
251 $ hg pull -q
251 $ hg pull -q
252 $ hg update 2>/dev/null
252 $ hg update 2>/dev/null
253 pulling subrepo s from $TESTTMP/gitroot
253 pulling subrepo s from $TESTTMP/gitroot
254 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 $ hg debugsub
255 $ hg debugsub
256 path s
256 path s
257 source ../gitroot
257 source ../gitroot
258 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
258 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
259
259
260 create a new git branch
260 create a new git branch
261
261
262 $ cd s
262 $ cd s
263 $ git checkout -b b2
263 $ git checkout -b b2
264 Switched to a new branch 'b2'
264 Switched to a new branch 'b2'
265 $ echo a>a
265 $ echo a>a
266 $ git add a
266 $ git add a
267 $ git commit -qm 'add a'
267 $ git commit -qm 'add a'
268 $ cd ..
268 $ cd ..
269 $ hg commit -m 'add branch in s'
269 $ hg commit -m 'add branch in s'
270
270
271 pulling new git branch should not create tracking branch named 'origin/b2'
271 pulling new git branch should not create tracking branch named 'origin/b2'
272 (issue3870)
272 (issue3870)
273 $ cd ../td/s
273 $ cd ../td/s
274 $ git remote set-url origin $TESTTMP/tb/s
274 $ git remote set-url origin $TESTTMP/tb/s
275 $ git branch --no-track oldtesting
275 $ git branch --no-track oldtesting
276 $ cd ..
276 $ cd ..
277 $ hg pull -q ../tb
277 $ hg pull -q ../tb
278 $ hg up
278 $ hg up
279 From $TESTTMP/tb/s
279 From $TESTTMP/tb/s
280 * [new branch] b2 -> origin/b2
280 * [new branch] b2 -> origin/b2
281 Previous HEAD position was f47b465... merge
281 Previous HEAD position was f47b465... merge
282 Switched to a new branch 'b2'
282 Switched to a new branch 'b2'
283 pulling subrepo s from $TESTTMP/tb/s
283 pulling subrepo s from $TESTTMP/tb/s
284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
285
285
286 update to a revision without the subrepo, keeping the local git repository
286 update to a revision without the subrepo, keeping the local git repository
287
287
288 $ cd ../t
288 $ cd ../t
289 $ hg up 0
289 $ hg up 0
290 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
290 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
291 $ ls -a s
291 $ ls -a s
292 .
292 .
293 ..
293 ..
294 .git
294 .git
295
295
296 $ hg up 2
296 $ hg up 2
297 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
297 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 $ ls -a s
298 $ ls -a s
299 .
299 .
300 ..
300 ..
301 .git
301 .git
302 g
302 g
303
303
304 archive subrepos
304 archive subrepos
305
305
306 $ cd ../tc
306 $ cd ../tc
307 $ hg pull -q
307 $ hg pull -q
308 $ hg archive --subrepos -r 5 ../archive 2>/dev/null
308 $ hg archive --subrepos -r 5 ../archive 2>/dev/null
309 pulling subrepo s from $TESTTMP/gitroot
309 pulling subrepo s from $TESTTMP/gitroot
310 $ cd ../archive
310 $ cd ../archive
311 $ cat s/f
311 $ cat s/f
312 f
312 f
313 $ cat s/g
313 $ cat s/g
314 g
314 g
315 gg
315 gg
316 ggg
316 ggg
317
317
318 $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null
318 $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null
319 $ find ../archive_x | sort | grep -v pax_global_header
319 $ find ../archive_x | sort | grep -v pax_global_header
320 ../archive_x
320 ../archive_x
321 ../archive_x/.hg_archival.txt
321 ../archive_x/.hg_archival.txt
322 ../archive_x/.hgsub
322 ../archive_x/.hgsub
323 ../archive_x/.hgsubstate
323 ../archive_x/.hgsubstate
324 ../archive_x/a
324 ../archive_x/a
325 ../archive_x/s
325 ../archive_x/s
326 ../archive_x/s/g
326 ../archive_x/s/g
327
327
328 $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null
328 $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null
329 $ tar -tzf ../archive.tgz | sort | grep -v pax_global_header
329 $ tar -tzf ../archive.tgz | sort | grep -v pax_global_header
330 .hg_archival.txt
330 .hg_archival.txt
331 .hgsub
331 .hgsub
332 .hgsubstate
332 .hgsubstate
333 a
333 a
334 s/g
334 s/g
335
335
336 create nested repo
336 create nested repo
337
337
338 $ cd ..
338 $ cd ..
339 $ hg init outer
339 $ hg init outer
340 $ cd outer
340 $ cd outer
341 $ echo b>b
341 $ echo b>b
342 $ hg add b
342 $ hg add b
343 $ hg commit -m b
343 $ hg commit -m b
344
344
345 $ hg clone ../t inner 2> /dev/null
345 $ hg clone ../t inner 2> /dev/null
346 updating to branch default
346 updating to branch default
347 cloning subrepo s from $TESTTMP/gitroot
347 cloning subrepo s from $TESTTMP/gitroot
348 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
349 $ echo inner = inner > .hgsub
349 $ echo inner = inner > .hgsub
350 $ hg add .hgsub
350 $ hg add .hgsub
351 $ hg commit -m 'nested sub'
351 $ hg commit -m 'nested sub'
352
352
353 nested commit
353 nested commit
354
354
355 $ echo ffff >> inner/s/f
355 $ echo ffff >> inner/s/f
356 $ hg status --subrepos
356 $ hg status --subrepos
357 M inner/s/f
357 M inner/s/f
358 $ hg commit --subrepos -m nested
358 $ hg commit --subrepos -m nested
359 committing subrepository inner
359 committing subrepository inner
360 committing subrepository inner/s (glob)
360 committing subrepository inner/s (glob)
361
361
362 nested archive
362 nested archive
363
363
364 $ hg archive --subrepos ../narchive
364 $ hg archive --subrepos ../narchive
365 $ ls ../narchive/inner/s | grep -v pax_global_header
365 $ ls ../narchive/inner/s | grep -v pax_global_header
366 f
366 f
367 g
367 g
368
368
369 relative source expansion
369 relative source expansion
370
370
371 $ cd ..
371 $ cd ..
372 $ mkdir d
372 $ mkdir d
373 $ hg clone t d/t 2> /dev/null
373 $ hg clone t d/t 2> /dev/null
374 updating to branch default
374 updating to branch default
375 cloning subrepo s from $TESTTMP/gitroot
375 cloning subrepo s from $TESTTMP/gitroot
376 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
376 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
377
377
378 Don't crash if the subrepo is missing
378 Don't crash if the subrepo is missing
379
379
380 $ hg clone t missing -q
380 $ hg clone t missing -q
381 $ cd missing
381 $ cd missing
382 $ rm -rf s
382 $ rm -rf s
383 $ hg status -S
383 $ hg status -S
384 $ hg sum | grep commit
384 $ hg sum | grep commit
385 commit: 1 subrepos
385 commit: 1 subrepos
386 $ hg push -q
386 $ hg push -q
387 abort: subrepo s is missing (in subrepo s)
387 abort: subrepo s is missing (in subrepo s)
388 [255]
388 [255]
389 $ hg commit --subrepos -qm missing
389 $ hg commit --subrepos -qm missing
390 abort: subrepo s is missing (in subrepo s)
390 abort: subrepo s is missing (in subrepo s)
391 [255]
391 [255]
392
392
393 #if symlink
393 #if symlink
394 Don't crash if subrepo is a broken symlink
394 Don't crash if subrepo is a broken symlink
395 $ ln -s broken s
395 $ ln -s broken s
396 $ hg status -S
396 $ hg status -S
397 $ hg push -q
397 $ hg push -q
398 abort: subrepo s is missing (in subrepo s)
398 abort: subrepo s is missing (in subrepo s)
399 [255]
399 [255]
400 $ hg commit --subrepos -qm missing
400 $ hg commit --subrepos -qm missing
401 abort: subrepo s is missing (in subrepo s)
401 abort: subrepo s is missing (in subrepo s)
402 [255]
402 [255]
403 $ rm s
403 $ rm s
404 #endif
404 #endif
405
405
406 $ hg update -C 2> /dev/null
406 $ hg update -C 2> /dev/null
407 cloning subrepo s from $TESTTMP/gitroot
407 cloning subrepo s from $TESTTMP/gitroot
408 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
409 $ hg sum | grep commit
409 $ hg sum | grep commit
410 commit: (clean)
410 commit: (clean)
411
411
412 Don't crash if the .hgsubstate entry is missing
412 Don't crash if the .hgsubstate entry is missing
413
413
414 $ hg update 1 -q
414 $ hg update 1 -q
415 $ hg rm .hgsubstate
415 $ hg rm .hgsubstate
416 $ hg commit .hgsubstate -m 'no substate'
416 $ hg commit .hgsubstate -m 'no substate'
417 nothing changed
417 nothing changed
418 [1]
418 [1]
419 $ hg tag -l nosubstate
419 $ hg tag -l nosubstate
420 $ hg manifest
420 $ hg manifest
421 .hgsub
421 .hgsub
422 .hgsubstate
422 .hgsubstate
423 a
423 a
424
424
425 $ hg status -S
425 $ hg status -S
426 R .hgsubstate
426 R .hgsubstate
427 $ hg sum | grep commit
427 $ hg sum | grep commit
428 commit: 1 removed, 1 subrepos (new branch head)
428 commit: 1 removed, 1 subrepos (new branch head)
429
429
430 $ hg commit -m 'restore substate'
430 $ hg commit -m 'restore substate'
431 nothing changed
431 nothing changed
432 [1]
432 [1]
433 $ hg manifest
433 $ hg manifest
434 .hgsub
434 .hgsub
435 .hgsubstate
435 .hgsubstate
436 a
436 a
437 $ hg sum | grep commit
437 $ hg sum | grep commit
438 commit: 1 removed, 1 subrepos (new branch head)
438 commit: 1 removed, 1 subrepos (new branch head)
439
439
440 $ hg update -qC nosubstate
440 $ hg update -qC nosubstate
441 $ ls s
441 $ ls s
442 g
442 g
443
443
444 issue3109: false positives in git diff-index
444 issue3109: false positives in git diff-index
445
445
446 $ hg update -q
446 $ hg update -q
447 $ touch -t 200001010000 s/g
447 $ touch -t 200001010000 s/g
448 $ hg status --subrepos
448 $ hg status --subrepos
449 $ touch -t 200001010000 s/g
449 $ touch -t 200001010000 s/g
450 $ hg sum | grep commit
450 $ hg sum | grep commit
451 commit: (clean)
451 commit: (clean)
452
452
453 Check hg update --clean
453 Check hg update --clean
454 $ cd $TESTTMP/ta
454 $ cd $TESTTMP/ta
455 $ echo > s/g
455 $ echo > s/g
456 $ cd s
456 $ cd s
457 $ echo c1 > f1
457 $ echo c1 > f1
458 $ echo c1 > f2
458 $ echo c1 > f2
459 $ git add f1
459 $ git add f1
460 $ cd ..
460 $ cd ..
461 $ hg status -S
461 $ hg status -S
462 M s/g
462 M s/g
463 A s/f1
463 A s/f1
464 ? s/f2
464 ? s/f2
465 $ ls s
465 $ ls s
466 f
466 f
467 f1
467 f1
468 f2
468 f2
469 g
469 g
470 $ hg update --clean
470 $ hg update --clean
471 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
471 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
472 $ hg status -S
472 $ hg status -S
473 ? s/f1
473 ? s/f1
474 ? s/f2
474 ? s/f2
475 $ ls s
475 $ ls s
476 f
476 f
477 f1
477 f1
478 f2
478 f2
479 g
479 g
480
480
481 Sticky subrepositories, no changes
481 Sticky subrepositories, no changes
482 $ cd $TESTTMP/ta
482 $ cd $TESTTMP/ta
483 $ hg id -n
483 $ hg id -n
484 7
484 7
485 $ cd s
485 $ cd s
486 $ git rev-parse HEAD
486 $ git rev-parse HEAD
487 32a343883b74769118bb1d3b4b1fbf9156f4dddc
487 32a343883b74769118bb1d3b4b1fbf9156f4dddc
488 $ cd ..
488 $ cd ..
489 $ hg update 1 > /dev/null 2>&1
489 $ hg update 1 > /dev/null 2>&1
490 $ hg id -n
490 $ hg id -n
491 1
491 1
492 $ cd s
492 $ cd s
493 $ git rev-parse HEAD
493 $ git rev-parse HEAD
494 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
494 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
495 $ cd ..
495 $ cd ..
496
496
497 Sticky subrepositories, file changes
497 Sticky subrepositories, file changes
498 $ touch s/f1
498 $ touch s/f1
499 $ cd s
499 $ cd s
500 $ git add f1
500 $ git add f1
501 $ cd ..
501 $ cd ..
502 $ hg id -n
502 $ hg id -n
503 1+
503 1+
504 $ cd s
504 $ cd s
505 $ git rev-parse HEAD
505 $ git rev-parse HEAD
506 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
506 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
507 $ cd ..
507 $ cd ..
508 $ hg update 4
508 $ hg update 4
509 subrepository s diverged (local revision: da5f5b1, remote revision: aa84837)
509 subrepository s diverged (local revision: da5f5b1, remote revision: aa84837)
510 (M)erge, keep (l)ocal or keep (r)emote? m
510 (M)erge, keep (l)ocal or keep (r)emote? m
511 subrepository sources for s differ
511 subrepository sources for s differ
512 use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l
512 use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l
513 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
513 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
514 $ hg id -n
514 $ hg id -n
515 4+
515 4+
516 $ cd s
516 $ cd s
517 $ git rev-parse HEAD
517 $ git rev-parse HEAD
518 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
518 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
519 $ cd ..
519 $ cd ..
520 $ hg update --clean tip > /dev/null 2>&1
520 $ hg update --clean tip > /dev/null 2>&1
521
521
522 Sticky subrepository, revision updates
522 Sticky subrepository, revision updates
523 $ hg id -n
523 $ hg id -n
524 7
524 7
525 $ cd s
525 $ cd s
526 $ git rev-parse HEAD
526 $ git rev-parse HEAD
527 32a343883b74769118bb1d3b4b1fbf9156f4dddc
527 32a343883b74769118bb1d3b4b1fbf9156f4dddc
528 $ cd ..
528 $ cd ..
529 $ cd s
529 $ cd s
530 $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
530 $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
531 Previous HEAD position was 32a3438... fff
531 Previous HEAD position was 32a3438... fff
532 HEAD is now at aa84837... f
532 HEAD is now at aa84837... f
533 $ cd ..
533 $ cd ..
534 $ hg update 1
534 $ hg update 1
535 subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1)
535 subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1)
536 (M)erge, keep (l)ocal or keep (r)emote? m
536 (M)erge, keep (l)ocal or keep (r)emote? m
537 subrepository sources for s differ (in checked out version)
537 subrepository sources for s differ (in checked out version)
538 use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l
538 use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l
539 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
539 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
540 $ hg id -n
540 $ hg id -n
541 1+
541 1+
542 $ cd s
542 $ cd s
543 $ git rev-parse HEAD
543 $ git rev-parse HEAD
544 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
544 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
545 $ cd ..
545 $ cd ..
546
546
547 Sticky subrepository, file changes and revision updates
547 Sticky subrepository, file changes and revision updates
548 $ touch s/f1
548 $ touch s/f1
549 $ cd s
549 $ cd s
550 $ git add f1
550 $ git add f1
551 $ git rev-parse HEAD
551 $ git rev-parse HEAD
552 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
552 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
553 $ cd ..
553 $ cd ..
554 $ hg id -n
554 $ hg id -n
555 1+
555 1+
556 $ hg update 7
556 $ hg update 7
557 subrepository s diverged (local revision: 32a3438, remote revision: 32a3438)
557 subrepository s diverged (local revision: 32a3438, remote revision: 32a3438)
558 (M)erge, keep (l)ocal or keep (r)emote? m
558 (M)erge, keep (l)ocal or keep (r)emote? m
559 subrepository sources for s differ
559 subrepository sources for s differ
560 use (l)ocal source (32a3438) or (r)emote source (32a3438)? l
560 use (l)ocal source (32a3438) or (r)emote source (32a3438)? l
561 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
561 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
562 $ hg id -n
562 $ hg id -n
563 7+
563 7+
564 $ cd s
564 $ cd s
565 $ git rev-parse HEAD
565 $ git rev-parse HEAD
566 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
566 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
567 $ cd ..
567 $ cd ..
568
568
569 Sticky repository, update --clean
569 Sticky repository, update --clean
570 $ hg update --clean tip 2>/dev/null
570 $ hg update --clean tip 2>/dev/null
571 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
571 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
572 $ hg id -n
572 $ hg id -n
573 7
573 7
574 $ cd s
574 $ cd s
575 $ git rev-parse HEAD
575 $ git rev-parse HEAD
576 32a343883b74769118bb1d3b4b1fbf9156f4dddc
576 32a343883b74769118bb1d3b4b1fbf9156f4dddc
577 $ cd ..
577 $ cd ..
578
578
579 Test subrepo already at intended revision:
579 Test subrepo already at intended revision:
580 $ cd s
580 $ cd s
581 $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc
581 $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc
582 HEAD is now at 32a3438... fff
582 HEAD is now at 32a3438... fff
583 $ cd ..
583 $ cd ..
584 $ hg update 1
584 $ hg update 1
585 Previous HEAD position was 32a3438... fff
585 Previous HEAD position was 32a3438... fff
586 HEAD is now at da5f5b1... g
586 HEAD is now at da5f5b1... g
587 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
587 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
588 $ hg id -n
588 $ hg id -n
589 1
589 1
590 $ cd s
590 $ cd s
591 $ git rev-parse HEAD
591 $ git rev-parse HEAD
592 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
592 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
593 $ cd ..
593 $ cd ..
594
594
595 Test forgetting files, not implemented in git subrepo, used to
595 Test forgetting files, not implemented in git subrepo, used to
596 traceback
596 traceback
597 #if no-windows
597 #if no-windows
598 $ hg forget 'notafile*'
598 $ hg forget 'notafile*'
599 notafile*: No such file or directory
599 notafile*: No such file or directory
600 [1]
600 [1]
601 #else
601 #else
602 $ hg forget 'notafile'
602 $ hg forget 'notafile'
603 notafile: * (glob)
603 notafile: * (glob)
604 [1]
604 [1]
605 #endif
605 #endif
606
606
607 $ cd ..
607 $ cd ..
608
608
609 Test sanitizing ".hg/hgrc" in subrepo
609 Test sanitizing ".hg/hgrc" in subrepo
610
610
611 $ cd t
611 $ cd t
612 $ hg tip -q
612 $ hg tip -q
613 7:af6d2edbb0d3
613 7:af6d2edbb0d3
614 $ hg update -q -C af6d2edbb0d3
614 $ hg update -q -C af6d2edbb0d3
615 $ cd s
615 $ cd s
616 $ git checkout -q -b sanitize-test
616 $ git checkout -q -b sanitize-test
617 $ mkdir .hg
617 $ mkdir .hg
618 $ echo '.hg/hgrc in git repo' > .hg/hgrc
618 $ echo '.hg/hgrc in git repo' > .hg/hgrc
619 $ mkdir -p sub/.hg
619 $ mkdir -p sub/.hg
620 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
620 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
621 $ git add .hg sub
621 $ git add .hg sub
622 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update'
622 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update'
623 $ git push -q origin sanitize-test
623 $ git push -q origin sanitize-test
624 $ cd ..
624 $ cd ..
625 $ grep ' s$' .hgsubstate
625 $ grep ' s$' .hgsubstate
626 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
626 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
627 $ hg commit -qm 'commit with git revision including .hg/hgrc'
627 $ hg commit -qm 'commit with git revision including .hg/hgrc'
628 $ hg parents -q
628 $ hg parents -q
629 8:3473d20bddcf
629 8:3473d20bddcf
630 $ grep ' s$' .hgsubstate
630 $ grep ' s$' .hgsubstate
631 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
631 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
632 $ cd ..
632 $ cd ..
633
633
634 $ hg -R tc pull -q
634 $ hg -R tc pull -q
635 $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort
635 $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort
636 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
636 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
637 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
637 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
638 $ cd tc
638 $ cd tc
639 $ hg parents -q
639 $ hg parents -q
640 8:3473d20bddcf
640 8:3473d20bddcf
641 $ grep ' s$' .hgsubstate
641 $ grep ' s$' .hgsubstate
642 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
642 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
643 $ test -f s/.hg/hgrc
643 $ test -f s/.hg/hgrc
644 [1]
644 [1]
645 $ test -f s/sub/.hg/hgrc
645 $ test -f s/sub/.hg/hgrc
646 [1]
646 [1]
647 $ cd ..
647 $ cd ..
648
648
649 additional test for "git merge --ff" route:
649 additional test for "git merge --ff" route:
650
650
651 $ cd t
651 $ cd t
652 $ hg tip -q
652 $ hg tip -q
653 8:3473d20bddcf
653 8:3473d20bddcf
654 $ hg update -q -C af6d2edbb0d3
654 $ hg update -q -C af6d2edbb0d3
655 $ cd s
655 $ cd s
656 $ git checkout -q testing
656 $ git checkout -q testing
657 $ mkdir .hg
657 $ mkdir .hg
658 $ echo '.hg/hgrc in git repo' > .hg/hgrc
658 $ echo '.hg/hgrc in git repo' > .hg/hgrc
659 $ mkdir -p sub/.hg
659 $ mkdir -p sub/.hg
660 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
660 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
661 $ git add .hg sub
661 $ git add .hg sub
662 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)'
662 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)'
663 $ git push -q origin testing
663 $ git push -q origin testing
664 $ cd ..
664 $ cd ..
665 $ grep ' s$' .hgsubstate
665 $ grep ' s$' .hgsubstate
666 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
666 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
667 $ hg commit -qm 'commit with git revision including .hg/hgrc'
667 $ hg commit -qm 'commit with git revision including .hg/hgrc'
668 $ hg parents -q
668 $ hg parents -q
669 9:ed23f7fe024e
669 9:ed23f7fe024e
670 $ grep ' s$' .hgsubstate
670 $ grep ' s$' .hgsubstate
671 f262643c1077219fbd3858d54e78ef050ef84fbf s
671 f262643c1077219fbd3858d54e78ef050ef84fbf s
672 $ cd ..
672 $ cd ..
673
673
674 $ cd tc
674 $ cd tc
675 $ hg update -q -C af6d2edbb0d3
675 $ hg update -q -C af6d2edbb0d3
676 $ test -f s/.hg/hgrc
676 $ test -f s/.hg/hgrc
677 [1]
677 [1]
678 $ test -f s/sub/.hg/hgrc
678 $ test -f s/sub/.hg/hgrc
679 [1]
679 [1]
680 $ cd ..
680 $ cd ..
681 $ hg -R tc pull -q
681 $ hg -R tc pull -q
682 $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort
682 $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort
683 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
683 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
684 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
684 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
685 $ cd tc
685 $ cd tc
686 $ hg parents -q
686 $ hg parents -q
687 9:ed23f7fe024e
687 9:ed23f7fe024e
688 $ grep ' s$' .hgsubstate
688 $ grep ' s$' .hgsubstate
689 f262643c1077219fbd3858d54e78ef050ef84fbf s
689 f262643c1077219fbd3858d54e78ef050ef84fbf s
690 $ test -f s/.hg/hgrc
690 $ test -f s/.hg/hgrc
691 [1]
691 [1]
692 $ test -f s/sub/.hg/hgrc
692 $ test -f s/sub/.hg/hgrc
693 [1]
693 [1]
694
694
695 Test that sanitizing is omitted in meta data area:
695 Test that sanitizing is omitted in meta data area:
696
696
697 $ mkdir s/.git/.hg
697 $ mkdir s/.git/.hg
698 $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc
698 $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc
699 $ hg update -q -C af6d2edbb0d3
699 $ hg update -q -C af6d2edbb0d3
700 checking out detached HEAD in subrepo s
700 checking out detached HEAD in subrepo s
701 check out a git branch if you intend to make changes
701 check out a git branch if you intend to make changes
702
702
703 check differences made by most recent change
703 check differences made by most recent change
704 $ cd s
704 $ cd s
705 $ cat > foobar << EOF
705 $ cat > foobar << EOF
706 > woopwoop
706 > woopwoop
707 >
707 >
708 > foo
708 > foo
709 > bar
709 > bar
710 > EOF
710 > EOF
711 $ git add foobar
711 $ git add foobar
712 $ cd ..
712 $ cd ..
713
713
714 $ hg diff --subrepos
714 $ hg diff --subrepos
715 diff --git a/s/foobar b/s/foobar
715 diff --git a/s/foobar b/s/foobar
716 new file mode 100644
716 new file mode 100644
717 index 0000000..8a5a5e2
717 index 0000000..8a5a5e2
718 --- /dev/null
718 --- /dev/null
719 +++ b/s/foobar
719 +++ b/s/foobar
720 @@ -0,0 +1,4 @@
720 @@ -0,0 +1,4 @@
721 +woopwoop
721 +woopwoop
722 +
722 +
723 +foo
723 +foo
724 +bar
724 +bar
725
725
726 $ hg commit --subrepos -m "Added foobar"
726 $ hg commit --subrepos -m "Added foobar"
727 committing subrepository s
727 committing subrepository s
728 created new head
728 created new head
729
729
730 $ hg diff -c . --subrepos --nodates
730 $ hg diff -c . --subrepos --nodates
731 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
731 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
732 --- a/.hgsubstate
732 --- a/.hgsubstate
733 +++ b/.hgsubstate
733 +++ b/.hgsubstate
734 @@ -1,1 +1,1 @@
734 @@ -1,1 +1,1 @@
735 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
735 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
736 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
736 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
737 diff --git a/s/foobar b/s/foobar
737 diff --git a/s/foobar b/s/foobar
738 new file mode 100644
738 new file mode 100644
739 index 0000000..8a5a5e2
739 index 0000000..8a5a5e2
740 --- /dev/null
740 --- /dev/null
741 +++ b/s/foobar
741 +++ b/s/foobar
742 @@ -0,0 +1,4 @@
742 @@ -0,0 +1,4 @@
743 +woopwoop
743 +woopwoop
744 +
744 +
745 +foo
745 +foo
746 +bar
746 +bar
747
747
748 check output when only diffing the subrepository
748 check output when only diffing the subrepository
749 $ hg diff -c . --subrepos s
749 $ hg diff -c . --subrepos s
750 diff --git a/s/foobar b/s/foobar
750 diff --git a/s/foobar b/s/foobar
751 new file mode 100644
751 new file mode 100644
752 index 0000000..8a5a5e2
752 index 0000000..8a5a5e2
753 --- /dev/null
753 --- /dev/null
754 +++ b/s/foobar
754 +++ b/s/foobar
755 @@ -0,0 +1,4 @@
755 @@ -0,0 +1,4 @@
756 +woopwoop
756 +woopwoop
757 +
757 +
758 +foo
758 +foo
759 +bar
759 +bar
760
760
761 check output when diffing something else
761 check output when diffing something else
762 $ hg diff -c . --subrepos .hgsubstate --nodates
762 $ hg diff -c . --subrepos .hgsubstate --nodates
763 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
763 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
764 --- a/.hgsubstate
764 --- a/.hgsubstate
765 +++ b/.hgsubstate
765 +++ b/.hgsubstate
766 @@ -1,1 +1,1 @@
766 @@ -1,1 +1,1 @@
767 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
767 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
768 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
768 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
769
769
770 add new changes, including whitespace
770 add new changes, including whitespace
771 $ cd s
771 $ cd s
772 $ cat > foobar << EOF
772 $ cat > foobar << EOF
773 > woop woop
773 > woop woop
774 >
774 >
775 > foo
775 > foo
776 > bar
776 > bar
777 > EOF
777 > EOF
778 $ echo foo > barfoo
778 $ echo foo > barfoo
779 $ git add barfoo
779 $ git add barfoo
780 $ cd ..
780 $ cd ..
781
781
782 $ hg diff --subrepos --ignore-all-space
782 $ hg diff --subrepos --ignore-all-space
783 diff --git a/s/barfoo b/s/barfoo
783 diff --git a/s/barfoo b/s/barfoo
784 new file mode 100644
784 new file mode 100644
785 index 0000000..257cc56
785 index 0000000..257cc56
786 --- /dev/null
786 --- /dev/null
787 +++ b/s/barfoo
787 +++ b/s/barfoo
788 @@ -0,0 +1* @@ (glob)
788 @@ -0,0 +1* @@ (glob)
789 +foo
789 +foo
790 $ hg diff --subrepos s/foobar
790 $ hg diff --subrepos s/foobar
791 diff --git a/s/foobar b/s/foobar
791 diff --git a/s/foobar b/s/foobar
792 index 8a5a5e2..bd5812a 100644
792 index 8a5a5e2..bd5812a 100644
793 --- a/s/foobar
793 --- a/s/foobar
794 +++ b/s/foobar
794 +++ b/s/foobar
795 @@ -1,4 +1,4 @@
795 @@ -1,4 +1,4 @@
796 -woopwoop
796 -woopwoop
797 +woop woop
797 +woop woop
798
798
799 foo
799 foo
800 bar
800 bar
801
801
802 execute a diffstat
802 execute a diffstat
803 the output contains a regex, because git 1.7.10 and 1.7.11
803 the output contains a regex, because git 1.7.10 and 1.7.11
804 change the amount of whitespace
804 change the amount of whitespace
805 $ hg diff --subrepos --stat
805 $ hg diff --subrepos --stat
806 \s*barfoo |\s*1 + (re)
806 \s*barfoo |\s*1 + (re)
807 \s*foobar |\s*2 +- (re)
807 \s*foobar |\s*2 +- (re)
808 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re)
808 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re)
809
809
810 adding an include should ignore the other elements
810 adding an include should ignore the other elements
811 $ hg diff --subrepos -I s/foobar
811 $ hg diff --subrepos -I s/foobar
812 diff --git a/s/foobar b/s/foobar
812 diff --git a/s/foobar b/s/foobar
813 index 8a5a5e2..bd5812a 100644
813 index 8a5a5e2..bd5812a 100644
814 --- a/s/foobar
814 --- a/s/foobar
815 +++ b/s/foobar
815 +++ b/s/foobar
816 @@ -1,4 +1,4 @@
816 @@ -1,4 +1,4 @@
817 -woopwoop
817 -woopwoop
818 +woop woop
818 +woop woop
819
819
820 foo
820 foo
821 bar
821 bar
822
822
823 adding an exclude should ignore this element
823 adding an exclude should ignore this element
824 $ hg diff --subrepos -X s/foobar
824 $ hg diff --subrepos -X s/foobar
825 diff --git a/s/barfoo b/s/barfoo
825 diff --git a/s/barfoo b/s/barfoo
826 new file mode 100644
826 new file mode 100644
827 index 0000000..257cc56
827 index 0000000..257cc56
828 --- /dev/null
828 --- /dev/null
829 +++ b/s/barfoo
829 +++ b/s/barfoo
830 @@ -0,0 +1* @@ (glob)
830 @@ -0,0 +1* @@ (glob)
831 +foo
831 +foo
832
832
833 moving a file should show a removal and an add
833 moving a file should show a removal and an add
834 $ hg revert --all
834 $ hg revert --all
835 reverting subrepo ../gitroot
835 reverting subrepo ../gitroot
836 $ cd s
836 $ cd s
837 $ git mv foobar woop
837 $ git mv foobar woop
838 $ cd ..
838 $ cd ..
839 $ hg diff --subrepos
839 $ hg diff --subrepos
840 diff --git a/s/foobar b/s/foobar
840 diff --git a/s/foobar b/s/foobar
841 deleted file mode 100644
841 deleted file mode 100644
842 index 8a5a5e2..0000000
842 index 8a5a5e2..0000000
843 --- a/s/foobar
843 --- a/s/foobar
844 +++ /dev/null
844 +++ /dev/null
845 @@ -1,4 +0,0 @@
845 @@ -1,4 +0,0 @@
846 -woopwoop
846 -woopwoop
847 -
847 -
848 -foo
848 -foo
849 -bar
849 -bar
850 diff --git a/s/woop b/s/woop
850 diff --git a/s/woop b/s/woop
851 new file mode 100644
851 new file mode 100644
852 index 0000000..8a5a5e2
852 index 0000000..8a5a5e2
853 --- /dev/null
853 --- /dev/null
854 +++ b/s/woop
854 +++ b/s/woop
855 @@ -0,0 +1,4 @@
855 @@ -0,0 +1,4 @@
856 +woopwoop
856 +woopwoop
857 +
857 +
858 +foo
858 +foo
859 +bar
859 +bar
860 $ rm s/woop
860 $ rm s/woop
861
861
862 revert the subrepository
862 revert the subrepository
863 $ hg revert --all
863 $ hg revert --all
864 reverting subrepo ../gitroot
864 reverting subrepo ../gitroot
865
865
866 $ hg status --subrepos
866 $ hg status --subrepos
867 ? s/barfoo
867 ? s/barfoo
868 ? s/foobar.orig
868 ? s/foobar.orig
869
869
870 $ mv s/foobar.orig s/foobar
870 $ mv s/foobar.orig s/foobar
871
871
872 $ hg revert --no-backup s
872 $ hg revert --no-backup s
873 reverting subrepo ../gitroot
873 reverting subrepo ../gitroot
874
874
875 $ hg status --subrepos
875 $ hg status --subrepos
876 ? s/barfoo
876 ? s/barfoo
877
877
878 revert moves orig files to the right place
878 revert moves orig files to the right place
879 $ echo 'bloop' > s/foobar
879 $ echo 'bloop' > s/foobar
880 $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
880 $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
881 reverting subrepo ../gitroot
881 reverting subrepo ../gitroot
882 creating directory: $TESTTMP/tc/.hg/origbackups (glob)
882 creating directory: $TESTTMP/tc/.hg/origbackups (glob)
883 saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar.orig (glob)
883 saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar.orig (glob)
884 $ ls .hg/origbackups
884 $ ls .hg/origbackups
885 foobar.orig
885 foobar.orig
886 $ rm -rf .hg/origbackups
886 $ rm -rf .hg/origbackups
887
887
888 show file at specific revision
888 show file at specific revision
889 $ cat > s/foobar << EOF
889 $ cat > s/foobar << EOF
890 > woop woop
890 > woop woop
891 > fooo bar
891 > fooo bar
892 > EOF
892 > EOF
893 $ hg commit --subrepos -m "updated foobar"
893 $ hg commit --subrepos -m "updated foobar"
894 committing subrepository s
894 committing subrepository s
895 $ cat > s/foobar << EOF
895 $ cat > s/foobar << EOF
896 > current foobar
896 > current foobar
897 > (should not be visible using hg cat)
897 > (should not be visible using hg cat)
898 > EOF
898 > EOF
899
899
900 $ hg cat -r . s/foobar
900 $ hg cat -r . s/foobar
901 woop woop
901 woop woop
902 fooo bar (no-eol)
902 fooo bar (no-eol)
903 $ hg cat -r "parents(.)" s/foobar > catparents
903 $ hg cat -r "parents(.)" s/foobar > catparents
904
904
905 $ mkdir -p tmp/s
905 $ mkdir -p tmp/s
906
906
907 $ hg cat -r "parents(.)" --output tmp/%% s/foobar
907 $ hg cat -r "parents(.)" --output tmp/%% s/foobar
908 $ diff tmp/% catparents
908 $ diff tmp/% catparents
909
909
910 $ hg cat -r "parents(.)" --output tmp/%s s/foobar
910 $ hg cat -r "parents(.)" --output tmp/%s s/foobar
911 $ diff tmp/foobar catparents
911 $ diff tmp/foobar catparents
912
912
913 $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar
913 $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar
914 $ diff tmp/s/otherfoobar catparents
914 $ diff tmp/s/otherfoobar catparents
915
915
916 $ hg cat -r "parents(.)" --output tmp/%p s/foobar
916 $ hg cat -r "parents(.)" --output tmp/%p s/foobar
917 $ diff tmp/s/foobar catparents
917 $ diff tmp/s/foobar catparents
918
918
919 $ hg cat -r "parents(.)" --output tmp/%H s/foobar
919 $ hg cat -r "parents(.)" --output tmp/%H s/foobar
920 $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents
920 $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents
921
921
922 $ hg cat -r "parents(.)" --output tmp/%R s/foobar
922 $ hg cat -r "parents(.)" --output tmp/%R s/foobar
923 $ diff tmp/10 catparents
923 $ diff tmp/10 catparents
924
924
925 $ hg cat -r "parents(.)" --output tmp/%h s/foobar
925 $ hg cat -r "parents(.)" --output tmp/%h s/foobar
926 $ diff tmp/255ee8cf690e catparents
926 $ diff tmp/255ee8cf690e catparents
927
927
928 $ rm tmp/10
928 $ rm tmp/10
929 $ hg cat -r "parents(.)" --output tmp/%r s/foobar
929 $ hg cat -r "parents(.)" --output tmp/%r s/foobar
930 $ diff tmp/10 catparents
930 $ diff tmp/10 catparents
931
931
932 $ mkdir tmp/tc
932 $ mkdir tmp/tc
933 $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar
933 $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar
934 $ diff tmp/tc/foobar catparents
934 $ diff tmp/tc/foobar catparents
935
935
936 cleanup
936 cleanup
937 $ rm -r tmp
937 $ rm -r tmp
938 $ rm catparents
938 $ rm catparents
939
939
940 add git files, using either files or patterns
940 add git files, using either files or patterns
941 $ echo "hsss! hsssssssh!" > s/snake.python
941 $ echo "hsss! hsssssssh!" > s/snake.python
942 $ echo "ccc" > s/c.c
942 $ echo "ccc" > s/c.c
943 $ echo "cpp" > s/cpp.cpp
943 $ echo "cpp" > s/cpp.cpp
944
944
945 $ hg add s/snake.python s/c.c s/cpp.cpp
945 $ hg add s/snake.python s/c.c s/cpp.cpp
946 $ hg st --subrepos s
946 $ hg st --subrepos s
947 M s/foobar
947 M s/foobar
948 A s/c.c
948 A s/c.c
949 A s/cpp.cpp
949 A s/cpp.cpp
950 A s/snake.python
950 A s/snake.python
951 ? s/barfoo
951 ? s/barfoo
952 $ hg revert s
952 $ hg revert s
953 reverting subrepo ../gitroot
953 reverting subrepo ../gitroot
954
954
955 $ hg add --subrepos "glob:**.python"
955 $ hg add --subrepos "glob:**.python"
956 adding s/snake.python (glob)
956 adding s/snake.python (glob)
957 $ hg st --subrepos s
957 $ hg st --subrepos s
958 A s/snake.python
958 A s/snake.python
959 ? s/barfoo
959 ? s/barfoo
960 ? s/c.c
960 ? s/c.c
961 ? s/cpp.cpp
961 ? s/cpp.cpp
962 ? s/foobar.orig
962 ? s/foobar.orig
963 $ hg revert s
963 $ hg revert s
964 reverting subrepo ../gitroot
964 reverting subrepo ../gitroot
965
965
966 $ hg add --subrepos s
966 $ hg add --subrepos s
967 adding s/barfoo (glob)
967 adding s/barfoo (glob)
968 adding s/c.c (glob)
968 adding s/c.c (glob)
969 adding s/cpp.cpp (glob)
969 adding s/cpp.cpp (glob)
970 adding s/foobar.orig (glob)
970 adding s/foobar.orig (glob)
971 adding s/snake.python (glob)
971 adding s/snake.python (glob)
972 $ hg st --subrepos s
972 $ hg st --subrepos s
973 A s/barfoo
973 A s/barfoo
974 A s/c.c
974 A s/c.c
975 A s/cpp.cpp
975 A s/cpp.cpp
976 A s/foobar.orig
976 A s/foobar.orig
977 A s/snake.python
977 A s/snake.python
978 $ hg revert s
978 $ hg revert s
979 reverting subrepo ../gitroot
979 reverting subrepo ../gitroot
980 make sure everything is reverted correctly
980 make sure everything is reverted correctly
981 $ hg st --subrepos s
981 $ hg st --subrepos s
982 ? s/barfoo
982 ? s/barfoo
983 ? s/c.c
983 ? s/c.c
984 ? s/cpp.cpp
984 ? s/cpp.cpp
985 ? s/foobar.orig
985 ? s/foobar.orig
986 ? s/snake.python
986 ? s/snake.python
987
987
988 $ hg add --subrepos --exclude "path:s/c.c"
988 $ hg add --subrepos --exclude "path:s/c.c"
989 adding s/barfoo (glob)
989 adding s/barfoo (glob)
990 adding s/cpp.cpp (glob)
990 adding s/cpp.cpp (glob)
991 adding s/foobar.orig (glob)
991 adding s/foobar.orig (glob)
992 adding s/snake.python (glob)
992 adding s/snake.python (glob)
993 $ hg st --subrepos s
993 $ hg st --subrepos s
994 A s/barfoo
994 A s/barfoo
995 A s/cpp.cpp
995 A s/cpp.cpp
996 A s/foobar.orig
996 A s/foobar.orig
997 A s/snake.python
997 A s/snake.python
998 ? s/c.c
998 ? s/c.c
999 $ hg revert --all -q
999 $ hg revert --all -q
1000
1000
1001 .hgignore should not have influence in subrepos
1001 .hgignore should not have influence in subrepos
1002 $ cat > .hgignore << EOF
1002 $ cat > .hgignore << EOF
1003 > syntax: glob
1003 > syntax: glob
1004 > *.python
1004 > *.python
1005 > EOF
1005 > EOF
1006 $ hg add .hgignore
1006 $ hg add .hgignore
1007 $ hg add --subrepos "glob:**.python" s/barfoo
1007 $ hg add --subrepos "glob:**.python" s/barfoo
1008 adding s/snake.python (glob)
1008 adding s/snake.python (glob)
1009 $ hg st --subrepos s
1009 $ hg st --subrepos s
1010 A s/barfoo
1010 A s/barfoo
1011 A s/snake.python
1011 A s/snake.python
1012 ? s/c.c
1012 ? s/c.c
1013 ? s/cpp.cpp
1013 ? s/cpp.cpp
1014 ? s/foobar.orig
1014 ? s/foobar.orig
1015 $ hg revert --all -q
1015 $ hg revert --all -q
1016
1016
1017 .gitignore should have influence,
1017 .gitignore should have influence,
1018 except for explicitly added files (no patterns)
1018 except for explicitly added files (no patterns)
1019 $ cat > s/.gitignore << EOF
1019 $ cat > s/.gitignore << EOF
1020 > *.python
1020 > *.python
1021 > EOF
1021 > EOF
1022 $ hg add s/.gitignore
1022 $ hg add s/.gitignore
1023 $ hg st --subrepos s
1023 $ hg st --subrepos s
1024 A s/.gitignore
1024 A s/.gitignore
1025 ? s/barfoo
1025 ? s/barfoo
1026 ? s/c.c
1026 ? s/c.c
1027 ? s/cpp.cpp
1027 ? s/cpp.cpp
1028 ? s/foobar.orig
1028 ? s/foobar.orig
1029 $ hg st --subrepos s --all
1029 $ hg st --subrepos s --all
1030 A s/.gitignore
1030 A s/.gitignore
1031 ? s/barfoo
1031 ? s/barfoo
1032 ? s/c.c
1032 ? s/c.c
1033 ? s/cpp.cpp
1033 ? s/cpp.cpp
1034 ? s/foobar.orig
1034 ? s/foobar.orig
1035 I s/snake.python
1035 I s/snake.python
1036 C s/f
1036 C s/f
1037 C s/foobar
1037 C s/foobar
1038 C s/g
1038 C s/g
1039 $ hg add --subrepos "glob:**.python"
1039 $ hg add --subrepos "glob:**.python"
1040 $ hg st --subrepos s
1040 $ hg st --subrepos s
1041 A s/.gitignore
1041 A s/.gitignore
1042 ? s/barfoo
1042 ? s/barfoo
1043 ? s/c.c
1043 ? s/c.c
1044 ? s/cpp.cpp
1044 ? s/cpp.cpp
1045 ? s/foobar.orig
1045 ? s/foobar.orig
1046 $ hg add --subrepos s/snake.python
1046 $ hg add --subrepos s/snake.python
1047 $ hg st --subrepos s
1047 $ hg st --subrepos s
1048 A s/.gitignore
1048 A s/.gitignore
1049 A s/snake.python
1049 A s/snake.python
1050 ? s/barfoo
1050 ? s/barfoo
1051 ? s/c.c
1051 ? s/c.c
1052 ? s/cpp.cpp
1052 ? s/cpp.cpp
1053 ? s/foobar.orig
1053 ? s/foobar.orig
1054
1054
1055 correctly do a dry run
1055 correctly do a dry run
1056 $ hg add --subrepos s --dry-run
1056 $ hg add --subrepos s --dry-run
1057 adding s/barfoo (glob)
1057 adding s/barfoo (glob)
1058 adding s/c.c (glob)
1058 adding s/c.c (glob)
1059 adding s/cpp.cpp (glob)
1059 adding s/cpp.cpp (glob)
1060 adding s/foobar.orig (glob)
1060 adding s/foobar.orig (glob)
1061 $ hg st --subrepos s
1061 $ hg st --subrepos s
1062 A s/.gitignore
1062 A s/.gitignore
1063 A s/snake.python
1063 A s/snake.python
1064 ? s/barfoo
1064 ? s/barfoo
1065 ? s/c.c
1065 ? s/c.c
1066 ? s/cpp.cpp
1066 ? s/cpp.cpp
1067 ? s/foobar.orig
1067 ? s/foobar.orig
1068
1068
1069 error given when adding an already tracked file
1069 error given when adding an already tracked file
1070 $ hg add s/.gitignore
1070 $ hg add s/.gitignore
1071 s/.gitignore already tracked!
1071 s/.gitignore already tracked!
1072 [1]
1072 [1]
1073 $ hg add s/g
1073 $ hg add s/g
1074 s/g already tracked!
1074 s/g already tracked!
1075 [1]
1075 [1]
1076
1076
1077 removed files can be re-added
1077 removed files can be re-added
1078 removing files using 'rm' or 'git rm' has the same effect,
1078 removing files using 'rm' or 'git rm' has the same effect,
1079 since we ignore the staging area
1079 since we ignore the staging area
1080 $ hg ci --subrepos -m 'snake'
1080 $ hg ci --subrepos -m 'snake'
1081 committing subrepository s
1081 committing subrepository s
1082 $ cd s
1082 $ cd s
1083 $ rm snake.python
1083 $ rm snake.python
1084 (remove leftover .hg so Mercurial doesn't look for a root here)
1084 (remove leftover .hg so Mercurial doesn't look for a root here)
1085 $ rm -rf .hg
1085 $ rm -rf .hg
1086 $ hg status --subrepos --all .
1086 $ hg status --subrepos --all .
1087 R snake.python
1087 R snake.python
1088 ? barfoo
1088 ? barfoo
1089 ? c.c
1089 ? c.c
1090 ? cpp.cpp
1090 ? cpp.cpp
1091 ? foobar.orig
1091 ? foobar.orig
1092 C .gitignore
1092 C .gitignore
1093 C f
1093 C f
1094 C foobar
1094 C foobar
1095 C g
1095 C g
1096 $ git rm snake.python
1096 $ git rm snake.python
1097 rm 'snake.python'
1097 rm 'snake.python'
1098 $ hg status --subrepos --all .
1098 $ hg status --subrepos --all .
1099 R snake.python
1099 R snake.python
1100 ? barfoo
1100 ? barfoo
1101 ? c.c
1101 ? c.c
1102 ? cpp.cpp
1102 ? cpp.cpp
1103 ? foobar.orig
1103 ? foobar.orig
1104 C .gitignore
1104 C .gitignore
1105 C f
1105 C f
1106 C foobar
1106 C foobar
1107 C g
1107 C g
1108 $ touch snake.python
1108 $ touch snake.python
1109 $ cd ..
1109 $ cd ..
1110 $ hg add s/snake.python
1110 $ hg add s/snake.python
1111 $ hg status -S
1111 $ hg status -S
1112 M s/snake.python
1112 M s/snake.python
1113 ? .hgignore
1113 ? .hgignore
1114 ? s/barfoo
1114 ? s/barfoo
1115 ? s/c.c
1115 ? s/c.c
1116 ? s/cpp.cpp
1116 ? s/cpp.cpp
1117 ? s/foobar.orig
1117 ? s/foobar.orig
1118 $ hg revert --all -q
1118 $ hg revert --all -q
1119
1119
1120 make sure we show changed files, rather than changed subtrees
1120 make sure we show changed files, rather than changed subtrees
1121 $ mkdir s/foo
1121 $ mkdir s/foo
1122 $ touch s/foo/bwuh
1122 $ touch s/foo/bwuh
1123 $ hg add s/foo/bwuh
1123 $ hg add s/foo/bwuh
1124 $ hg commit -S -m "add bwuh"
1124 $ hg commit -S -m "add bwuh"
1125 committing subrepository s
1125 committing subrepository s
1126 $ hg status -S --change .
1126 $ hg status -S --change .
1127 M .hgsubstate
1127 M .hgsubstate
1128 A s/foo/bwuh
1128 A s/foo/bwuh
1129 ? s/barfoo
1129 ? s/barfoo
1130 ? s/c.c
1130 ? s/c.c
1131 ? s/cpp.cpp
1131 ? s/cpp.cpp
1132 ? s/foobar.orig
1132 ? s/foobar.orig
1133 ? s/snake.python.orig
1133 ? s/snake.python.orig
1134
1134
1135 test for Git CVE-2016-3068
1135 test for Git CVE-2016-3068
1136 $ hg init malicious-subrepository
1136 $ hg init malicious-subrepository
1137 $ cd malicious-subrepository
1137 $ cd malicious-subrepository
1138 $ echo "s = [git]ext::sh -c echo% pwned% >&2" > .hgsub
1138 $ echo "s = [git]ext::sh -c echo% pwned% >pwned.txt" > .hgsub
1139 $ git init s
1139 $ git init s
1140 Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
1140 Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
1141 $ cd s
1141 $ cd s
1142 $ git commit --allow-empty -m 'empty'
1142 $ git commit --allow-empty -m 'empty'
1143 [master (root-commit) 153f934] empty
1143 [master (root-commit) 153f934] empty
1144 $ cd ..
1144 $ cd ..
1145 $ hg add .hgsub
1145 $ hg add .hgsub
1146 $ hg commit -m "add subrepo"
1146 $ hg commit -m "add subrepo"
1147 $ cd ..
1147 $ cd ..
1148 $ rm -f pwned.txt
1148 $ env -u GIT_ALLOW_PROTOCOL hg clone malicious-subrepository malicious-subrepository-protected
1149 $ env -u GIT_ALLOW_PROTOCOL hg clone malicious-subrepository malicious-subrepository-protected
1149 Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
1150 Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
1150 fatal: transport 'ext' not allowed
1151 fatal: transport 'ext' not allowed
1151 updating to branch default
1152 updating to branch default
1152 cloning subrepo s from ext::sh -c echo% pwned% >&2
1153 cloning subrepo s from ext::sh -c echo% pwned% >pwned.txt
1153 abort: git clone error 128 in s (in subrepo s)
1154 abort: git clone error 128 in s (in subrepo s)
1154 [255]
1155 [255]
1156 $ test -f pwned.txt && cat pwned.txt || true
1155
1157
1156 whitelisting of ext should be respected (that's the git submodule behaviour)
1158 whitelisting of ext should be respected (that's the git submodule behaviour)
1159 $ rm -f pwned.txt
1157 $ env GIT_ALLOW_PROTOCOL=ext hg clone malicious-subrepository malicious-subrepository-clone-allowed
1160 $ env GIT_ALLOW_PROTOCOL=ext hg clone malicious-subrepository malicious-subrepository-clone-allowed
1158 Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
1161 Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
1159 pwned
1160 fatal: Could not read from remote repository.
1162 fatal: Could not read from remote repository.
1161
1163
1162 Please make sure you have the correct access rights
1164 Please make sure you have the correct access rights
1163 and the repository exists.
1165 and the repository exists.
1164 updating to branch default
1166 updating to branch default
1165 cloning subrepo s from ext::sh -c echo% pwned% >&2
1167 cloning subrepo s from ext::sh -c echo% pwned% >pwned.txt
1166 abort: git clone error 128 in s (in subrepo s)
1168 abort: git clone error 128 in s (in subrepo s)
1167 [255]
1169 [255]
1170 $ cat pwned.txt
1171 pwned
General Comments 0
You need to be logged in to leave comments. Login now