Pkg2: some tweaks I've had lying around forever.
Pkg2.{checkout,release}: factor out a little common checkout code.
fix #3896
Merge github.com:JuliaLang/julia