How to put trees back into a no-trees repository?

Asked by Ivan Vilata i Balaguer

I created a repository with the --no-trees option a while ago and now I would like to publish it via HTTP so that people can also have a look at the files in it directly on their browser without needing bzr. I'd like to end up with a repo with working trees, as if I had used the --trees option to begin with.

I've seen that a command has been suggested (http://bazaar-vcs.org/DraftSpecs/SwitchRepositoryTreesSetting), but I can't find what the recommended manual process is right now, so I thought that having this as an answer in Launchpad would be useful to people.

I guess that the working trees resulting repo won't be automatically updated, but I can cope with that (maybe a scheduled task on the server may do the trick). Tanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
John A Meinel
Solved:
Last query:
Last reply:
Revision history for this message
Best John A Meinel (jameinel) said :
#1

There are a few ways to do it.

1) Even if the repository has the '--no-trees' flag, you can still create a tree by using

   cd repo/branch
   bzr checkout .

This will create a working tree for the given branch in the same location. The repository setting is only about what the *default* for all branches will be.

2) At the moment, you can "rm .bzr/repository/no-working-trees". That file is the flag we use to determine the default for branches.

However, 'bzr push' will not create a remote working tree, since it does not update it. So even if you have done (2), if you create a new branch with "bzr push" you still need to do step (1). (And I believe "bzr branch . REMOTE", will try to create a working tree, but fail, so you also need to do step (1)).

There is a 'push-and-update' plugin if you are accessing the remote branches through ssh (sftp/bzr+ssh)
https://launchpad.net/bzr-push-and-update

It checks to see if the remote target has a WT, and if so, runs "ssh host bzr update /path/to/tree".

There is a desire to change how the plugin functions, so that rather than adding a new command, it just ties into the existing post-push hook. (It was just written before that hook existed)

One further thing, "bzr push-and-update sftp://host/new/branch" won't create a WT either. Because it was desirable to have push-and-update work on existing branches (that don't have a WT to update). I'm not sure how to put in a flag that says "for these locations also create a WT on a new branch, but not for these". We have some possibilities based on ~/.bazaar/locations.conf, but certainly nothing has been implemented yet.

To make it clear, a cron job that just runs "bzr update" in the branches will also work, and means you don't have to have your users install a plugin and make sure they run "bzr push-and-update" instead of "bzr push".

Revision history for this message
Ivan Vilata i Balaguer (ivilata) said :
#2

Thanks John A Meinel, that solved my question.