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