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