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