##// END OF EJS Templates
rhg-cat: fallback in presence of a fileset...
Raphaël Gomès -
r48888:4a6fa6b6 default
parent child Browse files
Show More
@@ -1,88 +1,93
1 use crate::error::CommandError;
1 use crate::error::CommandError;
2 use clap::Arg;
2 use clap::Arg;
3 use format_bytes::format_bytes;
3 use format_bytes::format_bytes;
4 use hg::operations::cat;
4 use hg::operations::cat;
5 use hg::utils::hg_path::HgPathBuf;
5 use hg::utils::hg_path::HgPathBuf;
6 use micro_timer::timed;
6 use micro_timer::timed;
7 use std::convert::TryFrom;
7 use std::convert::TryFrom;
8
8
9 pub const HELP_TEXT: &str = "
9 pub const HELP_TEXT: &str = "
10 Output the current or given revision of files
10 Output the current or given revision of files
11 ";
11 ";
12
12
13 pub fn args() -> clap::App<'static, 'static> {
13 pub fn args() -> clap::App<'static, 'static> {
14 clap::SubCommand::with_name("cat")
14 clap::SubCommand::with_name("cat")
15 .arg(
15 .arg(
16 Arg::with_name("rev")
16 Arg::with_name("rev")
17 .help("search the repository as it is in REV")
17 .help("search the repository as it is in REV")
18 .short("-r")
18 .short("-r")
19 .long("--revision")
19 .long("--revision")
20 .value_name("REV")
20 .value_name("REV")
21 .takes_value(true),
21 .takes_value(true),
22 )
22 )
23 .arg(
23 .arg(
24 clap::Arg::with_name("files")
24 clap::Arg::with_name("files")
25 .required(true)
25 .required(true)
26 .multiple(true)
26 .multiple(true)
27 .empty_values(false)
27 .empty_values(false)
28 .value_name("FILE")
28 .value_name("FILE")
29 .help("Activity to start: activity@category"),
29 .help("Activity to start: activity@category"),
30 )
30 )
31 .about(HELP_TEXT)
31 .about(HELP_TEXT)
32 }
32 }
33
33
34 #[timed]
34 #[timed]
35 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
35 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
36 let rev = invocation.subcommand_args.value_of("rev");
36 let rev = invocation.subcommand_args.value_of("rev");
37 let file_args = match invocation.subcommand_args.values_of("files") {
37 let file_args = match invocation.subcommand_args.values_of("files") {
38 Some(files) => files.collect(),
38 Some(files) => files.collect(),
39 None => vec![],
39 None => vec![],
40 };
40 };
41
41
42 let repo = invocation.repo?;
42 let repo = invocation.repo?;
43 let cwd = hg::utils::current_dir()?;
43 let cwd = hg::utils::current_dir()?;
44 let working_directory = repo.working_directory_path();
44 let working_directory = repo.working_directory_path();
45 let working_directory = cwd.join(working_directory); // Make it absolute
45 let working_directory = cwd.join(working_directory); // Make it absolute
46
46
47 let mut files = vec![];
47 let mut files = vec![];
48 for file in file_args.iter() {
48 for file in file_args.iter() {
49 if file.starts_with("set:") {
50 let message = "fileset";
51 return Err(CommandError::unsupported(message));
52 }
53
49 let normalized = cwd.join(&file);
54 let normalized = cwd.join(&file);
50 // TODO: actually normalize `..` path segments etc?
55 // TODO: actually normalize `..` path segments etc?
51 let dotted = normalized.components().any(|c| c.as_os_str() == "..");
56 let dotted = normalized.components().any(|c| c.as_os_str() == "..");
52 if file == &"." || dotted {
57 if file == &"." || dotted {
53 let message = "`..` or `.` path segment";
58 let message = "`..` or `.` path segment";
54 return Err(CommandError::unsupported(message));
59 return Err(CommandError::unsupported(message));
55 }
60 }
56 let stripped = normalized
61 let stripped = normalized
57 .strip_prefix(&working_directory)
62 .strip_prefix(&working_directory)
58 // TODO: error message for path arguments outside of the repo
63 // TODO: error message for path arguments outside of the repo
59 .map_err(|_| CommandError::abort(""))?;
64 .map_err(|_| CommandError::abort(""))?;
60 let hg_file = HgPathBuf::try_from(stripped.to_path_buf())
65 let hg_file = HgPathBuf::try_from(stripped.to_path_buf())
61 .map_err(|e| CommandError::abort(e.to_string()))?;
66 .map_err(|e| CommandError::abort(e.to_string()))?;
62 files.push(hg_file);
67 files.push(hg_file);
63 }
68 }
64 // TODO probably move this to a util function like `repo.default_rev` or
69 // TODO probably move this to a util function like `repo.default_rev` or
65 // something when it's used somewhere else
70 // something when it's used somewhere else
66 let rev = match rev {
71 let rev = match rev {
67 Some(r) => r.to_string(),
72 Some(r) => r.to_string(),
68 None => format!("{:x}", repo.dirstate_parents()?.p1),
73 None => format!("{:x}", repo.dirstate_parents()?.p1),
69 };
74 };
70
75
71 let output = cat(&repo, &rev, &files).map_err(|e| (e, rev.as_str()))?;
76 let output = cat(&repo, &rev, &files).map_err(|e| (e, rev.as_str()))?;
72 invocation.ui.write_stdout(&output.concatenated)?;
77 invocation.ui.write_stdout(&output.concatenated)?;
73 if !output.missing.is_empty() {
78 if !output.missing.is_empty() {
74 let short = format!("{:x}", output.node.short()).into_bytes();
79 let short = format!("{:x}", output.node.short()).into_bytes();
75 for path in &output.missing {
80 for path in &output.missing {
76 invocation.ui.write_stderr(&format_bytes!(
81 invocation.ui.write_stderr(&format_bytes!(
77 b"{}: no such file in rev {}\n",
82 b"{}: no such file in rev {}\n",
78 path.as_bytes(),
83 path.as_bytes(),
79 short
84 short
80 ))?;
85 ))?;
81 }
86 }
82 }
87 }
83 if output.found_any {
88 if output.found_any {
84 Ok(())
89 Ok(())
85 } else {
90 } else {
86 Err(CommandError::Unsuccessful)
91 Err(CommandError::Unsuccessful)
87 }
92 }
88 }
93 }
@@ -1,348 +1,353
1 #require rhg
1 #require rhg
2
2
3 $ NO_FALLBACK="env RHG_ON_UNSUPPORTED=abort"
3 $ NO_FALLBACK="env RHG_ON_UNSUPPORTED=abort"
4
4
5 Unimplemented command
5 Unimplemented command
6 $ $NO_FALLBACK rhg unimplemented-command
6 $ $NO_FALLBACK rhg unimplemented-command
7 unsupported feature: error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context
7 unsupported feature: error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context
8
8
9 USAGE:
9 USAGE:
10 rhg [OPTIONS] <SUBCOMMAND>
10 rhg [OPTIONS] <SUBCOMMAND>
11
11
12 For more information try --help
12 For more information try --help
13
13
14 [252]
14 [252]
15 $ rhg unimplemented-command --config rhg.on-unsupported=abort-silent
15 $ rhg unimplemented-command --config rhg.on-unsupported=abort-silent
16 [252]
16 [252]
17
17
18 Finding root
18 Finding root
19 $ $NO_FALLBACK rhg root
19 $ $NO_FALLBACK rhg root
20 abort: no repository found in '$TESTTMP' (.hg not found)!
20 abort: no repository found in '$TESTTMP' (.hg not found)!
21 [255]
21 [255]
22
22
23 $ hg init repository
23 $ hg init repository
24 $ cd repository
24 $ cd repository
25 $ $NO_FALLBACK rhg root
25 $ $NO_FALLBACK rhg root
26 $TESTTMP/repository
26 $TESTTMP/repository
27
27
28 Reading and setting configuration
28 Reading and setting configuration
29 $ echo "[ui]" >> $HGRCPATH
29 $ echo "[ui]" >> $HGRCPATH
30 $ echo "username = user1" >> $HGRCPATH
30 $ echo "username = user1" >> $HGRCPATH
31 $ $NO_FALLBACK rhg config ui.username
31 $ $NO_FALLBACK rhg config ui.username
32 user1
32 user1
33 $ echo "[ui]" >> .hg/hgrc
33 $ echo "[ui]" >> .hg/hgrc
34 $ echo "username = user2" >> .hg/hgrc
34 $ echo "username = user2" >> .hg/hgrc
35 $ $NO_FALLBACK rhg config ui.username
35 $ $NO_FALLBACK rhg config ui.username
36 user2
36 user2
37 $ $NO_FALLBACK rhg --config ui.username=user3 config ui.username
37 $ $NO_FALLBACK rhg --config ui.username=user3 config ui.username
38 user3
38 user3
39
39
40 Unwritable file descriptor
40 Unwritable file descriptor
41 $ $NO_FALLBACK rhg root > /dev/full
41 $ $NO_FALLBACK rhg root > /dev/full
42 abort: No space left on device (os error 28)
42 abort: No space left on device (os error 28)
43 [255]
43 [255]
44
44
45 Deleted repository
45 Deleted repository
46 $ rm -rf `pwd`
46 $ rm -rf `pwd`
47 $ $NO_FALLBACK rhg root
47 $ $NO_FALLBACK rhg root
48 abort: error getting current working directory: $ENOENT$
48 abort: error getting current working directory: $ENOENT$
49 [255]
49 [255]
50
50
51 Listing tracked files
51 Listing tracked files
52 $ cd $TESTTMP
52 $ cd $TESTTMP
53 $ hg init repository
53 $ hg init repository
54 $ cd repository
54 $ cd repository
55 $ for i in 1 2 3; do
55 $ for i in 1 2 3; do
56 > echo $i >> file$i
56 > echo $i >> file$i
57 > hg add file$i
57 > hg add file$i
58 > done
58 > done
59 > hg commit -m "commit $i" -q
59 > hg commit -m "commit $i" -q
60
60
61 Listing tracked files from root
61 Listing tracked files from root
62 $ $NO_FALLBACK rhg files
62 $ $NO_FALLBACK rhg files
63 file1
63 file1
64 file2
64 file2
65 file3
65 file3
66
66
67 Listing tracked files from subdirectory
67 Listing tracked files from subdirectory
68 $ mkdir -p path/to/directory
68 $ mkdir -p path/to/directory
69 $ cd path/to/directory
69 $ cd path/to/directory
70 $ $NO_FALLBACK rhg files
70 $ $NO_FALLBACK rhg files
71 ../../../file1
71 ../../../file1
72 ../../../file2
72 ../../../file2
73 ../../../file3
73 ../../../file3
74
74
75 Listing tracked files through broken pipe
75 Listing tracked files through broken pipe
76 $ $NO_FALLBACK rhg files | head -n 1
76 $ $NO_FALLBACK rhg files | head -n 1
77 ../../../file1
77 ../../../file1
78
78
79 Debuging data in inline index
79 Debuging data in inline index
80 $ cd $TESTTMP
80 $ cd $TESTTMP
81 $ rm -rf repository
81 $ rm -rf repository
82 $ hg init repository
82 $ hg init repository
83 $ cd repository
83 $ cd repository
84 $ for i in 1 2 3 4 5 6; do
84 $ for i in 1 2 3 4 5 6; do
85 > echo $i >> file-$i
85 > echo $i >> file-$i
86 > hg add file-$i
86 > hg add file-$i
87 > hg commit -m "Commit $i" -q
87 > hg commit -m "Commit $i" -q
88 > done
88 > done
89 $ $NO_FALLBACK rhg debugdata -c 2
89 $ $NO_FALLBACK rhg debugdata -c 2
90 8d0267cb034247ebfa5ee58ce59e22e57a492297
90 8d0267cb034247ebfa5ee58ce59e22e57a492297
91 test
91 test
92 0 0
92 0 0
93 file-3
93 file-3
94
94
95 Commit 3 (no-eol)
95 Commit 3 (no-eol)
96 $ $NO_FALLBACK rhg debugdata -m 2
96 $ $NO_FALLBACK rhg debugdata -m 2
97 file-1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
97 file-1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
98 file-2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc)
98 file-2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc)
99 file-3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc)
99 file-3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc)
100
100
101 Debuging with full node id
101 Debuging with full node id
102 $ $NO_FALLBACK rhg debugdata -c `hg log -r 0 -T '{node}'`
102 $ $NO_FALLBACK rhg debugdata -c `hg log -r 0 -T '{node}'`
103 d1d1c679d3053e8926061b6f45ca52009f011e3f
103 d1d1c679d3053e8926061b6f45ca52009f011e3f
104 test
104 test
105 0 0
105 0 0
106 file-1
106 file-1
107
107
108 Commit 1 (no-eol)
108 Commit 1 (no-eol)
109
109
110 Specifying revisions by changeset ID
110 Specifying revisions by changeset ID
111 $ hg log -T '{node}\n'
111 $ hg log -T '{node}\n'
112 c6ad58c44207b6ff8a4fbbca7045a5edaa7e908b
112 c6ad58c44207b6ff8a4fbbca7045a5edaa7e908b
113 d654274993d0149eecc3cc03214f598320211900
113 d654274993d0149eecc3cc03214f598320211900
114 f646af7e96481d3a5470b695cf30ad8e3ab6c575
114 f646af7e96481d3a5470b695cf30ad8e3ab6c575
115 cf8b83f14ead62b374b6e91a0e9303b85dfd9ed7
115 cf8b83f14ead62b374b6e91a0e9303b85dfd9ed7
116 91c6f6e73e39318534dc415ea4e8a09c99cd74d6
116 91c6f6e73e39318534dc415ea4e8a09c99cd74d6
117 6ae9681c6d30389694d8701faf24b583cf3ccafe
117 6ae9681c6d30389694d8701faf24b583cf3ccafe
118 $ $NO_FALLBACK rhg files -r cf8b83
118 $ $NO_FALLBACK rhg files -r cf8b83
119 file-1
119 file-1
120 file-2
120 file-2
121 file-3
121 file-3
122 $ $NO_FALLBACK rhg cat -r cf8b83 file-2
122 $ $NO_FALLBACK rhg cat -r cf8b83 file-2
123 2
123 2
124 $ $NO_FALLBACK rhg cat -r c file-2
124 $ $NO_FALLBACK rhg cat -r c file-2
125 abort: ambiguous revision identifier: c
125 abort: ambiguous revision identifier: c
126 [255]
126 [255]
127 $ $NO_FALLBACK rhg cat -r d file-2
127 $ $NO_FALLBACK rhg cat -r d file-2
128 2
128 2
129 $ $NO_FALLBACK rhg cat -r 0000 file-2
129 $ $NO_FALLBACK rhg cat -r 0000 file-2
130 abort: invalid revision identifier: 0000
130 abort: invalid revision identifier: 0000
131 [255]
131 [255]
132
132
133 Cat files
133 Cat files
134 $ cd $TESTTMP
134 $ cd $TESTTMP
135 $ rm -rf repository
135 $ rm -rf repository
136 $ hg init repository
136 $ hg init repository
137 $ cd repository
137 $ cd repository
138 $ echo "original content" > original
138 $ echo "original content" > original
139 $ hg add original
139 $ hg add original
140 $ hg commit -m "add original" original
140 $ hg commit -m "add original" original
141 Without `--rev`
141 Without `--rev`
142 $ $NO_FALLBACK rhg cat original
142 $ $NO_FALLBACK rhg cat original
143 original content
143 original content
144 With `--rev`
144 With `--rev`
145 $ $NO_FALLBACK rhg cat -r 0 original
145 $ $NO_FALLBACK rhg cat -r 0 original
146 original content
146 original content
147 Cat copied file should not display copy metadata
147 Cat copied file should not display copy metadata
148 $ hg copy original copy_of_original
148 $ hg copy original copy_of_original
149 $ hg commit -m "add copy of original"
149 $ hg commit -m "add copy of original"
150 $ $NO_FALLBACK rhg cat original
150 $ $NO_FALLBACK rhg cat original
151 original content
151 original content
152 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
152 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
153 original content
153 original content
154
154
155
155
156 Fallback to Python
156 Fallback to Python
157 $ $NO_FALLBACK rhg cat original --exclude="*.rs"
157 $ $NO_FALLBACK rhg cat original --exclude="*.rs"
158 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
158 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
159
159
160 USAGE:
160 USAGE:
161 rhg cat [OPTIONS] <FILE>...
161 rhg cat [OPTIONS] <FILE>...
162
162
163 For more information try --help
163 For more information try --help
164
164
165 [252]
165 [252]
166 $ rhg cat original --exclude="*.rs"
166 $ rhg cat original --exclude="*.rs"
167 original content
167 original content
168
168
169 $ FALLBACK_EXE="$RHG_FALLBACK_EXECUTABLE"
169 $ FALLBACK_EXE="$RHG_FALLBACK_EXECUTABLE"
170 $ unset RHG_FALLBACK_EXECUTABLE
170 $ unset RHG_FALLBACK_EXECUTABLE
171 $ rhg cat original --exclude="*.rs"
171 $ rhg cat original --exclude="*.rs"
172 abort: 'rhg.on-unsupported=fallback' without 'rhg.fallback-executable' set.
172 abort: 'rhg.on-unsupported=fallback' without 'rhg.fallback-executable' set.
173 [255]
173 [255]
174 $ RHG_FALLBACK_EXECUTABLE="$FALLBACK_EXE"
174 $ RHG_FALLBACK_EXECUTABLE="$FALLBACK_EXE"
175 $ export RHG_FALLBACK_EXECUTABLE
175 $ export RHG_FALLBACK_EXECUTABLE
176
176
177 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=false
177 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=false
178 [1]
178 [1]
179
179
180 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=hg-non-existent
180 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=hg-non-existent
181 tried to fall back to a 'hg-non-existent' sub-process but got error $ENOENT$
181 tried to fall back to a 'hg-non-existent' sub-process but got error $ENOENT$
182 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
182 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
183
183
184 USAGE:
184 USAGE:
185 rhg cat [OPTIONS] <FILE>...
185 rhg cat [OPTIONS] <FILE>...
186
186
187 For more information try --help
187 For more information try --help
188
188
189 [252]
189 [252]
190
190
191 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=rhg
191 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=rhg
192 Blocking recursive fallback. The 'rhg.fallback-executable = rhg' config points to `rhg` itself.
192 Blocking recursive fallback. The 'rhg.fallback-executable = rhg' config points to `rhg` itself.
193 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
193 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
194
194
195 USAGE:
195 USAGE:
196 rhg cat [OPTIONS] <FILE>...
196 rhg cat [OPTIONS] <FILE>...
197
197
198 For more information try --help
198 For more information try --help
199
199
200 [252]
200 [252]
201
201
202 Fallback with shell path segments
202 Fallback with shell path segments
203 $ $NO_FALLBACK rhg cat .
203 $ $NO_FALLBACK rhg cat .
204 unsupported feature: `..` or `.` path segment
204 unsupported feature: `..` or `.` path segment
205 [252]
205 [252]
206 $ $NO_FALLBACK rhg cat ..
206 $ $NO_FALLBACK rhg cat ..
207 unsupported feature: `..` or `.` path segment
207 unsupported feature: `..` or `.` path segment
208 [252]
208 [252]
209 $ $NO_FALLBACK rhg cat ../..
209 $ $NO_FALLBACK rhg cat ../..
210 unsupported feature: `..` or `.` path segment
210 unsupported feature: `..` or `.` path segment
211 [252]
211 [252]
212
212
213 Fallback with filesets
214 $ $NO_FALLBACK rhg cat "set:c or b"
215 unsupported feature: fileset
216 [252]
217
213 Requirements
218 Requirements
214 $ $NO_FALLBACK rhg debugrequirements
219 $ $NO_FALLBACK rhg debugrequirements
215 dotencode
220 dotencode
216 fncache
221 fncache
217 generaldelta
222 generaldelta
218 persistent-nodemap
223 persistent-nodemap
219 revlog-compression-zstd (zstd !)
224 revlog-compression-zstd (zstd !)
220 revlogv1
225 revlogv1
221 sparserevlog
226 sparserevlog
222 store
227 store
223
228
224 $ echo indoor-pool >> .hg/requires
229 $ echo indoor-pool >> .hg/requires
225 $ $NO_FALLBACK rhg files
230 $ $NO_FALLBACK rhg files
226 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
231 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
227 [252]
232 [252]
228
233
229 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
234 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
230 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
235 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
231 [252]
236 [252]
232
237
233 $ $NO_FALLBACK rhg debugrequirements
238 $ $NO_FALLBACK rhg debugrequirements
234 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
239 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
235 [252]
240 [252]
236
241
237 $ echo -e '\xFF' >> .hg/requires
242 $ echo -e '\xFF' >> .hg/requires
238 $ $NO_FALLBACK rhg debugrequirements
243 $ $NO_FALLBACK rhg debugrequirements
239 abort: parse error in 'requires' file
244 abort: parse error in 'requires' file
240 [255]
245 [255]
241
246
242 Persistent nodemap
247 Persistent nodemap
243 $ cd $TESTTMP
248 $ cd $TESTTMP
244 $ rm -rf repository
249 $ rm -rf repository
245 $ hg --config format.use-persistent-nodemap=no init repository
250 $ hg --config format.use-persistent-nodemap=no init repository
246 $ cd repository
251 $ cd repository
247 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
252 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
248 [1]
253 [1]
249 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
254 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
250 $ hg id -r tip
255 $ hg id -r tip
251 c3ae8dec9fad tip
256 c3ae8dec9fad tip
252 $ ls .hg/store/00changelog*
257 $ ls .hg/store/00changelog*
253 .hg/store/00changelog.d
258 .hg/store/00changelog.d
254 .hg/store/00changelog.i
259 .hg/store/00changelog.i
255 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
260 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
256 of
261 of
257
262
258 $ cd $TESTTMP
263 $ cd $TESTTMP
259 $ rm -rf repository
264 $ rm -rf repository
260 $ hg --config format.use-persistent-nodemap=True init repository
265 $ hg --config format.use-persistent-nodemap=True init repository
261 $ cd repository
266 $ cd repository
262 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
267 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
263 persistent-nodemap
268 persistent-nodemap
264 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
269 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
265 $ hg id -r tip
270 $ hg id -r tip
266 c3ae8dec9fad tip
271 c3ae8dec9fad tip
267 $ ls .hg/store/00changelog*
272 $ ls .hg/store/00changelog*
268 .hg/store/00changelog-*.nd (glob)
273 .hg/store/00changelog-*.nd (glob)
269 .hg/store/00changelog.d
274 .hg/store/00changelog.d
270 .hg/store/00changelog.i
275 .hg/store/00changelog.i
271 .hg/store/00changelog.n
276 .hg/store/00changelog.n
272
277
273 Specifying revisions by changeset ID
278 Specifying revisions by changeset ID
274 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
279 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
275 of
280 of
276 $ $NO_FALLBACK rhg cat -r c3ae8dec9fad of
281 $ $NO_FALLBACK rhg cat -r c3ae8dec9fad of
277 r5000
282 r5000
278
283
279 Crate a shared repository
284 Crate a shared repository
280
285
281 $ echo "[extensions]" >> $HGRCPATH
286 $ echo "[extensions]" >> $HGRCPATH
282 $ echo "share = " >> $HGRCPATH
287 $ echo "share = " >> $HGRCPATH
283
288
284 $ cd $TESTTMP
289 $ cd $TESTTMP
285 $ hg init repo1
290 $ hg init repo1
286 $ echo a > repo1/a
291 $ echo a > repo1/a
287 $ hg -R repo1 commit -A -m'init'
292 $ hg -R repo1 commit -A -m'init'
288 adding a
293 adding a
289
294
290 $ hg share repo1 repo2
295 $ hg share repo1 repo2
291 updating working directory
296 updating working directory
292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
297 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
293
298
294 And check that basic rhg commands work with sharing
299 And check that basic rhg commands work with sharing
295
300
296 $ $NO_FALLBACK rhg files -R repo2
301 $ $NO_FALLBACK rhg files -R repo2
297 repo2/a
302 repo2/a
298 $ $NO_FALLBACK rhg -R repo2 cat -r 0 repo2/a
303 $ $NO_FALLBACK rhg -R repo2 cat -r 0 repo2/a
299 a
304 a
300
305
301 Same with relative sharing
306 Same with relative sharing
302
307
303 $ hg share repo2 repo3 --relative
308 $ hg share repo2 repo3 --relative
304 updating working directory
309 updating working directory
305 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
310 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
306
311
307 $ $NO_FALLBACK rhg files -R repo3
312 $ $NO_FALLBACK rhg files -R repo3
308 repo3/a
313 repo3/a
309 $ $NO_FALLBACK rhg -R repo3 cat -r 0 repo3/a
314 $ $NO_FALLBACK rhg -R repo3 cat -r 0 repo3/a
310 a
315 a
311
316
312 Same with share-safe
317 Same with share-safe
313
318
314 $ echo "[format]" >> $HGRCPATH
319 $ echo "[format]" >> $HGRCPATH
315 $ echo "use-share-safe = True" >> $HGRCPATH
320 $ echo "use-share-safe = True" >> $HGRCPATH
316
321
317 $ cd $TESTTMP
322 $ cd $TESTTMP
318 $ hg init repo4
323 $ hg init repo4
319 $ cd repo4
324 $ cd repo4
320 $ echo a > a
325 $ echo a > a
321 $ hg commit -A -m'init'
326 $ hg commit -A -m'init'
322 adding a
327 adding a
323
328
324 $ cd ..
329 $ cd ..
325 $ hg share repo4 repo5
330 $ hg share repo4 repo5
326 updating working directory
331 updating working directory
327 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
328
333
329 And check that basic rhg commands work with sharing
334 And check that basic rhg commands work with sharing
330
335
331 $ cd repo5
336 $ cd repo5
332 $ $NO_FALLBACK rhg files
337 $ $NO_FALLBACK rhg files
333 a
338 a
334 $ $NO_FALLBACK rhg cat -r 0 a
339 $ $NO_FALLBACK rhg cat -r 0 a
335 a
340 a
336
341
337 The blackbox extension is supported
342 The blackbox extension is supported
338
343
339 $ echo "[extensions]" >> $HGRCPATH
344 $ echo "[extensions]" >> $HGRCPATH
340 $ echo "blackbox =" >> $HGRCPATH
345 $ echo "blackbox =" >> $HGRCPATH
341 $ echo "[blackbox]" >> $HGRCPATH
346 $ echo "[blackbox]" >> $HGRCPATH
342 $ echo "maxsize = 1" >> $HGRCPATH
347 $ echo "maxsize = 1" >> $HGRCPATH
343 $ $NO_FALLBACK rhg files > /dev/null
348 $ $NO_FALLBACK rhg files > /dev/null
344 $ cat .hg/blackbox.log
349 $ cat .hg/blackbox.log
345 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
350 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
346 $ cat .hg/blackbox.log.1
351 $ cat .hg/blackbox.log.1
347 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files (glob)
352 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files (glob)
348
353
General Comments 0
You need to be logged in to leave comments. Login now