##// END OF EJS Templates
rhg: add support for calling `rhg cat` without a revision...
Raphaël Gomès -
r48886:d919b0ca default
parent child Browse files
Show More
@@ -1,84 +1,83 b''
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 // TODO: actually normalize `..` path segments etc?
49 // TODO: actually normalize `..` path segments etc?
50 let normalized = cwd.join(&file);
50 let normalized = cwd.join(&file);
51 let stripped = normalized
51 let stripped = normalized
52 .strip_prefix(&working_directory)
52 .strip_prefix(&working_directory)
53 // TODO: error message for path arguments outside of the repo
53 // TODO: error message for path arguments outside of the repo
54 .map_err(|_| CommandError::abort(""))?;
54 .map_err(|_| CommandError::abort(""))?;
55 let hg_file = HgPathBuf::try_from(stripped.to_path_buf())
55 let hg_file = HgPathBuf::try_from(stripped.to_path_buf())
56 .map_err(|e| CommandError::abort(e.to_string()))?;
56 .map_err(|e| CommandError::abort(e.to_string()))?;
57 files.push(hg_file);
57 files.push(hg_file);
58 }
58 }
59 // TODO probably move this to a util function like `repo.default_rev` or
60 // something when it's used somewhere else
61 let rev = match rev {
62 Some(r) => r.to_string(),
63 None => format!("{:x}", repo.dirstate_parents()?.p1),
64 };
59
65
60 match rev {
66 let output = cat(&repo, &rev, &files).map_err(|e| (e, rev.as_str()))?;
61 Some(rev) => {
67 invocation.ui.write_stdout(&output.concatenated)?;
62 let output = cat(&repo, rev, &files).map_err(|e| (e, rev))?;
68 if !output.missing.is_empty() {
63 invocation.ui.write_stdout(&output.concatenated)?;
69 let short = format!("{:x}", output.node.short()).into_bytes();
64 if !output.missing.is_empty() {
70 for path in &output.missing {
65 let short = format!("{:x}", output.node.short()).into_bytes();
71 invocation.ui.write_stderr(&format_bytes!(
66 for path in &output.missing {
72 b"{}: no such file in rev {}\n",
67 invocation.ui.write_stderr(&format_bytes!(
73 path.as_bytes(),
68 b"{}: no such file in rev {}\n",
74 short
69 path.as_bytes(),
75 ))?;
70 short
71 ))?;
72 }
73 }
74 if output.found_any {
75 Ok(())
76 } else {
77 Err(CommandError::Unsuccessful)
78 }
79 }
76 }
80 None => Err(CommandError::unsupported(
77 }
81 "`rhg cat` without `--rev` / `-r`",
78 if output.found_any {
82 )),
79 Ok(())
80 } else {
81 Err(CommandError::Unsuccessful)
83 }
82 }
84 }
83 }
@@ -1,312 +1,337 b''
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`
142 $ $NO_FALLBACK rhg cat original
143 original content
144 With `--rev`
141 $ $NO_FALLBACK rhg cat -r 0 original
145 $ $NO_FALLBACK rhg cat -r 0 original
142 original content
146 original content
143 Cat copied file should not display copy metadata
147 Cat copied file should not display copy metadata
144 $ hg copy original copy_of_original
148 $ hg copy original copy_of_original
145 $ hg commit -m "add copy of original"
149 $ hg commit -m "add copy of original"
150 $ $NO_FALLBACK rhg cat original
151 original content
146 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
152 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
147 original content
153 original content
148
154
155
149 Fallback to Python
156 Fallback to Python
150 $ $NO_FALLBACK rhg cat original
157 $ $NO_FALLBACK rhg cat original --exclude="*.rs"
151 unsupported feature: `rhg cat` without `--rev` / `-r`
158 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
159
160 USAGE:
161 rhg cat [OPTIONS] <FILE>...
162
163 For more information try --help
164
152 [252]
165 [252]
153 $ rhg cat original
166 $ rhg cat original --exclude="*.rs"
154 original content
167 original content
155
168
156 $ FALLBACK_EXE="$RHG_FALLBACK_EXECUTABLE"
169 $ FALLBACK_EXE="$RHG_FALLBACK_EXECUTABLE"
157 $ unset RHG_FALLBACK_EXECUTABLE
170 $ unset RHG_FALLBACK_EXECUTABLE
158 $ rhg cat original
171 $ rhg cat original --exclude="*.rs"
159 abort: 'rhg.on-unsupported=fallback' without 'rhg.fallback-executable' set.
172 abort: 'rhg.on-unsupported=fallback' without 'rhg.fallback-executable' set.
160 [255]
173 [255]
161 $ RHG_FALLBACK_EXECUTABLE="$FALLBACK_EXE"
174 $ RHG_FALLBACK_EXECUTABLE="$FALLBACK_EXE"
162 $ export RHG_FALLBACK_EXECUTABLE
175 $ export RHG_FALLBACK_EXECUTABLE
163
176
164 $ rhg cat original --config rhg.fallback-executable=false
177 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=false
165 [1]
178 [1]
166
179
167 $ rhg cat original --config rhg.fallback-executable=hg-non-existent
180 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=hg-non-existent
168 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$
169 unsupported feature: `rhg cat` without `--rev` / `-r`
182 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
183
184 USAGE:
185 rhg cat [OPTIONS] <FILE>...
186
187 For more information try --help
188
170 [252]
189 [252]
171
190
172 $ rhg cat original --config rhg.fallback-executable=rhg
191 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=rhg
173 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.
174 unsupported feature: `rhg cat` without `--rev` / `-r`
193 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
194
195 USAGE:
196 rhg cat [OPTIONS] <FILE>...
197
198 For more information try --help
199
175 [252]
200 [252]
176
201
177 Requirements
202 Requirements
178 $ $NO_FALLBACK rhg debugrequirements
203 $ $NO_FALLBACK rhg debugrequirements
179 dotencode
204 dotencode
180 fncache
205 fncache
181 generaldelta
206 generaldelta
182 persistent-nodemap
207 persistent-nodemap
183 revlog-compression-zstd (zstd !)
208 revlog-compression-zstd (zstd !)
184 revlogv1
209 revlogv1
185 sparserevlog
210 sparserevlog
186 store
211 store
187
212
188 $ echo indoor-pool >> .hg/requires
213 $ echo indoor-pool >> .hg/requires
189 $ $NO_FALLBACK rhg files
214 $ $NO_FALLBACK rhg files
190 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
215 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
191 [252]
216 [252]
192
217
193 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
218 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
194 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
219 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
195 [252]
220 [252]
196
221
197 $ $NO_FALLBACK rhg debugrequirements
222 $ $NO_FALLBACK rhg debugrequirements
198 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
223 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
199 [252]
224 [252]
200
225
201 $ echo -e '\xFF' >> .hg/requires
226 $ echo -e '\xFF' >> .hg/requires
202 $ $NO_FALLBACK rhg debugrequirements
227 $ $NO_FALLBACK rhg debugrequirements
203 abort: parse error in 'requires' file
228 abort: parse error in 'requires' file
204 [255]
229 [255]
205
230
206 Persistent nodemap
231 Persistent nodemap
207 $ cd $TESTTMP
232 $ cd $TESTTMP
208 $ rm -rf repository
233 $ rm -rf repository
209 $ hg --config format.use-persistent-nodemap=no init repository
234 $ hg --config format.use-persistent-nodemap=no init repository
210 $ cd repository
235 $ cd repository
211 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
236 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
212 [1]
237 [1]
213 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
238 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
214 $ hg id -r tip
239 $ hg id -r tip
215 c3ae8dec9fad tip
240 c3ae8dec9fad tip
216 $ ls .hg/store/00changelog*
241 $ ls .hg/store/00changelog*
217 .hg/store/00changelog.d
242 .hg/store/00changelog.d
218 .hg/store/00changelog.i
243 .hg/store/00changelog.i
219 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
244 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
220 of
245 of
221
246
222 $ cd $TESTTMP
247 $ cd $TESTTMP
223 $ rm -rf repository
248 $ rm -rf repository
224 $ hg --config format.use-persistent-nodemap=True init repository
249 $ hg --config format.use-persistent-nodemap=True init repository
225 $ cd repository
250 $ cd repository
226 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
251 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
227 persistent-nodemap
252 persistent-nodemap
228 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
253 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
229 $ hg id -r tip
254 $ hg id -r tip
230 c3ae8dec9fad tip
255 c3ae8dec9fad tip
231 $ ls .hg/store/00changelog*
256 $ ls .hg/store/00changelog*
232 .hg/store/00changelog-*.nd (glob)
257 .hg/store/00changelog-*.nd (glob)
233 .hg/store/00changelog.d
258 .hg/store/00changelog.d
234 .hg/store/00changelog.i
259 .hg/store/00changelog.i
235 .hg/store/00changelog.n
260 .hg/store/00changelog.n
236
261
237 Specifying revisions by changeset ID
262 Specifying revisions by changeset ID
238 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
263 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
239 of
264 of
240 $ $NO_FALLBACK rhg cat -r c3ae8dec9fad of
265 $ $NO_FALLBACK rhg cat -r c3ae8dec9fad of
241 r5000
266 r5000
242
267
243 Crate a shared repository
268 Crate a shared repository
244
269
245 $ echo "[extensions]" >> $HGRCPATH
270 $ echo "[extensions]" >> $HGRCPATH
246 $ echo "share = " >> $HGRCPATH
271 $ echo "share = " >> $HGRCPATH
247
272
248 $ cd $TESTTMP
273 $ cd $TESTTMP
249 $ hg init repo1
274 $ hg init repo1
250 $ echo a > repo1/a
275 $ echo a > repo1/a
251 $ hg -R repo1 commit -A -m'init'
276 $ hg -R repo1 commit -A -m'init'
252 adding a
277 adding a
253
278
254 $ hg share repo1 repo2
279 $ hg share repo1 repo2
255 updating working directory
280 updating working directory
256 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
257
282
258 And check that basic rhg commands work with sharing
283 And check that basic rhg commands work with sharing
259
284
260 $ $NO_FALLBACK rhg files -R repo2
285 $ $NO_FALLBACK rhg files -R repo2
261 repo2/a
286 repo2/a
262 $ $NO_FALLBACK rhg -R repo2 cat -r 0 repo2/a
287 $ $NO_FALLBACK rhg -R repo2 cat -r 0 repo2/a
263 a
288 a
264
289
265 Same with relative sharing
290 Same with relative sharing
266
291
267 $ hg share repo2 repo3 --relative
292 $ hg share repo2 repo3 --relative
268 updating working directory
293 updating working directory
269 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
270
295
271 $ $NO_FALLBACK rhg files -R repo3
296 $ $NO_FALLBACK rhg files -R repo3
272 repo3/a
297 repo3/a
273 $ $NO_FALLBACK rhg -R repo3 cat -r 0 repo3/a
298 $ $NO_FALLBACK rhg -R repo3 cat -r 0 repo3/a
274 a
299 a
275
300
276 Same with share-safe
301 Same with share-safe
277
302
278 $ echo "[format]" >> $HGRCPATH
303 $ echo "[format]" >> $HGRCPATH
279 $ echo "use-share-safe = True" >> $HGRCPATH
304 $ echo "use-share-safe = True" >> $HGRCPATH
280
305
281 $ cd $TESTTMP
306 $ cd $TESTTMP
282 $ hg init repo4
307 $ hg init repo4
283 $ cd repo4
308 $ cd repo4
284 $ echo a > a
309 $ echo a > a
285 $ hg commit -A -m'init'
310 $ hg commit -A -m'init'
286 adding a
311 adding a
287
312
288 $ cd ..
313 $ cd ..
289 $ hg share repo4 repo5
314 $ hg share repo4 repo5
290 updating working directory
315 updating working directory
291 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
292
317
293 And check that basic rhg commands work with sharing
318 And check that basic rhg commands work with sharing
294
319
295 $ cd repo5
320 $ cd repo5
296 $ $NO_FALLBACK rhg files
321 $ $NO_FALLBACK rhg files
297 a
322 a
298 $ $NO_FALLBACK rhg cat -r 0 a
323 $ $NO_FALLBACK rhg cat -r 0 a
299 a
324 a
300
325
301 The blackbox extension is supported
326 The blackbox extension is supported
302
327
303 $ echo "[extensions]" >> $HGRCPATH
328 $ echo "[extensions]" >> $HGRCPATH
304 $ echo "blackbox =" >> $HGRCPATH
329 $ echo "blackbox =" >> $HGRCPATH
305 $ echo "[blackbox]" >> $HGRCPATH
330 $ echo "[blackbox]" >> $HGRCPATH
306 $ echo "maxsize = 1" >> $HGRCPATH
331 $ echo "maxsize = 1" >> $HGRCPATH
307 $ $NO_FALLBACK rhg files > /dev/null
332 $ $NO_FALLBACK rhg files > /dev/null
308 $ cat .hg/blackbox.log
333 $ cat .hg/blackbox.log
309 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
334 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
310 $ cat .hg/blackbox.log.1
335 $ cat .hg/blackbox.log.1
311 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files (glob)
336 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files (glob)
312
337
General Comments 0
You need to be logged in to leave comments. Login now