Add hunk paths to log ouput

oknozor
Feb 6, 2024, 9:22 AM
ATUZBEPEZDUXR55MJQB35GUANAJVO6JENHYXDJBFKETZ6AT4DRIAC

Dependencies

  • [2] NAUECZW3 Fixing the map between keys and identities
  • [3] UAXGGNAZ Improve command feedback
  • [4] WFBYDQB4 fixing log --description
  • [5] 7P7G4J5Z Parse argument of `pijul log --output-format` strictly
  • [6] AEPEFS7O Write help for each argument
  • [7] 5E2AB2YL Fixing a conflict
  • [8] 6U42MTEZ Fixing log -- filters, along with performance improvements
  • [9] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [10] U6TQX5Z2 pager function respects cli option and user config files, PAGER env var
  • [11] F2S6XETO Fixing log --hash-only
  • [12] OU6JOR3C Add path filtering for log, add json output for log
  • [*] RUBBHYZ7 Removing unnecessary async/await
  • [*] 6F6AAHK4 Simplifying pijul::commands::log, and fixing Broken Pipe errors

Change contents

  • replacement in pijul/src/commands/log.rs at line 30
    [6.2987][6.134724:134756](),[6.134724][6.134724:134756]()
    #[clap(long = "hash-only")]
    [6.2987]
    [6.134756]
    #[clap(long = "hash-only", conflicts_with = "files")]
  • edit in pijul/src/commands/log.rs at line 38
    [6.134881]
    [14.1529]
    /// Include files changed in the output
    #[clap(long = "files")]
    files: bool,
  • edit in pijul/src/commands/log.rs at line 86
    [15.1491]
    [2.243]
    let show_paths = cmd.files;
  • edit in pijul/src/commands/log.rs at line 96
    [15.1672]
    [15.1672]
    show_paths,
  • edit in pijul/src/commands/log.rs at line 199
    [6.629]
    [6.629]
    #[serde(skip_serializing_if = "Option::is_none")]
    paths: Option<Vec<String>>,
  • edit in pijul/src/commands/log.rs at line 216
    [6.864]
    [6.864]
    paths,
  • edit in pijul/src/commands/log.rs at line 248
    [6.5953]
    [6.5953]
    if let Some(ref paths) = paths {
    writeln!(f, " Files:")?;
    for path in paths {
    writeln!(f, " - {}", path)?;
    }
    writeln!(f)?;
    }
  • edit in pijul/src/commands/log.rs at line 285
    [6.7493]
    [6.7493]
    show_paths: bool,
  • replacement in pijul/src/commands/log.rs at line 337
    [3.410][3.410:507]()
    let mut reverse_log = self.txn.reverse_log(&*self.channel_ref.read(), None)?.peekable();
    [3.410]
    [3.507]
    let mut reverse_log = self
    .txn
    .reverse_log(&*self.channel_ref.read(), None)?
    .peekable();
  • edit in pijul/src/commands/log.rs at line 393
    [6.2264]
    [6.2128]
    let paths = if self.show_paths {
    let files = self.repo.changes.get_changes(&h)?;
    let mut paths: Vec<String> = files
    .into_iter()
    .map(|hunk| hunk.path().to_string())
    .collect();
    paths.dedup();
    Some(paths)
    } else {
    None
    };
  • replacement in pijul/src/commands/log.rs at line 473
    [6.13977][4.27:115]()
    description: if self.cmd.descriptions { header.description } else { None },
    [6.13977]
    [6.14022]
    description: if self.cmd.descriptions {
    header.description
    } else {
    None
    },
    paths,
  • replacement in pijul/src/commands/log.rs at line 502
    [5.322][5.322:358](),[5.358][6.2380:2450](),[6.14431][6.2380:2450]()
    OutputFormat::Json => {
    serde_json::to_writer_pretty(&mut stdout, &log_iter)?
    [5.322]
    [6.14521]
    OutputFormat::Json => serde_json::to_writer_pretty(&mut stdout, &log_iter)?,
    OutputFormat::Plaintext => {
    log_iter.for_each(|entry| match write!(&mut stdout, "{}", entry) {
    Ok(_) => Ok(()),
    Err(e) if e.kind() == std::io::ErrorKind::BrokenPipe => Ok(()),
    Err(e) => Err(e),
    })?
  • edit in pijul/src/commands/log.rs at line 510
    [6.14535][5.359:465](),[5.465][6.2535:2699](),[6.2535][6.2535:2699]()
    OutputFormat::Plaintext => log_iter.for_each(|entry| match write!(&mut stdout, "{}", entry) {
    Ok(_) => Ok(()),
    Err(e) if e.kind() == std::io::ErrorKind::BrokenPipe => Ok(()),
    Err(e) => Err(e),
    })?,