Permalink
Browse files

I did not think of a case where there could be "unpulled" changes

  • Loading branch information...
tshepang committed Oct 20, 2017
1 parent 4f5f022 commit fc82fe9890cf3a8033fa78295308d888628caa39
Showing with 14 additions and 5 deletions.
  1. +3 −3 README.md
  2. +11 −2 src/main.rs
View
@@ -3,21 +3,21 @@
[![Linux build status](https://travis-ci.org/tshepang/mrh.svg?branch=master)](https://travis-ci.org/tshepang/mrh)
This tool crawls current and children directories for git repos,
and checks if there are changes that are not committed, or pushed.
and checks if there are changes that are not committed, pushed, or pulled.
Show all repos:
$ mrh
foo (2 changes, unpushed commits)
bar
baz (1 changes)
baz (unpulled commits)
qux
Show all repos that have uncommitted and/or unpushed changes:
$ mrh --changed
foo (2 changes, unpushed commits)
baz (1 changes)
baz (unpulled commits)
## notes
View
@@ -106,8 +106,17 @@ fn repo_ops(repo: &Repository, current_dir: &Path) {
let local_oid = branch.get().target().unwrap();
let remote_oid = remote_ref.target().unwrap();
if local_oid != remote_oid {
changes.push("unpushed commits".into());
};
if let Ok((ahead, behind)) =
repo.graph_ahead_behind(local_oid, remote_oid)
{
if ahead > 0 {
changes.push("unpushed commits".into());
}
if behind > 0 {
changes.push("unpulled commits".into());
}
}
}
}
if !changes.is_empty() {
println!("{} ({})", path.display(), changes.join(", "));

0 comments on commit fc82fe9

Please sign in to comment.