##// 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 111 .long("copies"),
112 112 )
113 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 121 Arg::new("no-status")
115 122 .help("hide status prefix")
116 123 .short('n')
@@ -213,10 +220,11 b' pub fn run(invocation: &crate::CliInvoca'
213 220 let config = invocation.config;
214 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 224 let verbose = args.get_flag("verbose")
218 225 || config.get_bool(b"ui", b"verbose")?
219 226 || config.get_bool(b"commands", b"status.verbose")?;
227 let verbose = verbose && !print0;
220 228
221 229 let all = args.get_flag("all");
222 230 let display_states = if all {
@@ -363,6 +371,7 b' pub fn run(invocation: &crate::CliInvoca'
363 371 } else {
364 372 None
365 373 },
374 print0,
366 375 };
367 376 if display_states.modified {
368 377 output.display(b"M ", "status.modified", ds_status.modified)?;
@@ -527,6 +536,7 b" struct DisplayStatusPaths<'a> {"
527 536 ui: &'a Ui,
528 537 no_status: bool,
529 538 relativize: Option<RelativizePaths>,
539 print0: bool,
530 540 }
531 541
532 542 impl DisplayStatusPaths<'_> {
@@ -555,12 +565,15 b" impl DisplayStatusPaths<'_> {"
555 565 if !self.no_status {
556 566 self.ui.write_stdout_labelled(status_prefix, label)?
557 567 }
558 self.ui
559 .write_stdout_labelled(&format_bytes!(b"{}\n", path), label)?;
568 let linebreak = if self.print0 { b"\x00" } else { b"\n" };
569 self.ui.write_stdout_labelled(
570 &format_bytes!(b"{}{}", path, linebreak),
571 label,
572 )?;
560 573 if let Some(source) = copy_source {
561 574 let label = "status.copied";
562 575 self.ui.write_stdout_labelled(
563 &format_bytes!(b" {}\n", source.as_bytes()),
576 &format_bytes!(b" {}{}", source.as_bytes(), linebreak),
564 577 label,
565 578 )?
566 579 }
@@ -246,6 +246,11 b' hg status -C:'
246 246 ! deleted
247 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 254 hg status -A:
250 255
251 256 $ hg status -A
General Comments 0
You need to be logged in to leave comments. Login now