Show More
@@ -1,111 +1,111 b'' | |||||
1 | use std::path::Path; |
|
1 | use std::path::Path; | |
2 |
|
2 | |||
3 | use crate::{ |
|
3 | use crate::{ | |
4 | errors::HgError, |
|
4 | errors::HgError, | |
5 | exit_codes, |
|
5 | exit_codes, | |
6 | filepatterns::parse_pattern_file_contents, |
|
6 | filepatterns::parse_pattern_file_contents, | |
7 | matchers::{ |
|
7 | matchers::{ | |
8 | AlwaysMatcher, DifferenceMatcher, IncludeMatcher, Matcher, |
|
8 | AlwaysMatcher, DifferenceMatcher, IncludeMatcher, Matcher, | |
9 | NeverMatcher, |
|
9 | NeverMatcher, | |
10 | }, |
|
10 | }, | |
11 | repo::Repo, |
|
11 | repo::Repo, | |
12 | requirements::NARROW_REQUIREMENT, |
|
12 | requirements::NARROW_REQUIREMENT, | |
13 | sparse::{self, SparseConfigError, SparseWarning}, |
|
13 | sparse::{self, SparseConfigError, SparseWarning}, | |
14 | }; |
|
14 | }; | |
15 |
|
15 | |||
16 | /// The file in .hg/store/ that indicates which paths exit in the store |
|
16 | /// The file in .hg/store/ that indicates which paths exit in the store | |
17 | const FILENAME: &str = "narrowspec"; |
|
17 | const FILENAME: &str = "narrowspec"; | |
18 | /// The file in .hg/ that indicates which paths exit in the dirstate |
|
18 | /// The file in .hg/ that indicates which paths exit in the dirstate | |
19 | const DIRSTATE_FILENAME: &str = "narrowspec.dirstate"; |
|
19 | const DIRSTATE_FILENAME: &str = "narrowspec.dirstate"; | |
20 |
|
20 | |||
21 | /// Pattern prefixes that are allowed in narrow patterns. This list MUST |
|
21 | /// Pattern prefixes that are allowed in narrow patterns. This list MUST | |
22 | /// only contain patterns that are fast and safe to evaluate. Keep in mind |
|
22 | /// only contain patterns that are fast and safe to evaluate. Keep in mind | |
23 | /// that patterns are supplied by clients and executed on remote servers |
|
23 | /// that patterns are supplied by clients and executed on remote servers | |
24 | /// as part of wire protocol commands. That means that changes to this |
|
24 | /// as part of wire protocol commands. That means that changes to this | |
25 | /// data structure influence the wire protocol and should not be taken |
|
25 | /// data structure influence the wire protocol and should not be taken | |
26 | /// lightly - especially removals. |
|
26 | /// lightly - especially removals. | |
27 | const VALID_PREFIXES: [&str; 2] = ["path:", "rootfilesin:"]; |
|
27 | const VALID_PREFIXES: [&str; 2] = ["path:", "rootfilesin:"]; | |
28 |
|
28 | |||
29 | /// Return the matcher for the current narrow spec, and all configuration |
|
29 | /// Return the matcher for the current narrow spec, and all configuration | |
30 | /// warnings to display. |
|
30 | /// warnings to display. | |
31 | pub fn matcher( |
|
31 | pub fn matcher( | |
32 | repo: &Repo, |
|
32 | repo: &Repo, | |
33 | ) -> Result<(Box<dyn Matcher + Sync>, Vec<SparseWarning>), SparseConfigError> { |
|
33 | ) -> Result<(Box<dyn Matcher + Sync>, Vec<SparseWarning>), SparseConfigError> { | |
34 | let mut warnings = vec![]; |
|
34 | let mut warnings = vec![]; | |
35 | if !repo.requirements().contains(NARROW_REQUIREMENT) { |
|
35 | if !repo.requirements().contains(NARROW_REQUIREMENT) { | |
36 | return Ok((Box::new(AlwaysMatcher), warnings)); |
|
36 | return Ok((Box::new(AlwaysMatcher), warnings)); | |
37 | } |
|
37 | } | |
38 | // Treat "narrowspec does not exist" the same as "narrowspec file exists |
|
38 | // Treat "narrowspec does not exist" the same as "narrowspec file exists | |
39 | // and is empty". |
|
39 | // and is empty". | |
40 | let store_spec = repo.store_vfs().try_read(FILENAME)?.unwrap_or(vec![]); |
|
40 | let store_spec = repo.store_vfs().try_read(FILENAME)?.unwrap_or(vec![]); | |
41 | let working_copy_spec = |
|
41 | let working_copy_spec = | |
42 | repo.hg_vfs().try_read(DIRSTATE_FILENAME)?.unwrap_or(vec![]); |
|
42 | repo.hg_vfs().try_read(DIRSTATE_FILENAME)?.unwrap_or(vec![]); | |
43 | if store_spec != working_copy_spec { |
|
43 | if store_spec != working_copy_spec { | |
44 | return Err(HgError::abort( |
|
44 | return Err(HgError::abort( | |
45 | "working copy's narrowspec is stale", |
|
45 | "working copy's narrowspec is stale", | |
46 | exit_codes::STATE_ERROR, |
|
46 | exit_codes::STATE_ERROR, | |
47 | Some("run 'hg tracked --update-working-copy'".into()), |
|
47 | Some("run 'hg tracked --update-working-copy'".into()), | |
48 | ) |
|
48 | ) | |
49 | .into()); |
|
49 | .into()); | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 | let config = sparse::parse_config( |
|
52 | let config = sparse::parse_config( | |
53 | &store_spec, |
|
53 | &store_spec, | |
54 | sparse::SparseConfigContext::Narrow, |
|
54 | sparse::SparseConfigContext::Narrow, | |
55 | )?; |
|
55 | )?; | |
56 |
|
56 | |||
57 | warnings.extend(config.warnings); |
|
57 | warnings.extend(config.warnings); | |
58 |
|
58 | |||
59 | if !config.profiles.is_empty() { |
|
59 | if !config.profiles.is_empty() { | |
60 | // TODO (from Python impl) maybe do something with profiles? |
|
60 | // TODO (from Python impl) maybe do something with profiles? | |
61 | return Err(SparseConfigError::IncludesInNarrow); |
|
61 | return Err(SparseConfigError::IncludesInNarrow); | |
62 | } |
|
62 | } | |
63 | validate_patterns(&config.includes)?; |
|
63 | validate_patterns(&config.includes)?; | |
64 | validate_patterns(&config.excludes)?; |
|
64 | validate_patterns(&config.excludes)?; | |
65 |
|
65 | |||
66 | if config.includes.is_empty() { |
|
66 | if config.includes.is_empty() { | |
67 | return Ok((Box::new(NeverMatcher), warnings)); |
|
67 | return Ok((Box::new(NeverMatcher), warnings)); | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | let (patterns, subwarnings) = parse_pattern_file_contents( |
|
70 | let (patterns, subwarnings) = parse_pattern_file_contents( | |
71 | &config.includes, |
|
71 | &config.includes, | |
72 | Path::new(""), |
|
72 | Path::new(""), | |
73 | None, |
|
73 | None, | |
74 | false, |
|
74 | false, | |
75 | )?; |
|
75 | )?; | |
76 | warnings.extend(subwarnings.into_iter().map(From::from)); |
|
76 | warnings.extend(subwarnings.into_iter().map(From::from)); | |
77 |
|
77 | |||
78 | let mut m: Box<dyn Matcher + Sync> = |
|
78 | let mut m: Box<dyn Matcher + Sync> = | |
79 | Box::new(IncludeMatcher::new(patterns)?); |
|
79 | Box::new(IncludeMatcher::new(patterns)?); | |
80 |
|
80 | |||
81 | let (patterns, subwarnings) = parse_pattern_file_contents( |
|
81 | let (patterns, subwarnings) = parse_pattern_file_contents( | |
82 | &config.excludes, |
|
82 | &config.excludes, | |
83 | Path::new(""), |
|
83 | Path::new(""), | |
84 | None, |
|
84 | None, | |
85 | false, |
|
85 | false, | |
86 | )?; |
|
86 | )?; | |
87 | if !patterns.is_empty() { |
|
87 | if !patterns.is_empty() { | |
88 | warnings.extend(subwarnings.into_iter().map(From::from)); |
|
88 | warnings.extend(subwarnings.into_iter().map(From::from)); | |
89 | let exclude_matcher = Box::new(IncludeMatcher::new(patterns)?); |
|
89 | let exclude_matcher = Box::new(IncludeMatcher::new(patterns)?); | |
90 | m = Box::new(DifferenceMatcher::new(m, exclude_matcher)); |
|
90 | m = Box::new(DifferenceMatcher::new(m, exclude_matcher)); | |
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 | Ok((m, warnings)) |
|
93 | Ok((m, warnings)) | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | fn validate_patterns(patterns: &[u8]) -> Result<(), SparseConfigError> { |
|
96 | fn validate_patterns(patterns: &[u8]) -> Result<(), SparseConfigError> { | |
97 | for pattern in patterns.split(|c| *c == b'\n') { |
|
97 | for pattern in patterns.split(|c| *c == b'\n') { | |
98 | if pattern.is_empty() { |
|
98 | if pattern.is_empty() { | |
99 | continue; |
|
99 | continue; | |
100 | } |
|
100 | } | |
101 | for prefix in VALID_PREFIXES.iter() { |
|
101 | for prefix in VALID_PREFIXES.iter() { | |
102 | if pattern.starts_with(prefix.as_bytes()) { |
|
102 | if pattern.starts_with(prefix.as_bytes()) { | |
103 |
|
|
103 | return Ok(()); | |
|
104 | } | |||
104 |
|
|
105 | } | |
105 |
|
|
106 | return Err(SparseConfigError::InvalidNarrowPrefix( | |
106 |
|
|
107 | pattern.to_owned(), | |
107 |
|
|
108 | )); | |
108 |
|
|
109 | } | |
109 | } |
|
|||
110 | Ok(()) |
|
110 | Ok(()) | |
111 | } |
|
111 | } |
@@ -1,299 +1,311 b'' | |||||
1 | $ . "$TESTDIR/narrow-library.sh" |
|
1 | $ . "$TESTDIR/narrow-library.sh" | |
2 |
|
2 | |||
3 | $ hg init master |
|
3 | $ hg init master | |
4 | $ cd master |
|
4 | $ cd master | |
5 | $ cat >> .hg/hgrc <<EOF |
|
5 | $ cat >> .hg/hgrc <<EOF | |
6 | > [narrow] |
|
6 | > [narrow] | |
7 | > serveellipses=True |
|
7 | > serveellipses=True | |
8 | > EOF |
|
8 | > EOF | |
9 | $ mkdir dir |
|
9 | $ mkdir dir | |
10 | $ mkdir dir/src |
|
10 | $ mkdir dir/src | |
11 | $ cd dir/src |
|
11 | $ cd dir/src | |
12 | $ for x in `$TESTDIR/seq.py 20`; do echo $x > "f$x"; hg add "f$x"; hg commit -m "Commit src $x"; done |
|
12 | $ for x in `$TESTDIR/seq.py 20`; do echo $x > "f$x"; hg add "f$x"; hg commit -m "Commit src $x"; done | |
13 | $ cd .. |
|
13 | $ cd .. | |
14 | $ mkdir tests |
|
14 | $ mkdir tests | |
15 | $ cd tests |
|
15 | $ cd tests | |
16 | $ for x in `$TESTDIR/seq.py 20`; do echo $x > "t$x"; hg add "t$x"; hg commit -m "Commit test $x"; done |
|
16 | $ for x in `$TESTDIR/seq.py 20`; do echo $x > "t$x"; hg add "t$x"; hg commit -m "Commit test $x"; done | |
17 | $ cd ../../.. |
|
17 | $ cd ../../.. | |
18 |
|
18 | |||
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 | abort: invalid prefix on narrow pattern: glob:** |
|
22 | abort: invalid prefix on narrow pattern: glob:** | |
23 | (narrow patterns must begin with one of the following: path:, rootfilesin:) |
|
23 | (narrow patterns must begin with one of the following: path:, rootfilesin:) | |
24 | [255] |
|
24 | [255] | |
25 |
|
25 | |||
26 | $ 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' | |
27 | abort: invalid prefix on narrow pattern: set:ignored |
|
27 | abort: invalid prefix on narrow pattern: set:ignored | |
28 | (narrow patterns must begin with one of the following: path:, rootfilesin:) |
|
28 | (narrow patterns must begin with one of the following: path:, rootfilesin:) | |
29 | [255] |
|
29 | [255] | |
30 |
|
30 | |||
|
31 | rootfilesin: patterns work | |||
|
32 | ||||
|
33 | $ hg clone --narrow ssh://user@dummy/master rootfilesin --noupdate --include 'rootfilesin:dir' | |||
|
34 | requesting all changes | |||
|
35 | adding changesets | |||
|
36 | adding manifests | |||
|
37 | adding file changes | |||
|
38 | added 1 changesets with 0 changes to 0 files | |||
|
39 | new changesets 26ce255d5b5d | |||
|
40 | $ hg tracked -R rootfilesin | |||
|
41 | I rootfilesin:dir | |||
|
42 | ||||
31 | narrow clone a file, f10 |
|
43 | narrow clone a file, f10 | |
32 |
|
44 | |||
33 | $ hg clone --narrow ssh://user@dummy/master narrow --noupdate --include "dir/src/f10" |
|
45 | $ hg clone --narrow ssh://user@dummy/master narrow --noupdate --include "dir/src/f10" | |
34 | requesting all changes |
|
46 | requesting all changes | |
35 | adding changesets |
|
47 | adding changesets | |
36 | adding manifests |
|
48 | adding manifests | |
37 | adding file changes |
|
49 | adding file changes | |
38 | added 3 changesets with 1 changes to 1 files |
|
50 | added 3 changesets with 1 changes to 1 files | |
39 | new changesets *:* (glob) |
|
51 | new changesets *:* (glob) | |
40 | $ cd narrow |
|
52 | $ cd narrow | |
41 | $ hg debugrequires | grep -v generaldelta |
|
53 | $ hg debugrequires | grep -v generaldelta | |
42 | dotencode |
|
54 | dotencode | |
43 | dirstate-v2 (dirstate-v2 !) |
|
55 | dirstate-v2 (dirstate-v2 !) | |
44 | fncache |
|
56 | fncache | |
45 | narrowhg-experimental |
|
57 | narrowhg-experimental | |
46 | persistent-nodemap (rust !) |
|
58 | persistent-nodemap (rust !) | |
47 | revlog-compression-zstd (zstd !) |
|
59 | revlog-compression-zstd (zstd !) | |
48 | revlogv1 |
|
60 | revlogv1 | |
49 | share-safe |
|
61 | share-safe | |
50 | sparserevlog |
|
62 | sparserevlog | |
51 | store |
|
63 | store | |
52 | testonly-simplestore (reposimplestore !) |
|
64 | testonly-simplestore (reposimplestore !) | |
53 |
|
65 | |||
54 | $ hg tracked |
|
66 | $ hg tracked | |
55 | I path:dir/src/f10 |
|
67 | I path:dir/src/f10 | |
56 | $ hg tracked |
|
68 | $ hg tracked | |
57 | I path:dir/src/f10 |
|
69 | I path:dir/src/f10 | |
58 | $ hg update |
|
70 | $ hg update | |
59 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
71 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
60 | $ find * | sort |
|
72 | $ find * | sort | |
61 | dir |
|
73 | dir | |
62 | dir/src |
|
74 | dir/src | |
63 | dir/src/f10 |
|
75 | dir/src/f10 | |
64 | $ cat dir/src/f10 |
|
76 | $ cat dir/src/f10 | |
65 | 10 |
|
77 | 10 | |
66 |
|
78 | |||
67 | $ cd .. |
|
79 | $ cd .. | |
68 |
|
80 | |||
69 | local-to-local narrow clones work |
|
81 | local-to-local narrow clones work | |
70 |
|
82 | |||
71 | $ hg clone --narrow master narrow-via-localpeer --noupdate --include "dir/src/f10" |
|
83 | $ hg clone --narrow master narrow-via-localpeer --noupdate --include "dir/src/f10" | |
72 | requesting all changes |
|
84 | requesting all changes | |
73 | adding changesets |
|
85 | adding changesets | |
74 | adding manifests |
|
86 | adding manifests | |
75 | adding file changes |
|
87 | adding file changes | |
76 | added 3 changesets with 1 changes to 1 files |
|
88 | added 3 changesets with 1 changes to 1 files | |
77 | new changesets 5d21aaea77f8:26ce255d5b5d |
|
89 | new changesets 5d21aaea77f8:26ce255d5b5d | |
78 | $ hg tracked -R narrow-via-localpeer |
|
90 | $ hg tracked -R narrow-via-localpeer | |
79 | I path:dir/src/f10 |
|
91 | I path:dir/src/f10 | |
80 | $ rm -Rf narrow-via-localpeer |
|
92 | $ rm -Rf narrow-via-localpeer | |
81 |
|
93 | |||
82 | narrow clone with a newline should fail |
|
94 | narrow clone with a newline should fail | |
83 |
|
95 | |||
84 | $ hg clone --narrow ssh://user@dummy/master narrow_fail --noupdate --include 'dir/src/f10 |
|
96 | $ hg clone --narrow ssh://user@dummy/master narrow_fail --noupdate --include 'dir/src/f10 | |
85 | > ' |
|
97 | > ' | |
86 | abort: newlines are not allowed in narrowspec paths |
|
98 | abort: newlines are not allowed in narrowspec paths | |
87 | [255] |
|
99 | [255] | |
88 |
|
100 | |||
89 | narrow clone a directory, tests/, except tests/t19 |
|
101 | narrow clone a directory, tests/, except tests/t19 | |
90 |
|
102 | |||
91 | $ hg clone --narrow ssh://user@dummy/master narrowdir --noupdate --include "dir/tests/" --exclude "dir/tests/t19" |
|
103 | $ hg clone --narrow ssh://user@dummy/master narrowdir --noupdate --include "dir/tests/" --exclude "dir/tests/t19" | |
92 | requesting all changes |
|
104 | requesting all changes | |
93 | adding changesets |
|
105 | adding changesets | |
94 | adding manifests |
|
106 | adding manifests | |
95 | adding file changes |
|
107 | adding file changes | |
96 | added 21 changesets with 19 changes to 19 files |
|
108 | added 21 changesets with 19 changes to 19 files | |
97 | new changesets *:* (glob) |
|
109 | new changesets *:* (glob) | |
98 | $ cd narrowdir |
|
110 | $ cd narrowdir | |
99 | $ hg tracked |
|
111 | $ hg tracked | |
100 | I path:dir/tests |
|
112 | I path:dir/tests | |
101 | X path:dir/tests/t19 |
|
113 | X path:dir/tests/t19 | |
102 | $ hg tracked |
|
114 | $ hg tracked | |
103 | I path:dir/tests |
|
115 | I path:dir/tests | |
104 | X path:dir/tests/t19 |
|
116 | X path:dir/tests/t19 | |
105 | $ hg update |
|
117 | $ hg update | |
106 | 19 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
118 | 19 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
107 | $ find * | sort |
|
119 | $ find * | sort | |
108 | dir |
|
120 | dir | |
109 | dir/tests |
|
121 | dir/tests | |
110 | dir/tests/t1 |
|
122 | dir/tests/t1 | |
111 | dir/tests/t10 |
|
123 | dir/tests/t10 | |
112 | dir/tests/t11 |
|
124 | dir/tests/t11 | |
113 | dir/tests/t12 |
|
125 | dir/tests/t12 | |
114 | dir/tests/t13 |
|
126 | dir/tests/t13 | |
115 | dir/tests/t14 |
|
127 | dir/tests/t14 | |
116 | dir/tests/t15 |
|
128 | dir/tests/t15 | |
117 | dir/tests/t16 |
|
129 | dir/tests/t16 | |
118 | dir/tests/t17 |
|
130 | dir/tests/t17 | |
119 | dir/tests/t18 |
|
131 | dir/tests/t18 | |
120 | dir/tests/t2 |
|
132 | dir/tests/t2 | |
121 | dir/tests/t20 |
|
133 | dir/tests/t20 | |
122 | dir/tests/t3 |
|
134 | dir/tests/t3 | |
123 | dir/tests/t4 |
|
135 | dir/tests/t4 | |
124 | dir/tests/t5 |
|
136 | dir/tests/t5 | |
125 | dir/tests/t6 |
|
137 | dir/tests/t6 | |
126 | dir/tests/t7 |
|
138 | dir/tests/t7 | |
127 | dir/tests/t8 |
|
139 | dir/tests/t8 | |
128 | dir/tests/t9 |
|
140 | dir/tests/t9 | |
129 |
|
141 | |||
130 | $ cd .. |
|
142 | $ cd .. | |
131 |
|
143 | |||
132 | narrow clone everything but a directory (tests/) |
|
144 | narrow clone everything but a directory (tests/) | |
133 |
|
145 | |||
134 | $ hg clone --narrow ssh://user@dummy/master narrowroot --noupdate --exclude "dir/tests" |
|
146 | $ hg clone --narrow ssh://user@dummy/master narrowroot --noupdate --exclude "dir/tests" | |
135 | requesting all changes |
|
147 | requesting all changes | |
136 | adding changesets |
|
148 | adding changesets | |
137 | adding manifests |
|
149 | adding manifests | |
138 | adding file changes |
|
150 | adding file changes | |
139 | added 21 changesets with 20 changes to 20 files |
|
151 | added 21 changesets with 20 changes to 20 files | |
140 | new changesets *:* (glob) |
|
152 | new changesets *:* (glob) | |
141 | $ cd narrowroot |
|
153 | $ cd narrowroot | |
142 | $ hg tracked |
|
154 | $ hg tracked | |
143 | I path:. |
|
155 | I path:. | |
144 | X path:dir/tests |
|
156 | X path:dir/tests | |
145 | $ hg tracked |
|
157 | $ hg tracked | |
146 | I path:. |
|
158 | I path:. | |
147 | X path:dir/tests |
|
159 | X path:dir/tests | |
148 | $ hg update |
|
160 | $ hg update | |
149 | 20 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
161 | 20 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
150 | $ find * | sort |
|
162 | $ find * | sort | |
151 | dir |
|
163 | dir | |
152 | dir/src |
|
164 | dir/src | |
153 | dir/src/f1 |
|
165 | dir/src/f1 | |
154 | dir/src/f10 |
|
166 | dir/src/f10 | |
155 | dir/src/f11 |
|
167 | dir/src/f11 | |
156 | dir/src/f12 |
|
168 | dir/src/f12 | |
157 | dir/src/f13 |
|
169 | dir/src/f13 | |
158 | dir/src/f14 |
|
170 | dir/src/f14 | |
159 | dir/src/f15 |
|
171 | dir/src/f15 | |
160 | dir/src/f16 |
|
172 | dir/src/f16 | |
161 | dir/src/f17 |
|
173 | dir/src/f17 | |
162 | dir/src/f18 |
|
174 | dir/src/f18 | |
163 | dir/src/f19 |
|
175 | dir/src/f19 | |
164 | dir/src/f2 |
|
176 | dir/src/f2 | |
165 | dir/src/f20 |
|
177 | dir/src/f20 | |
166 | dir/src/f3 |
|
178 | dir/src/f3 | |
167 | dir/src/f4 |
|
179 | dir/src/f4 | |
168 | dir/src/f5 |
|
180 | dir/src/f5 | |
169 | dir/src/f6 |
|
181 | dir/src/f6 | |
170 | dir/src/f7 |
|
182 | dir/src/f7 | |
171 | dir/src/f8 |
|
183 | dir/src/f8 | |
172 | dir/src/f9 |
|
184 | dir/src/f9 | |
173 |
|
185 | |||
174 | $ cd .. |
|
186 | $ cd .. | |
175 |
|
187 | |||
176 | narrow clone no paths at all |
|
188 | narrow clone no paths at all | |
177 |
|
189 | |||
178 | $ hg clone --narrow ssh://user@dummy/master narrowempty --noupdate |
|
190 | $ hg clone --narrow ssh://user@dummy/master narrowempty --noupdate | |
179 | requesting all changes |
|
191 | requesting all changes | |
180 | adding changesets |
|
192 | adding changesets | |
181 | adding manifests |
|
193 | adding manifests | |
182 | adding file changes |
|
194 | adding file changes | |
183 | added 1 changesets with 0 changes to 0 files |
|
195 | added 1 changesets with 0 changes to 0 files | |
184 | new changesets * (glob) |
|
196 | new changesets * (glob) | |
185 | $ cd narrowempty |
|
197 | $ cd narrowempty | |
186 | $ hg tracked |
|
198 | $ hg tracked | |
187 | $ hg update |
|
199 | $ hg update | |
188 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
200 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
189 | $ ls -A |
|
201 | $ ls -A | |
190 | .hg |
|
202 | .hg | |
191 |
|
203 | |||
192 | $ cd .. |
|
204 | $ cd .. | |
193 |
|
205 | |||
194 | simple clone |
|
206 | simple clone | |
195 | $ hg clone ssh://user@dummy/master simpleclone |
|
207 | $ hg clone ssh://user@dummy/master simpleclone | |
196 | requesting all changes |
|
208 | requesting all changes | |
197 | adding changesets |
|
209 | adding changesets | |
198 | adding manifests |
|
210 | adding manifests | |
199 | adding file changes |
|
211 | adding file changes | |
200 | added 40 changesets with 40 changes to 40 files |
|
212 | added 40 changesets with 40 changes to 40 files | |
201 | new changesets * (glob) |
|
213 | new changesets * (glob) | |
202 | updating to branch default |
|
214 | updating to branch default | |
203 | 40 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
215 | 40 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
204 | $ cd simpleclone |
|
216 | $ cd simpleclone | |
205 | $ find * | sort |
|
217 | $ find * | sort | |
206 | dir |
|
218 | dir | |
207 | dir/src |
|
219 | dir/src | |
208 | dir/src/f1 |
|
220 | dir/src/f1 | |
209 | dir/src/f10 |
|
221 | dir/src/f10 | |
210 | dir/src/f11 |
|
222 | dir/src/f11 | |
211 | dir/src/f12 |
|
223 | dir/src/f12 | |
212 | dir/src/f13 |
|
224 | dir/src/f13 | |
213 | dir/src/f14 |
|
225 | dir/src/f14 | |
214 | dir/src/f15 |
|
226 | dir/src/f15 | |
215 | dir/src/f16 |
|
227 | dir/src/f16 | |
216 | dir/src/f17 |
|
228 | dir/src/f17 | |
217 | dir/src/f18 |
|
229 | dir/src/f18 | |
218 | dir/src/f19 |
|
230 | dir/src/f19 | |
219 | dir/src/f2 |
|
231 | dir/src/f2 | |
220 | dir/src/f20 |
|
232 | dir/src/f20 | |
221 | dir/src/f3 |
|
233 | dir/src/f3 | |
222 | dir/src/f4 |
|
234 | dir/src/f4 | |
223 | dir/src/f5 |
|
235 | dir/src/f5 | |
224 | dir/src/f6 |
|
236 | dir/src/f6 | |
225 | dir/src/f7 |
|
237 | dir/src/f7 | |
226 | dir/src/f8 |
|
238 | dir/src/f8 | |
227 | dir/src/f9 |
|
239 | dir/src/f9 | |
228 | dir/tests |
|
240 | dir/tests | |
229 | dir/tests/t1 |
|
241 | dir/tests/t1 | |
230 | dir/tests/t10 |
|
242 | dir/tests/t10 | |
231 | dir/tests/t11 |
|
243 | dir/tests/t11 | |
232 | dir/tests/t12 |
|
244 | dir/tests/t12 | |
233 | dir/tests/t13 |
|
245 | dir/tests/t13 | |
234 | dir/tests/t14 |
|
246 | dir/tests/t14 | |
235 | dir/tests/t15 |
|
247 | dir/tests/t15 | |
236 | dir/tests/t16 |
|
248 | dir/tests/t16 | |
237 | dir/tests/t17 |
|
249 | dir/tests/t17 | |
238 | dir/tests/t18 |
|
250 | dir/tests/t18 | |
239 | dir/tests/t19 |
|
251 | dir/tests/t19 | |
240 | dir/tests/t2 |
|
252 | dir/tests/t2 | |
241 | dir/tests/t20 |
|
253 | dir/tests/t20 | |
242 | dir/tests/t3 |
|
254 | dir/tests/t3 | |
243 | dir/tests/t4 |
|
255 | dir/tests/t4 | |
244 | dir/tests/t5 |
|
256 | dir/tests/t5 | |
245 | dir/tests/t6 |
|
257 | dir/tests/t6 | |
246 | dir/tests/t7 |
|
258 | dir/tests/t7 | |
247 | dir/tests/t8 |
|
259 | dir/tests/t8 | |
248 | dir/tests/t9 |
|
260 | dir/tests/t9 | |
249 |
|
261 | |||
250 | $ cd .. |
|
262 | $ cd .. | |
251 |
|
263 | |||
252 | Testing the --narrowspec flag to clone |
|
264 | Testing the --narrowspec flag to clone | |
253 |
|
265 | |||
254 | $ cat >> narrowspecs <<EOF |
|
266 | $ cat >> narrowspecs <<EOF | |
255 | > %include foo |
|
267 | > %include foo | |
256 | > [include] |
|
268 | > [include] | |
257 | > path:dir/tests/ |
|
269 | > path:dir/tests/ | |
258 | > path:dir/src/f12 |
|
270 | > path:dir/src/f12 | |
259 | > EOF |
|
271 | > EOF | |
260 |
|
272 | |||
261 | $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs |
|
273 | $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs | |
262 | reading narrowspec from '$TESTTMP/narrowspecs' |
|
274 | reading narrowspec from '$TESTTMP/narrowspecs' | |
263 | config error: cannot specify other files using '%include' in narrowspec |
|
275 | config error: cannot specify other files using '%include' in narrowspec | |
264 | [30] |
|
276 | [30] | |
265 |
|
277 | |||
266 | $ cat > narrowspecs <<EOF |
|
278 | $ cat > narrowspecs <<EOF | |
267 | > [include] |
|
279 | > [include] | |
268 | > path:dir/tests/ |
|
280 | > path:dir/tests/ | |
269 | > path:dir/src/f12 |
|
281 | > path:dir/src/f12 | |
270 | > EOF |
|
282 | > EOF | |
271 |
|
283 | |||
272 | $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs |
|
284 | $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs | |
273 | reading narrowspec from '$TESTTMP/narrowspecs' |
|
285 | reading narrowspec from '$TESTTMP/narrowspecs' | |
274 | requesting all changes |
|
286 | requesting all changes | |
275 | adding changesets |
|
287 | adding changesets | |
276 | adding manifests |
|
288 | adding manifests | |
277 | adding file changes |
|
289 | adding file changes | |
278 | added 23 changesets with 21 changes to 21 files |
|
290 | added 23 changesets with 21 changes to 21 files | |
279 | new changesets c13e3773edb4:26ce255d5b5d |
|
291 | new changesets c13e3773edb4:26ce255d5b5d | |
280 | updating to branch default |
|
292 | updating to branch default | |
281 | 21 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
293 | 21 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
282 | $ cd specfile |
|
294 | $ cd specfile | |
283 | $ hg tracked |
|
295 | $ hg tracked | |
284 | I path:dir/src/f12 |
|
296 | I path:dir/src/f12 | |
285 | I path:dir/tests |
|
297 | I path:dir/tests | |
286 | $ cd .. |
|
298 | $ cd .. | |
287 |
|
299 | |||
288 | Narrow spec with invalid patterns is rejected |
|
300 | Narrow spec with invalid patterns is rejected | |
289 |
|
301 | |||
290 | $ cat > narrowspecs <<EOF |
|
302 | $ cat > narrowspecs <<EOF | |
291 | > [include] |
|
303 | > [include] | |
292 | > glob:** |
|
304 | > glob:** | |
293 | > EOF |
|
305 | > EOF | |
294 |
|
306 | |||
295 | $ hg clone ssh://user@dummy/master badspecfile --narrowspec narrowspecs |
|
307 | $ hg clone ssh://user@dummy/master badspecfile --narrowspec narrowspecs | |
296 | reading narrowspec from '$TESTTMP/narrowspecs' |
|
308 | reading narrowspec from '$TESTTMP/narrowspecs' | |
297 | abort: invalid prefix on narrow pattern: glob:** |
|
309 | abort: invalid prefix on narrow pattern: glob:** | |
298 | (narrow patterns must begin with one of the following: path:, rootfilesin:) |
|
310 | (narrow patterns must begin with one of the following: path:, rootfilesin:) | |
299 | [255] |
|
311 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now