How to switch to a different branch in new Pkg?

I am trying to start updating my packages to 0.7, but I want to still be able to compare them to the 0.6 versions to detect regressions etc. This means that I want to have the same local git repo for both Julia versions.

I thought I figured it out, and the answer was simply using #. This is what I did, in Julia 0.7:

(v0.7) pkg> status
    Status `C:\Users\datseris\.julia\environments\v0.7\Project.toml`
  [189a3867] Reexport v0.1.0
  [ae029012] Requires v0.4.3
  [90137ffa] StaticArrays v0.7.0

(v0.7) pkg> add C:\Users\datseris\.julia\v0.6\DynamicalBilliards#0.7
  Updating git-repo `C:\Users\datseris\.julia\v0.6\DynamicalBilliards`
┌ Warning: packages will require to have a [Julia]Project.toml file in the future
└ @ Pkg.Types Types.jl:817
  Updating registry at `C:\Users\datseris\.julia\registries\Uncurated`
  Updating git-repo `https://github.com/JuliaRegistries/Uncurated.git`
 Resolving package versions...
  Updating `C:\Users\datseris\.julia\environments\v0.7\Project.toml`
  [4986ee89] + DynamicalBilliards v1.6.3+ #0.7 [C:\Users\datseris\.julia\v0.6\DynamicalBilliards]
  Updating `C:\Users\datseris\.julia\environments\v0.7\Manifest.toml`
  [4986ee89] + DynamicalBilliards v1.6.3+ #0.7 [C:\Users\datseris\.julia\v0.6\DynamicalBilliards]
  [1914dd2f] + MacroTools v0.4.1
  [9602ed7d] + Unrolled v0.0.2

This already shows that something went wrong. In the 0.7 branch, which I believed I tagged out, there is no Unrolled package in the REQUIRE file, or in the source code.

Now here comes the actual big problem. When doing

julia> using DynamicalBilliards
[ Info: Precompiling module DynamicalBilliards
┌ Warning: Deprecated syntax `(loopbody...)` at C:\Users\datseris\.julia\packages\Unrolled\eA4l\src\Unrolled.jl:33.
│ Use `(loopbody...,)` instead.
└ @ nothing Unrolled.jl:33
ERROR: LoadError: syntax: expected ")"
...
...
...

Julia tries to load Unrolled, which definitely does not correspond with the source code in the 0.7 branch that I have hoped to have checked-out to.

So, how do I do it?

I encountered similar problems with local (unregistered) packages - the requested commit was not actually checked out. There is a related issue for Pkg.

To quote @kristoffer.carlsson in that issue,

The package manager is not a full git client. Just go to [your local repo] and do whatever git operations you want.

Also, I think you probably want pkg> develop rather than pkg> add for this situation.

add is for when you want to track a remote or local repo (e.g a branch). This requires you to update to pull the latest commits on that branch. develop is for when you want to track a certain path.

2 Likes

Thanks both. The answer is indeed to use pkg> develop C:\Users\datseris\.julia\v0.6\DynamicalBilliards#0.7 instead of add