Skip to content

Commit

Permalink
Update munkres
Browse files Browse the repository at this point in the history
Incorporates several performance improvements, and error handling.
  • Loading branch information
joshtriplett committed Oct 11, 2019
1 parent bd6ff71 commit daf949d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
59 changes: 56 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ chrono = "0.2.22"
clap = "2.7.0"
colorparse = "2.0"
git2 = "0.10"
munkres = "0.3.0"
munkres = "0.5"
quick-error = "1.0"
tempdir = "0.3.4"
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ quick_error! {
cause(err)
display("{}", err)
}
Munkres(err: munkres::Error) {
from()
display("{:?}", err)
}
Msg(msg: String) {
from()
from(s: &'static str) -> (s.to_string())
Expand Down Expand Up @@ -1286,14 +1290,14 @@ fn write_commit_range_diff<W: IoWrite>(out: &mut W, repo: &Repository, colors: &
}
}
let mut weight_matrix = munkres::WeightMatrix::from_row_vec(n, weights);
let result = munkres::solve_assignment(&mut weight_matrix);
let result = try!(munkres::solve_assignment(&mut weight_matrix));

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
enum CommitState { Unhandled, Handled, Deleted };
let mut commits2_from1: Vec<_> = std::iter::repeat(None).take(ncommits2).collect();
let mut commits1_state: Vec<_> = std::iter::repeat(CommitState::Unhandled).take(ncommits1).collect();
let mut commit_pairs = Vec::with_capacity(n);
for (i1, i2) in result {
for munkres::Position { row: i1, column: i2 } in result {
if i1 < ncommits1 {
if i2 < ncommits2 {
commits2_from1[i2] = Some(i1);
Expand Down

0 comments on commit daf949d

Please sign in to comment.