##// END OF EJS Templates
commands: pass include and exclude options to hg.clone()...
Gregory Szorc -
r39588:4c807ec0 default
parent child Browse files
Show More
@@ -43,6 +43,7 b' from . import ('
43 43 hg,
44 44 logcmdutil,
45 45 merge as mergemod,
46 narrowspec,
46 47 obsolete,
47 48 obsutil,
48 49 patch,
@@ -1466,13 +1467,29 b' def clone(ui, source, dest=None, **opts)'
1466 1467 if opts.get('noupdate') and opts.get('updaterev'):
1467 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 1484 r = hg.clone(ui, opts, source, dest,
1470 1485 pull=opts.get('pull'),
1471 1486 stream=opts.get('stream') or opts.get('uncompressed'),
1472 1487 revs=opts.get('rev'),
1473 1488 update=opts.get('updaterev') or not opts.get('noupdate'),
1474 1489 branch=opts.get('branch'),
1475 shareopts=opts.get('shareopts'))
1490 shareopts=opts.get('shareopts'),
1491 storeincludepats=includepats,
1492 storeexcludepats=excludepats)
1476 1493
1477 1494 return r is None
1478 1495
@@ -19,13 +19,11 b''
19 19 Only path: and rootfilesin: pattern prefixes are allowed
20 20
21 21 $ hg clone --narrow ssh://user@dummy/master badnarrow --noupdate --include 'glob:**'
22 requesting all changes
23 22 abort: invalid prefix on narrow pattern: glob:**
24 23 (narrow patterns must begin with one of the following: path:, rootfilesin:)
25 24 [255]
26 25
27 26 $ hg clone --narrow ssh://user@dummy/master badnarrow --noupdate --exclude 'set:ignored'
28 requesting all changes
29 27 abort: invalid prefix on narrow pattern: set:ignored
30 28 (narrow patterns must begin with one of the following: path:, rootfilesin:)
31 29 [255]
@@ -67,7 +65,6 b' narrow clone with a newline should fail'
67 65
68 66 $ hg clone --narrow ssh://user@dummy/master narrow_fail --noupdate --include 'dir/src/f10
69 67 > '
70 requesting all changes
71 68 abort: newlines are not allowed in narrowspec paths
72 69 [255]
73 70
@@ -38,15 +38,12 b''
38 38
39 39 Error if '.' or '..' are in the directory to track.
40 40 $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf
41 requesting all changes
42 41 abort: "." and ".." are not allowed in narrowspec paths
43 42 [255]
44 43 $ hg clone --narrow ssh://user@dummy/master foo --include asdf/..
45 requesting all changes
46 44 abort: "." and ".." are not allowed in narrowspec paths
47 45 [255]
48 46 $ hg clone --narrow ssh://user@dummy/master foo --include a/./c
49 requesting all changes
50 47 abort: "." and ".." are not allowed in narrowspec paths
51 48 [255]
52 49
General Comments 0
You need to be logged in to leave comments. Login now