Skip to content

Commit

Permalink
Merge pull request #1883 from WestleyArgentum/pkg
Browse files Browse the repository at this point in the history
added Pkg.status(pkg_name)
  • Loading branch information
StefanKarpinski committed Jan 4, 2013
2 parents 55eabd5 + 2e8cba6 commit 3c2facc
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions base/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,31 @@ function cd_pkgdir(f::Function)
cd(f,dir)
end

function print_pkg_status(pkg::String, path::String)
if !isdir(path)
error("Package repository $path doesn't exist")
end

cd(path) do
head = Git.head()
ver = Git.attached() ? Git.branch() : cd("..") do
Metadata.version(pkg,head)
end
dirty = Git.dirty() ? " (dirty)" : ""
println("$(rpad(pkg,16)) $ver$dirty")
end
end

# show the status packages in the repo

status() = cd_pkgdir() do
Git.each_submodule(false) do pkg, path, sha1
cd(path) do
head = Git.head()
ver = Git.attached() ? Git.branch() : cd("..") do
Metadata.version(pkg,head)
end
dirty = Git.dirty() ? " (dirty)" : ""
println("$(rpad(pkg,16)) $ver$dirty")
end
print_pkg_status(pkg, path)
end
end

status(pkg::String) = print_pkg_status(pkg, "$(julia_pkgdir())/$pkg")

# create a new empty packge repository

function init(meta::String)
Expand Down

0 comments on commit 3c2facc

Please sign in to comment.