Verbose printing of conflicts to stderr

pmeunier
Aug 3, 2021, 8:57 PM
C4MJ7D7QCOFGIHQSDV3UC76DTSE5M7JSLGN5MROMSVKFVQRFSP5QC

Dependencies

  • [2] E7UUQQCC Apply changes with prefixes in .pijul/changes
  • [3] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [4] LGEJSLTY Fixing output (including its uses in reset and pull)
  • [5] MDADYULS Fix a panic when switching between channels that have different files
  • [6] FXEDPLRI Resurrecting tests, and type cleanup (no need for Arc<RwLock<…>> anymore)
  • [7] 2RXOCWUW Making libpijul deterministic (and getting rid of `rand`)
  • [8] QMTANHVN Reset: only output changed files
  • [9] 3AMEP2Y5 More convenient interface for channels
  • [10] GHO6DWPI Refactoring iterators
  • [11] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [12] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [13] Y6EVFMTA Don't output files if they aren't in the current channel
  • [14] I24UEJQL Various post-fire fixes
  • [15] 2D7P2VKJ Change completions (where the whole progress bar story started)
  • [16] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [17] YCEZL7VF Moving to temporary paths when outputting
  • [18] VO5OQW4W Removing anyhow in libpijul
  • [19] VYHHOEYH Versions and formatting
  • [20] V435QOJR Using path-slash to fix path issues on Windows
  • [*] MU5GSJAW Partial push and pull (WARNING: breaks the existing protocol)
  • [*] SLJ3OHD4 unrecord: show list of changes if none were given as arguments

