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