Show More
@@ -43,6 +43,7 b' from . import (' | |||||
43 | hg, |
|
43 | hg, | |
44 | logcmdutil, |
|
44 | logcmdutil, | |
45 | merge as mergemod, |
|
45 | merge as mergemod, | |
|
46 | narrowspec, | |||
46 | obsolete, |
|
47 | obsolete, | |
47 | obsutil, |
|
48 | obsutil, | |
48 | patch, |
|
49 | patch, | |
@@ -1466,13 +1467,29 b' def clone(ui, source, dest=None, **opts)' | |||||
1466 | if opts.get('noupdate') and opts.get('updaterev'): |
|
1467 | if opts.get('noupdate') and opts.get('updaterev'): | |
1467 | raise error.Abort(_("cannot specify both --noupdate and --updaterev")) |
|
1468 | raise error.Abort(_("cannot specify both --noupdate and --updaterev")) | |
1468 |
|
1469 | |||
|
1470 | # --include/--exclude can come from narrow or sparse. | |||
|
1471 | includepats, excludepats = None, None | |||
|
1472 | ||||
|
1473 | # hg.clone() differentiates between None and an empty set. So make sure | |||
|
1474 | # patterns are sets if narrow is requested without patterns. | |||
|
1475 | if opts.get('narrow'): | |||
|
1476 | includepats = set() | |||
|
1477 | excludepats = set() | |||
|
1478 | ||||
|
1479 | if opts.get('include'): | |||
|
1480 | includepats = narrowspec.parsepatterns(opts.get('include')) | |||
|
1481 | if opts.get('exclude'): | |||
|
1482 | excludepats = narrowspec.parsepatterns(opts.get('exclude')) | |||
|
1483 | ||||
1469 | r = hg.clone(ui, opts, source, dest, |
|
1484 | r = hg.clone(ui, opts, source, dest, | |
1470 | pull=opts.get('pull'), |
|
1485 | pull=opts.get('pull'), | |
1471 | stream=opts.get('stream') or opts.get('uncompressed'), |
|
1486 | stream=opts.get('stream') or opts.get('uncompressed'), | |
1472 | revs=opts.get('rev'), |
|
1487 | revs=opts.get('rev'), | |
1473 | update=opts.get('updaterev') or not opts.get('noupdate'), |
|
1488 | update=opts.get('updaterev') or not opts.get('noupdate'), | |
1474 | branch=opts.get('branch'), |
|
1489 | branch=opts.get('branch'), | |
1475 |
shareopts=opts.get('shareopts') |
|
1490 | shareopts=opts.get('shareopts'), | |
|
1491 | storeincludepats=includepats, | |||
|
1492 | storeexcludepats=excludepats) | |||
1476 |
|
1493 | |||
1477 | return r is None |
|
1494 | return r is None | |
1478 |
|
1495 |
@@ -19,13 +19,11 b'' | |||||
19 | Only path: and rootfilesin: pattern prefixes are allowed |
|
19 | Only path: and rootfilesin: pattern prefixes are allowed | |
20 |
|
20 | |||
21 | $ hg clone --narrow ssh://user@dummy/master badnarrow --noupdate --include 'glob:**' |
|
21 | $ hg clone --narrow ssh://user@dummy/master badnarrow --noupdate --include 'glob:**' | |
22 | requesting all changes |
|
|||
23 | abort: invalid prefix on narrow pattern: glob:** |
|
22 | abort: invalid prefix on narrow pattern: glob:** | |
24 | (narrow patterns must begin with one of the following: path:, rootfilesin:) |
|
23 | (narrow patterns must begin with one of the following: path:, rootfilesin:) | |
25 | [255] |
|
24 | [255] | |
26 |
|
25 | |||
27 | $ hg clone --narrow ssh://user@dummy/master badnarrow --noupdate --exclude 'set:ignored' |
|
26 | $ hg clone --narrow ssh://user@dummy/master badnarrow --noupdate --exclude 'set:ignored' | |
28 | requesting all changes |
|
|||
29 | abort: invalid prefix on narrow pattern: set:ignored |
|
27 | abort: invalid prefix on narrow pattern: set:ignored | |
30 | (narrow patterns must begin with one of the following: path:, rootfilesin:) |
|
28 | (narrow patterns must begin with one of the following: path:, rootfilesin:) | |
31 | [255] |
|
29 | [255] | |
@@ -67,7 +65,6 b' narrow clone with a newline should fail' | |||||
67 |
|
65 | |||
68 | $ hg clone --narrow ssh://user@dummy/master narrow_fail --noupdate --include 'dir/src/f10 |
|
66 | $ hg clone --narrow ssh://user@dummy/master narrow_fail --noupdate --include 'dir/src/f10 | |
69 | > ' |
|
67 | > ' | |
70 | requesting all changes |
|
|||
71 | abort: newlines are not allowed in narrowspec paths |
|
68 | abort: newlines are not allowed in narrowspec paths | |
72 | [255] |
|
69 | [255] | |
73 |
|
70 |
@@ -38,15 +38,12 b'' | |||||
38 |
|
38 | |||
39 | Error if '.' or '..' are in the directory to track. |
|
39 | Error if '.' or '..' are in the directory to track. | |
40 | $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf |
|
40 | $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf | |
41 | requesting all changes |
|
|||
42 | abort: "." and ".." are not allowed in narrowspec paths |
|
41 | abort: "." and ".." are not allowed in narrowspec paths | |
43 | [255] |
|
42 | [255] | |
44 | $ hg clone --narrow ssh://user@dummy/master foo --include asdf/.. |
|
43 | $ hg clone --narrow ssh://user@dummy/master foo --include asdf/.. | |
45 | requesting all changes |
|
|||
46 | abort: "." and ".." are not allowed in narrowspec paths |
|
44 | abort: "." and ".." are not allowed in narrowspec paths | |
47 | [255] |
|
45 | [255] | |
48 | $ hg clone --narrow ssh://user@dummy/master foo --include a/./c |
|
46 | $ hg clone --narrow ssh://user@dummy/master foo --include a/./c | |
49 | requesting all changes |
|
|||
50 | abort: "." and ".." are not allowed in narrowspec paths |
|
47 | abort: "." and ".." are not allowed in narrowspec paths | |
51 | [255] |
|
48 | [255] | |
52 |
|
49 |
General Comments 0
You need to be logged in to leave comments.
Login now