##// END OF EJS Templates
rhg: support `status --print0`...
Arseniy Alekseyev -
r51289:98fc949b default
parent child Browse files
Show More
@@ -111,6 +111,13 b' pub fn args() -> clap::Command {'
111 .long("copies"),
111 .long("copies"),
112 )
112 )
113 .arg(
113 .arg(
114 Arg::new("print0")
115 .help("end filenames with NUL, for use with xargs")
116 .short('0')
117 .action(clap::ArgAction::SetTrue)
118 .long("print0"),
119 )
120 .arg(
114 Arg::new("no-status")
121 Arg::new("no-status")
115 .help("hide status prefix")
122 .help("hide status prefix")
116 .short('n')
123 .short('n')
@@ -213,10 +220,11 b' pub fn run(invocation: &crate::CliInvoca'
213 let config = invocation.config;
220 let config = invocation.config;
214 let args = invocation.subcommand_args;
221 let args = invocation.subcommand_args;
215
222
216 // TODO add `!args.get_flag("print0") &&` when we support `print0`
223 let print0 = args.get_flag("print0");
217 let verbose = args.get_flag("verbose")
224 let verbose = args.get_flag("verbose")
218 || config.get_bool(b"ui", b"verbose")?
225 || config.get_bool(b"ui", b"verbose")?
219 || config.get_bool(b"commands", b"status.verbose")?;
226 || config.get_bool(b"commands", b"status.verbose")?;
227 let verbose = verbose && !print0;
220
228
221 let all = args.get_flag("all");
229 let all = args.get_flag("all");
222 let display_states = if all {
230 let display_states = if all {
@@ -363,6 +371,7 b' pub fn run(invocation: &crate::CliInvoca'
363 } else {
371 } else {
364 None
372 None
365 },
373 },
374 print0,
366 };
375 };
367 if display_states.modified {
376 if display_states.modified {
368 output.display(b"M ", "status.modified", ds_status.modified)?;
377 output.display(b"M ", "status.modified", ds_status.modified)?;
@@ -527,6 +536,7 b" struct DisplayStatusPaths<'a> {"
527 ui: &'a Ui,
536 ui: &'a Ui,
528 no_status: bool,
537 no_status: bool,
529 relativize: Option<RelativizePaths>,
538 relativize: Option<RelativizePaths>,
539 print0: bool,
530 }
540 }
531
541
532 impl DisplayStatusPaths<'_> {
542 impl DisplayStatusPaths<'_> {
@@ -555,12 +565,15 b" impl DisplayStatusPaths<'_> {"
555 if !self.no_status {
565 if !self.no_status {
556 self.ui.write_stdout_labelled(status_prefix, label)?
566 self.ui.write_stdout_labelled(status_prefix, label)?
557 }
567 }
558 self.ui
568 let linebreak = if self.print0 { b"\x00" } else { b"\n" };
559 .write_stdout_labelled(&format_bytes!(b"{}\n", path), label)?;
569 self.ui.write_stdout_labelled(
570 &format_bytes!(b"{}{}", path, linebreak),
571 label,
572 )?;
560 if let Some(source) = copy_source {
573 if let Some(source) = copy_source {
561 let label = "status.copied";
574 let label = "status.copied";
562 self.ui.write_stdout_labelled(
575 self.ui.write_stdout_labelled(
563 &format_bytes!(b" {}\n", source.as_bytes()),
576 &format_bytes!(b" {}{}", source.as_bytes(), linebreak),
564 label,
577 label,
565 )?
578 )?
566 }
579 }
@@ -246,6 +246,11 b' hg status -C:'
246 ! deleted
246 ! deleted
247 ? unknown
247 ? unknown
248
248
249 hg status -0:
250
251 $ hg status -0 --config rhg.on-unsupported=abort
252 A added\x00A copied\x00R removed\x00! deleted\x00? unknown\x00 (no-eol) (esc)
253
249 hg status -A:
254 hg status -A:
250
255
251 $ hg status -A
256 $ hg status -A
General Comments 0
You need to be logged in to leave comments. Login now