Skip to content

Commit

Permalink
Pkg.tag: read requires from the given commit, not head.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Sep 14, 2013
1 parent d32bc80 commit aa67d8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions base/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,21 @@ tag(pkg::String, ver::Union(Symbol,VersionNumber)=:bump;
registered || return
try
info("Writing METADATA for $pkg v$ver")
reqs = Reqs.parse(joinpath(pkg,"REQUIRE"))
reqs = Reqs.parse(Git.cmd(`cat-file blob $commit:REQUIRE`,dir=pkg))
cd("METADATA") do
Git.transact() do
d = joinpath(pkg,"versions",string(ver))
mkpath(d)
open(io->println(io,commit), joinpath(d,"sha1"), "w")
isempty(reqs) || Reqs.write(joinpath(d,"requires"), reqs)
Git.run(`add $d`)
sha1file = joinpath(d,"sha1")
open(io->println(io,commit), sha1file, "w")
Git.run(`add $sha1file`)
reqsfile = joinpath(d,"requires")
if isempty(reqs)
ispath(reqsfile) && Git.run(`rm -f -q $reqsfile`)
else
Reqs.write(reqsfile,reqs)
Git.run(`add $reqsfile`)
end
end
end
catch
Expand Down
4 changes: 2 additions & 2 deletions base/pkg/reqs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ end

# general machinery for parsing REQUIRE files

function read(io::IO)
function read(readable::Union(IO,Base.AbstractCmd))
lines = Line[]
for line in eachline(io)
for line in eachline(readable)
line = chomp(line)
push!(lines, ismatch(r"^\s*(?:#|$)", line) ? Comment(line) : Requirement(line))
end
Expand Down

0 comments on commit aa67d8f

Please sign in to comment.