##// END OF EJS Templates
rhg: in rhg cat cli, fix the long name of the --rev flag...
Arseniy Alekseyev -
r48986:08c8cd25 default
parent child Browse files
Show More
@@ -1,93 +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("--rev")
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("Files to output"),
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:") {
49 if file.starts_with("set:") {
50 let message = "fileset";
50 let message = "fileset";
51 return Err(CommandError::unsupported(message));
51 return Err(CommandError::unsupported(message));
52 }
52 }
53
53
54 let normalized = cwd.join(&file);
54 let normalized = cwd.join(&file);
55 // TODO: actually normalize `..` path segments etc?
55 // TODO: actually normalize `..` path segments etc?
56 let dotted = normalized.components().any(|c| c.as_os_str() == "..");
56 let dotted = normalized.components().any(|c| c.as_os_str() == "..");
57 if file == &"." || dotted {
57 if file == &"." || dotted {
58 let message = "`..` or `.` path segment";
58 let message = "`..` or `.` path segment";
59 return Err(CommandError::unsupported(message));
59 return Err(CommandError::unsupported(message));
60 }
60 }
61 let stripped = normalized
61 let stripped = normalized
62 .strip_prefix(&working_directory)
62 .strip_prefix(&working_directory)
63 // TODO: error message for path arguments outside of the repo
63 // TODO: error message for path arguments outside of the repo
64 .map_err(|_| CommandError::abort(""))?;
64 .map_err(|_| CommandError::abort(""))?;
65 let hg_file = HgPathBuf::try_from(stripped.to_path_buf())
65 let hg_file = HgPathBuf::try_from(stripped.to_path_buf())
66 .map_err(|e| CommandError::abort(e.to_string()))?;
66 .map_err(|e| CommandError::abort(e.to_string()))?;
67 files.push(hg_file);
67 files.push(hg_file);
68 }
68 }
69 // 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
70 // something when it's used somewhere else
70 // something when it's used somewhere else
71 let rev = match rev {
71 let rev = match rev {
72 Some(r) => r.to_string(),
72 Some(r) => r.to_string(),
73 None => format!("{:x}", repo.dirstate_parents()?.p1),
73 None => format!("{:x}", repo.dirstate_parents()?.p1),
74 };
74 };
75
75
76 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()))?;
77 invocation.ui.write_stdout(&output.concatenated)?;
77 invocation.ui.write_stdout(&output.concatenated)?;
78 if !output.missing.is_empty() {
78 if !output.missing.is_empty() {
79 let short = format!("{:x}", output.node.short()).into_bytes();
79 let short = format!("{:x}", output.node.short()).into_bytes();
80 for path in &output.missing {
80 for path in &output.missing {
81 invocation.ui.write_stderr(&format_bytes!(
81 invocation.ui.write_stderr(&format_bytes!(
82 b"{}: no such file in rev {}\n",
82 b"{}: no such file in rev {}\n",
83 path.as_bytes(),
83 path.as_bytes(),
84 short
84 short
85 ))?;
85 ))?;
86 }
86 }
87 }
87 }
88 if output.found_any {
88 if output.found_any {
89 Ok(())
89 Ok(())
90 } else {
90 } else {
91 Err(CommandError::Unsuccessful)
91 Err(CommandError::Unsuccessful)
92 }
92 }
93 }
93 }
@@ -1,381 +1,383
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 --rev cf8b83 file-2
125 2
124 $ $NO_FALLBACK rhg cat -r c file-2
126 $ $NO_FALLBACK rhg cat -r c file-2
125 abort: ambiguous revision identifier: c
127 abort: ambiguous revision identifier: c
126 [255]
128 [255]
127 $ $NO_FALLBACK rhg cat -r d file-2
129 $ $NO_FALLBACK rhg cat -r d file-2
128 2
130 2
129 $ $NO_FALLBACK rhg cat -r 0000 file-2
131 $ $NO_FALLBACK rhg cat -r 0000 file-2
130 abort: invalid revision identifier: 0000
132 abort: invalid revision identifier: 0000
131 [255]
133 [255]
132
134
133 Cat files
135 Cat files
134 $ cd $TESTTMP
136 $ cd $TESTTMP
135 $ rm -rf repository
137 $ rm -rf repository
136 $ hg init repository
138 $ hg init repository
137 $ cd repository
139 $ cd repository
138 $ echo "original content" > original
140 $ echo "original content" > original
139 $ hg add original
141 $ hg add original
140 $ hg commit -m "add original" original
142 $ hg commit -m "add original" original
141 Without `--rev`
143 Without `--rev`
142 $ $NO_FALLBACK rhg cat original
144 $ $NO_FALLBACK rhg cat original
143 original content
145 original content
144 With `--rev`
146 With `--rev`
145 $ $NO_FALLBACK rhg cat -r 0 original
147 $ $NO_FALLBACK rhg cat -r 0 original
146 original content
148 original content
147 Cat copied file should not display copy metadata
149 Cat copied file should not display copy metadata
148 $ hg copy original copy_of_original
150 $ hg copy original copy_of_original
149 $ hg commit -m "add copy of original"
151 $ hg commit -m "add copy of original"
150 $ $NO_FALLBACK rhg cat original
152 $ $NO_FALLBACK rhg cat original
151 original content
153 original content
152 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
154 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
153 original content
155 original content
154
156
155
157
156 Fallback to Python
158 Fallback to Python
157 $ $NO_FALLBACK rhg cat original --exclude="*.rs"
159 $ $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
160 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
159
161
160 USAGE:
162 USAGE:
161 rhg cat [OPTIONS] <FILE>...
163 rhg cat [OPTIONS] <FILE>...
162
164
163 For more information try --help
165 For more information try --help
164
166
165 [252]
167 [252]
166 $ rhg cat original --exclude="*.rs"
168 $ rhg cat original --exclude="*.rs"
167 original content
169 original content
168
170
169 $ FALLBACK_EXE="$RHG_FALLBACK_EXECUTABLE"
171 $ FALLBACK_EXE="$RHG_FALLBACK_EXECUTABLE"
170 $ unset RHG_FALLBACK_EXECUTABLE
172 $ unset RHG_FALLBACK_EXECUTABLE
171 $ rhg cat original --exclude="*.rs"
173 $ rhg cat original --exclude="*.rs"
172 abort: 'rhg.on-unsupported=fallback' without 'rhg.fallback-executable' set.
174 abort: 'rhg.on-unsupported=fallback' without 'rhg.fallback-executable' set.
173 [255]
175 [255]
174 $ RHG_FALLBACK_EXECUTABLE="$FALLBACK_EXE"
176 $ RHG_FALLBACK_EXECUTABLE="$FALLBACK_EXE"
175 $ export RHG_FALLBACK_EXECUTABLE
177 $ export RHG_FALLBACK_EXECUTABLE
176
178
177 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=false
179 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=false
178 [1]
180 [1]
179
181
180 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=hg-non-existent
182 $ 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$
183 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
184 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
183
185
184 USAGE:
186 USAGE:
185 rhg cat [OPTIONS] <FILE>...
187 rhg cat [OPTIONS] <FILE>...
186
188
187 For more information try --help
189 For more information try --help
188
190
189 [252]
191 [252]
190
192
191 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=rhg
193 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=rhg
192 Blocking recursive fallback. The 'rhg.fallback-executable = rhg' config points to `rhg` itself.
194 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
195 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
194
196
195 USAGE:
197 USAGE:
196 rhg cat [OPTIONS] <FILE>...
198 rhg cat [OPTIONS] <FILE>...
197
199
198 For more information try --help
200 For more information try --help
199
201
200 [252]
202 [252]
201
203
202 Fallback with shell path segments
204 Fallback with shell path segments
203 $ $NO_FALLBACK rhg cat .
205 $ $NO_FALLBACK rhg cat .
204 unsupported feature: `..` or `.` path segment
206 unsupported feature: `..` or `.` path segment
205 [252]
207 [252]
206 $ $NO_FALLBACK rhg cat ..
208 $ $NO_FALLBACK rhg cat ..
207 unsupported feature: `..` or `.` path segment
209 unsupported feature: `..` or `.` path segment
208 [252]
210 [252]
209 $ $NO_FALLBACK rhg cat ../..
211 $ $NO_FALLBACK rhg cat ../..
210 unsupported feature: `..` or `.` path segment
212 unsupported feature: `..` or `.` path segment
211 [252]
213 [252]
212
214
213 Fallback with filesets
215 Fallback with filesets
214 $ $NO_FALLBACK rhg cat "set:c or b"
216 $ $NO_FALLBACK rhg cat "set:c or b"
215 unsupported feature: fileset
217 unsupported feature: fileset
216 [252]
218 [252]
217
219
218 Fallback with generic hooks
220 Fallback with generic hooks
219 $ $NO_FALLBACK rhg cat original --config hooks.pre-cat=something
221 $ $NO_FALLBACK rhg cat original --config hooks.pre-cat=something
220 unsupported feature: pre-cat hook defined
222 unsupported feature: pre-cat hook defined
221 [252]
223 [252]
222
224
223 $ $NO_FALLBACK rhg cat original --config hooks.post-cat=something
225 $ $NO_FALLBACK rhg cat original --config hooks.post-cat=something
224 unsupported feature: post-cat hook defined
226 unsupported feature: post-cat hook defined
225 [252]
227 [252]
226
228
227 $ $NO_FALLBACK rhg cat original --config hooks.fail-cat=something
229 $ $NO_FALLBACK rhg cat original --config hooks.fail-cat=something
228 unsupported feature: fail-cat hook defined
230 unsupported feature: fail-cat hook defined
229 [252]
231 [252]
230
232
231 Fallback with [defaults]
233 Fallback with [defaults]
232 $ $NO_FALLBACK rhg cat original --config "defaults.cat=-r null"
234 $ $NO_FALLBACK rhg cat original --config "defaults.cat=-r null"
233 unsupported feature: `defaults` config set
235 unsupported feature: `defaults` config set
234 [252]
236 [252]
235
237
236
238
237 Requirements
239 Requirements
238 $ $NO_FALLBACK rhg debugrequirements
240 $ $NO_FALLBACK rhg debugrequirements
239 dotencode
241 dotencode
240 fncache
242 fncache
241 generaldelta
243 generaldelta
242 persistent-nodemap
244 persistent-nodemap
243 revlog-compression-zstd (zstd !)
245 revlog-compression-zstd (zstd !)
244 revlogv1
246 revlogv1
245 sparserevlog
247 sparserevlog
246 store
248 store
247
249
248 $ echo indoor-pool >> .hg/requires
250 $ echo indoor-pool >> .hg/requires
249 $ $NO_FALLBACK rhg files
251 $ $NO_FALLBACK rhg files
250 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
252 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
251 [252]
253 [252]
252
254
253 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
255 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
254 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
256 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
255 [252]
257 [252]
256
258
257 $ $NO_FALLBACK rhg debugrequirements
259 $ $NO_FALLBACK rhg debugrequirements
258 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
260 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
259 [252]
261 [252]
260
262
261 $ echo -e '\xFF' >> .hg/requires
263 $ echo -e '\xFF' >> .hg/requires
262 $ $NO_FALLBACK rhg debugrequirements
264 $ $NO_FALLBACK rhg debugrequirements
263 abort: parse error in 'requires' file
265 abort: parse error in 'requires' file
264 [255]
266 [255]
265
267
266 Persistent nodemap
268 Persistent nodemap
267 $ cd $TESTTMP
269 $ cd $TESTTMP
268 $ rm -rf repository
270 $ rm -rf repository
269 $ hg --config format.use-persistent-nodemap=no init repository
271 $ hg --config format.use-persistent-nodemap=no init repository
270 $ cd repository
272 $ cd repository
271 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
273 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
272 [1]
274 [1]
273 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
275 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
274 $ hg id -r tip
276 $ hg id -r tip
275 c3ae8dec9fad tip
277 c3ae8dec9fad tip
276 $ ls .hg/store/00changelog*
278 $ ls .hg/store/00changelog*
277 .hg/store/00changelog.d
279 .hg/store/00changelog.d
278 .hg/store/00changelog.i
280 .hg/store/00changelog.i
279 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
281 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
280 of
282 of
281
283
282 $ cd $TESTTMP
284 $ cd $TESTTMP
283 $ rm -rf repository
285 $ rm -rf repository
284 $ hg --config format.use-persistent-nodemap=True init repository
286 $ hg --config format.use-persistent-nodemap=True init repository
285 $ cd repository
287 $ cd repository
286 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
288 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
287 persistent-nodemap
289 persistent-nodemap
288 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
290 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
289 $ hg id -r tip
291 $ hg id -r tip
290 c3ae8dec9fad tip
292 c3ae8dec9fad tip
291 $ ls .hg/store/00changelog*
293 $ ls .hg/store/00changelog*
292 .hg/store/00changelog-*.nd (glob)
294 .hg/store/00changelog-*.nd (glob)
293 .hg/store/00changelog.d
295 .hg/store/00changelog.d
294 .hg/store/00changelog.i
296 .hg/store/00changelog.i
295 .hg/store/00changelog.n
297 .hg/store/00changelog.n
296
298
297 Specifying revisions by changeset ID
299 Specifying revisions by changeset ID
298 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
300 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
299 of
301 of
300 $ $NO_FALLBACK rhg cat -r c3ae8dec9fad of
302 $ $NO_FALLBACK rhg cat -r c3ae8dec9fad of
301 r5000
303 r5000
302
304
303 Crate a shared repository
305 Crate a shared repository
304
306
305 $ echo "[extensions]" >> $HGRCPATH
307 $ echo "[extensions]" >> $HGRCPATH
306 $ echo "share = " >> $HGRCPATH
308 $ echo "share = " >> $HGRCPATH
307
309
308 $ cd $TESTTMP
310 $ cd $TESTTMP
309 $ hg init repo1
311 $ hg init repo1
310 $ echo a > repo1/a
312 $ echo a > repo1/a
311 $ hg -R repo1 commit -A -m'init'
313 $ hg -R repo1 commit -A -m'init'
312 adding a
314 adding a
313
315
314 $ hg share repo1 repo2
316 $ hg share repo1 repo2
315 updating working directory
317 updating working directory
316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
318 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
317
319
318 And check that basic rhg commands work with sharing
320 And check that basic rhg commands work with sharing
319
321
320 $ $NO_FALLBACK rhg files -R repo2
322 $ $NO_FALLBACK rhg files -R repo2
321 repo2/a
323 repo2/a
322 $ $NO_FALLBACK rhg -R repo2 cat -r 0 repo2/a
324 $ $NO_FALLBACK rhg -R repo2 cat -r 0 repo2/a
323 a
325 a
324
326
325 Same with relative sharing
327 Same with relative sharing
326
328
327 $ hg share repo2 repo3 --relative
329 $ hg share repo2 repo3 --relative
328 updating working directory
330 updating working directory
329 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
330
332
331 $ $NO_FALLBACK rhg files -R repo3
333 $ $NO_FALLBACK rhg files -R repo3
332 repo3/a
334 repo3/a
333 $ $NO_FALLBACK rhg -R repo3 cat -r 0 repo3/a
335 $ $NO_FALLBACK rhg -R repo3 cat -r 0 repo3/a
334 a
336 a
335
337
336 Same with share-safe
338 Same with share-safe
337
339
338 $ echo "[format]" >> $HGRCPATH
340 $ echo "[format]" >> $HGRCPATH
339 $ echo "use-share-safe = True" >> $HGRCPATH
341 $ echo "use-share-safe = True" >> $HGRCPATH
340
342
341 $ cd $TESTTMP
343 $ cd $TESTTMP
342 $ hg init repo4
344 $ hg init repo4
343 $ cd repo4
345 $ cd repo4
344 $ echo a > a
346 $ echo a > a
345 $ hg commit -A -m'init'
347 $ hg commit -A -m'init'
346 adding a
348 adding a
347
349
348 $ cd ..
350 $ cd ..
349 $ hg share repo4 repo5
351 $ hg share repo4 repo5
350 updating working directory
352 updating working directory
351 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
353 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
352
354
353 And check that basic rhg commands work with sharing
355 And check that basic rhg commands work with sharing
354
356
355 $ cd repo5
357 $ cd repo5
356 $ $NO_FALLBACK rhg files
358 $ $NO_FALLBACK rhg files
357 a
359 a
358 $ $NO_FALLBACK rhg cat -r 0 a
360 $ $NO_FALLBACK rhg cat -r 0 a
359 a
361 a
360
362
361 The blackbox extension is supported
363 The blackbox extension is supported
362
364
363 $ echo "[extensions]" >> $HGRCPATH
365 $ echo "[extensions]" >> $HGRCPATH
364 $ echo "blackbox =" >> $HGRCPATH
366 $ echo "blackbox =" >> $HGRCPATH
365 $ echo "[blackbox]" >> $HGRCPATH
367 $ echo "[blackbox]" >> $HGRCPATH
366 $ echo "maxsize = 1" >> $HGRCPATH
368 $ echo "maxsize = 1" >> $HGRCPATH
367 $ $NO_FALLBACK rhg files > /dev/null
369 $ $NO_FALLBACK rhg files > /dev/null
368 $ cat .hg/blackbox.log
370 $ cat .hg/blackbox.log
369 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
371 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
370 $ cat .hg/blackbox.log.1
372 $ cat .hg/blackbox.log.1
371 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files (glob)
373 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files (glob)
372
374
373 Subrepos are not supported
375 Subrepos are not supported
374
376
375 $ touch .hgsub
377 $ touch .hgsub
376 $ $NO_FALLBACK rhg files
378 $ $NO_FALLBACK rhg files
377 unsupported feature: subrepos (.hgsub is present)
379 unsupported feature: subrepos (.hgsub is present)
378 [252]
380 [252]
379 $ rhg files
381 $ rhg files
380 a
382 a
381 $ rm .hgsub
383 $ rm .hgsub
General Comments 0
You need to be logged in to leave comments. Login now