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