bazaar remote stacked branches with "working tree"

74 views Asked by At

I've worked w/bzr (bazaar vcs) for some time, and decided to rebranch a number of apps as stacked-on a core trunk (to help conserver history resources).

For published web apps, the workflow included

bzr push bzr-ssh://<server>/var/www/<remote-branch-name>

followed by bzr checkout on the server to get a working tree.

With this new stacked paradigm, I of course wanted to push a stacked branch to the server, AND have a working tree to serve out of, but this does not seem possible?

bzr push --stacked -d <branch> <remote>

will happily create a new stacked branch on the server, but, from the server:

  • bzr info shows no parent
  • bzr checkout results in bzr: ERROR: Not a branch

Net, no working tree :|

Ultimately, I just deleted the new remote branch and went back and omitted the --stacked.

Still wondering if I missed something?

1

There are 1 answers

0
Aaron Bentley On

I'll explain about stacked branches, but below I recommend that you use a shared repository instead.

It doesn't matter whether "bzr info" shows a parent. It needs to show a stacked-on branch.

In the example below, the "stacked on" is key:

bzr info bzr+ssh://teeny/~/bzr
Standalone branch (format: unnamed)                                            
Location:
  branch root: bzr+ssh://teeny/~/bzr/

Related branches:
  parent branch: bzr
     stacked on: http://bazaar.launchpad.net/~abentley/bzr/branches-uncommitted

Bazaar tries to determine which branch to stack on. It should print that as part of the push output.

If it gets it wrong, you can override it with --stack-on. Remember that the branch you stack on must be at least as public as the branch you're pushing.

But I recommend shared repository, not stacked branches, for saving space. It is more efficient and more user-friendly. Bazaar will automatically use a shared repository if it finds one that encompasses the target location. For example "bzr init-repo bzr+ssh:///var/www/" will create a shared repository that will be automatically used by all branches under /var/www.

Stacked branches exist to solve privacy concerns. If some of the branches at /var/www are private, then a shared repository is a risk, because it will contain revisions from those private branches. The main reason Launchpad uses stacked branches is because Launchpad supports private branches. A private branch stacked on a public branch saves space without leaking private revisions into the public branch. It uses stacking by default because a public branch may be made private after its initial push.