Change contents

  • edit in pijul/src/commands/reset.rs at line 128
    [4.8180]
    [4.8180]
    let mut conflicts = Vec::new();
  • replacement in pijul/src/commands/reset.rs at line 188
    [4.10659][4.10659:10723](),[4.10723][3.4704:4744](),[3.4744][4.10770:10805](),[4.10770][4.10770:10805](),[4.10805][3.4745:4801](),[3.4801][4.10875:10991](),[4.10875][4.10875:10991](),[4.10991][4.318:341](),[4.341][4.10991:11011](),[4.10991][4.10991:11011]()
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    &path,
    true,
    None,
    num_cpus::get(),
    0,
    )?;
    [4.10659]
    [4.11011]
    conflicts.extend(
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    &path,
    true,
    None,
    num_cpus::get(),
    0,
    )?
    .into_iter(),
    );
  • replacement in pijul/src/commands/reset.rs at line 204
    [4.11059][4.11059:11123](),[4.11123][3.4802:4842](),[3.4842][4.11162:11197](),[4.11162][4.11162:11197](),[4.11197][3.4843:4899](),[3.4899][4.11259:11372](),[4.11259][4.11259:11372](),[4.11372][4.342:365](),[4.365][4.11372:11392](),[4.11372][4.11372:11392]()
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    "",
    true,
    None,
    num_cpus::get(),
    0,
    )?;
    [4.11059]
    [4.11392]
    conflicts.extend(
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    "",
    true,
    None,
    num_cpus::get(),
    0,
    )?
    .into_iter(),
    );
  • replacement in pijul/src/commands/reset.rs at line 233
    [4.452][4.11865:11929](),[4.11865][4.11865:11929](),[4.11929][3.4900:4940](),[3.4940][4.11976:12011](),[4.11976][4.11976:12011](),[4.12011][3.4941:4997](),[3.4997][4.12081:12197](),[4.12081][4.12081:12197](),[4.12197][4.366:389](),[4.389][4.12197:12217](),[4.12197][4.12197:12217]()
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    &path,
    true,
    None,
    num_cpus::get(),
    0,
    )?;
    [4.452]
    [4.101673]
    conflicts.extend(
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    &path,
    true,
    None,
    num_cpus::get(),
    0,
    )?
    .into_iter(),
    );
  • edit in pijul/src/commands/reset.rs at line 250
    [4.101723]
    [4.12399]
    super::print_conflicts(&conflicts)?;
  • edit in pijul/src/commands/pushpull.rs at line 532
    [4.5070]
    [22.11126]
    super::print_conflicts(&conflicts)?;
  • edit in pijul/src/commands/mod.rs at line 296
    [2.1046]
    [23.5215]
    }
    use libpijul::Conflict;
    fn print_conflicts(conflicts: &[Conflict]) -> Result<(), std::io::Error> {
    if conflicts.is_empty() {
    return Ok(());
    }
    let mut w = termcolor::StandardStream::stderr(termcolor::ColorChoice::Auto);
    use std::io::Write;
    use termcolor::*;
    w.set_color(ColorSpec::new().set_fg(Some(Color::Red)))?;
    writeln!(w, "\nThere were conflicts:\n")?;
    w.set_color(ColorSpec::new().set_fg(None))?;
    for c in conflicts.iter() {
    match c {
    Conflict::Name { ref path } => writeln!(w, " - Name conflict on \"{}\"", path)?,
    Conflict::ZombieFile { ref path } => {
    writeln!(w, " - Path deletion conflict \"{}\"", path)?
    }
    Conflict::MultipleNames { ref path, .. } => {
    writeln!(w, " - File has multiple names: \"{}\"", path)?
    }
    Conflict::Zombie { ref path, ref line } => writeln!(
    w,
    " - Deletion conflict in \"{}\" starting on line {}",
    path, line
    )?,
    Conflict::Cyclic { ref path, ref line } => writeln!(
    w,
    " - Cycle conflict in \"{}\" starting on line {}",
    path, line
    )?,
    Conflict::Order { ref path, ref line } => writeln!(
    w,
    " - Order conflict in \"{}\" starting on line {}",
    path, line
    )?,
    }
    }
    Ok(())
  • edit in pijul/src/commands/archive.rs at line 1
    [4.191202][4.191202:191222]()
    use std::io::Write;
  • replacement in pijul/src/commands/archive.rs at line 139
    [4.194024][4.194024:194244]()
    if !conflicts.is_empty() {
    writeln!(
    std::io::stderr(),
    "There were {} conflicts",
    conflicts.len()
    )?
    }
    [4.194024]
    [4.194244]
    super::print_conflicts(&conflicts)?;
  • edit in pijul/src/commands/apply.rs at line 128
    [4.5339]
    [4.3383]
    let mut conflicts = Vec::new();
  • replacement in pijul/src/commands/apply.rs at line 130
    [4.3430][4.23911:23975](),[4.23975][3.18455:18495](),[3.18495][4.3524:3559](),[4.24022][4.3524:3559](),[4.3524][4.3524:3559](),[4.3559][3.18496:18552](),[3.18552][4.3593:3672](),[4.24093][4.3593:3672](),[4.3593][4.3593:3672](),[4.3672][4.24094:24131](),[4.24131][4.1653:1676](),[4.1676][4.3672:3692](),[4.24131][4.3672:3692](),[4.3672][4.3672:3692]()
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    &path,
    true,
    None,
    num_cpus::get(),
    0,
    )?;
    [4.3430]
    [4.3692]
    conflicts.extend(
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    &path,
    true,
    None,
    num_cpus::get(),
    0,
    )?
    .into_iter(),
    );
  • replacement in pijul/src/commands/apply.rs at line 146
    [4.3749][4.24132:24196](),[4.24196][3.18553:18593](),[3.18593][4.3843:3878](),[4.24243][4.3843:3878](),[4.3843][4.3843:3878](),[4.3878][3.18594:18650](),[3.18650][4.3912:3988](),[4.24314][4.3912:3988](),[4.3912][4.3912:3988](),[4.3988][4.24315:24352](),[4.24352][4.1677:1700](),[4.1700][4.3988:4008](),[4.24352][4.3988:4008](),[4.3988][4.3988:4008]()
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    "",
    true,
    None,
    num_cpus::get(),
    0,
    )?;
    [4.3749]
    [4.1628]
    conflicts.extend(
    libpijul::output::output_repository_no_pending(
    &repo.working_copy,
    &repo.changes,
    &txn,
    &channel,
    "",
    true,
    None,
    num_cpus::get(),
    0,
    )?
    .into_iter(),
    );
  • edit in pijul/src/commands/apply.rs at line 162
    [4.5369]
    [4.1642]
    super::print_conflicts(&conflicts)?;
  • replacement in libpijul/src/output/output.rs at line 19
    [4.672521][4.672521:672753]()
    Name { path: String },
    ZombieFile { path: String },
    MultipleNames { pos: Position<ChangeId> },
    Zombie { path: String, line: usize },
    Cyclic { path: String, line: usize },
    Order { path: String, line: usize },
    [4.672521]
    [4.672753]
    Name {
    path: String,
    },
    ZombieFile {
    path: String,
    },
    MultipleNames {
    pos: Position<ChangeId>,
    path: String,
    },
    Zombie {
    path: String,
    line: usize,
    },
    Cyclic {
    path: String,
    line: usize,
    },
    Order {
    path: String,
    line: usize,
    },
  • replacement in libpijul/src/output/output.rs at line 204
    [4.77359][4.77359:77407]()
    let mut done_vertices = HashMap::default();
    [4.77359]
    [4.674695]
    let mut done_vertices: HashMap<_, (Vertex<ChangeId>, String)> = HashMap::default();
  • replacement in libpijul/src/output/output.rs at line 229
    [4.675559][4.1271:1332]()
    match done_vertices.entry(output_item.pos) {
    [4.675559]
    [4.675611]
    let name_entry = match done_vertices.entry(output_item.pos) {
  • replacement in libpijul/src/output/output.rs at line 232
    [4.675741][4.675741:675791]()
    if *e.get() != name_key {
    [4.675741]
    [4.675791]
    if e.get().0 != name_key {
  • edit in libpijul/src/output/output.rs at line 235
    [4.675914]
    [4.675914]
    path: e.get().1.clone(),
  • replacement in libpijul/src/output/output.rs at line 240
    [4.676028][4.676028:676154]()
    Entry::Vacant(e) => {
    e.insert(name_key);
    }
    }
    [4.676028]
    [4.82271]
    Entry::Vacant(e) => e,
    };
  • edit in libpijul/src/output/output.rs at line 276
    [4.677226]
    [4.432]
    name_entry.insert((name_key, output_item.path.clone()));
  • replacement in libpijul/src/output/archive.rs at line 163
    [4.692788][4.83251:83290]()
    let mut done = HashMap::default();
    [4.692788]
    [4.83290]
    let mut done: HashMap<_, (Vertex<ChangeId>, String)> = HashMap::default();
  • replacement in libpijul/src/output/archive.rs at line 182
    [4.693507][4.693507:693559]()
    match done.entry(output_item.pos) {
    [4.693507]
    [4.693559]
    let name_entry = match done.entry(output_item.pos) {
  • replacement in libpijul/src/output/archive.rs at line 185
    [4.693689][4.693689:693739]()
    if *e.get() != name_key {
    [4.693689]
    [4.693739]
    if e.get().0 != name_key {
  • edit in libpijul/src/output/archive.rs at line 188
    [4.693862]
    [4.693862]
    path: e.get().1.clone(),
  • edit in libpijul/src/output/archive.rs at line 192
    [4.693954][4.693954:694062]()
    }
    Entry::Vacant(e) => {
    e.insert(name_key);
  • replacement in libpijul/src/output/archive.rs at line 193
    [4.694084][4.694084:694102]()
    }
    [4.694084]
    [4.88039]
    Entry::Vacant(e) => e,
    };
  • edit in libpijul/src/output/archive.rs at line 210
    [4.694807]
    [4.694807]
    name_entry.insert((name_key, output_item.path.clone()));