Fixing log --hash-only

pmeunier
Sep 14, 2021, 1:11 PM
F2S6XETO6DQ4447O4WPAHISGTBRVWW2WZYJ633KKYWWYKW5GXBPQC

Dependencies

  • [2] OU6JOR3C Add path filtering for log, add json output for log
  • [3] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [4] BECIRKR2 Avoid a double formatting
  • [5] SMMBFECL Converting to the new patch format "online"

Change contents

  • replacement in "pijul/src/commands/log.rs" at line 152
    [2.4811][2.4811:5364]()
    struct LogEntry {
    #[serde(skip_serializing_if = "Option::is_none")]
    hash: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    state: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    authors: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    message: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    description: Option<String>,
    [2.4811]
    [2.5364]
    #[serde(untagged)]
    enum LogEntry {
    Full {
    #[serde(skip_serializing_if = "Option::is_none")]
    hash: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    state: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    authors: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    message: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    description: Option<String>,
    },
    Hash(libpijul::Hash),
  • replacement in "pijul/src/commands/log.rs" at line 174
    [2.5504][2.5504:5935]()
    if let Some(ref h) = self.hash {
    writeln!(f, "Change {}", h)?;
    }
    if let Some(ref authors) = self.authors {
    write!(f, "Author: ")?;
    let mut is_first = true;
    for a in authors.iter() {
    if is_first {
    is_first = false;
    write!(f, "{}", a)?;
    } else {
    write!(f, ", {}", a)?;
    [2.5504]
    [2.5935]
    match self {
    LogEntry::Full {
    hash,
    state,
    authors,
    timestamp,
    message,
    description,
    } => {
    if let Some(ref h) = hash {
    writeln!(f, "Change {}", h)?;
    }
    if let Some(ref authors) = authors {
    write!(f, "Author: ")?;
    let mut is_first = true;
    for a in authors.iter() {
    if is_first {
    is_first = false;
    write!(f, "{}", a)?;
    } else {
    write!(f, ", {}", a)?;
    }
    }
    // Write a linebreak after finishing the list of authors.
    writeln!(f)?;
    }
    if let Some(ref timestamp) = timestamp {
    writeln!(f, "Date: {}", timestamp)?;
    }
    if let Some(ref mrk) = state {
    writeln!(f, "State: {}", mrk)?;
    }
    if let Some(ref message) = message {
    writeln!(f, "\n {}\n", message)?;
    }
    if let Some(ref description) = description {
    writeln!(f, "\n {}\n", description)?;
  • replacement in "pijul/src/commands/log.rs" at line 214
    [2.5967][2.5967:6063]()
    // Write a linebreak after finishing the list of authors.
    writeln!(f)?;
    [2.5967]
    [2.6063]
    LogEntry::Hash(h) => {
    writeln!(f, "{}", h.to_base32())?;
    }
  • edit in "pijul/src/commands/log.rs" at line 218
    [2.6073][2.6073:6515]()
    if let Some(ref timestamp) = self.timestamp {
    writeln!(f, "Date: {}", timestamp)?;
    }
    if let Some(ref mrk) = self.state {
    writeln!(f, "State: {}", mrk)?;
    }
    if let Some(ref message) = self.message {
    writeln!(f, "\n {}\n", message)?;
    }
    if let Some(ref description) = self.description {
    writeln!(f, "\n {}\n", description)?;
    }
  • edit in "pijul/src/commands/log.rs" at line 389
    [2.12512]
    [2.12512]
    if self.cmd.hash_only {
    return Ok(LogEntry::Hash(h));
    }
  • replacement in "pijul/src/commands/log.rs" at line 423
    [2.13707][2.13707:13729]()
    Ok(LogEntry {
    [2.13707]
    [2.13729]
    Ok(LogEntry::Full {