Skip to content

Commit

Permalink
More verbose Pkg.update() for checked out packages
Browse files Browse the repository at this point in the history
Just like how "free" packages display which versions they're updating from and to, display the git SHA for checked out packages as they are updated.  Here's a real-life example:

```txt
julia> Pkg.update()
INFO: Updating METADATA...
INFO: Updating Interpolations master...
INFO: Updating Tuples master...
INFO: Skipping TerminalExtensions (dirty)...
INFO: Updating AxisArrays master...
INFO: Updating Compat master...
INFO: Updating IntSets master...
INFO: Updating HDF5 master...
INFO: Skipping BitSets (dirty)...
INFO: Updating DataArrays master... b5d39c3 => c588781
INFO: Skipping Signals (dirty)...
INFO: Updating KDTrees master...
INFO: Updating FileIO master...
INFO: Skipping SmallDicts (dirty)...
INFO: Updating BinDeps master...
INFO: Updating DataFrames master...
INFO: Updating SIUnits master...
INFO: Updating Homebrew master...
INFO: Computing changes...
INFO: No packages to install, update or remove
```

To be honest, I was totally unaware of how many packages I had that were either dirty or happened to be on a custom branch before I made this change (DataArrays is only updating because I had been on a custom branch until I started printing out the branch names).  This also prints out the before and after SHA if there was a change.
  • Loading branch information
mbauman committed Jun 26, 2015
1 parent 412918a commit fc6ce3c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions base/pkg/entry.jl
Expand Up @@ -290,11 +290,19 @@ function update(branch::AbstractString)
for (pkg,ver) in fixed
ispath(pkg,".git") || continue
begin
if Git.attached(dir=pkg) && !Git.dirty(dir=pkg)
info("Updating $pkg...")
@recover begin
Git.run(`fetch -q --all`, dir=pkg)
Git.success(`pull -q --ff-only`, dir=pkg) # suppress output
if Git.attached(dir=pkg)
if Git.dirty(dir=pkg)
info("Skipping $pkg (dirty)...")
else
prev_sha = chomp(Git.readall(`rev-parse --short HEAD`, dir=pkg))
@recover begin
Git.run(`fetch -q --all`, dir=pkg)
Git.success(`pull -q --ff-only`, dir=pkg) # suppress output
end
post_sha = chomp(Git.readall(`rev-parse --short HEAD`, dir=pkg))
branch = chomp(Git.readall(`rev-parse --abbrev-ref HEAD`, dir=pkg))
info("Updating $pkg $branch...",
prev_sha != post_sha ? " $prev_sha => $post_sha" : "")
end
end
if haskey(avail,pkg)
Expand Down

0 comments on commit fc6ce3c

Please sign in to comment.