Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Pkg.status(pkg_name) #1883

Merged
merged 2 commits into from
Jan 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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