Search code examples
version-controlbazaar

bzr : Is it possible to switch between revisions offline?


I am using the "bzr update -r ${revisionNo}" command to switch between revisions. But it is slow and it seems to do network operations. Why?

I have checked out the whole repo so all revisions must be in my local. Why does it connect to network then?


Solution

  • This is somewhat speculative, but I would guess that you are working with a bound branch. A bound branch is still linked to the location that you checked out from and will consult it for certain operations. A bound branch is created if you use bzr checkout instead of bzr branch. It exists to simulate CVS- or subversion-like behavior, where you're operating on a central repository.

    Fast update is not supported because that's not the intended mode of operation for bound branches. You can revisit older revisions that you have stored locally using one of bzr checkout --lightweight, bzr export, or bzr revert, however.

    In order to work completely offline, you can use bzr unbind or bzr reconfigure --tree to convert an existing bound branch into an unbound branch. Warning: if you do this, you will have to push your commits explicitly with bzr push before they become visible in the remote repository. You can use bzr bind to make the branch bound again.

    And while it is unlikely, it is also possible to encounter such a scenario when creating a "stacked branch". A stacked branch reuses history from a different branch, and if that branch is not local, then most bzr operations will have to go through the network. It is created with bzr branch --stacked and is normally intended for use on a server to save space. You can convert a stacked branch into an unstacked branch with bzr reconfigure --unstacked.