Explain trees no-trees option

Asked by jsherk

Reading thru the tutorial, I noticed that (in the tutorial) when the repository is created on the local machine it uses "init-repo --trees" but when it is created on the remote machine it uses "init-repo --no-trees".

I read the help on this, which states:
  If the --no-trees option is given then the branches in the repository
  will not have working trees by default. They will still exist as
  directories on disk, but they will not have separate copies of the
  files at a certain revision. This can be useful for repositories that
  store branches which are interacted with through checkouts or remote
  branches, such as on a server.

Being new to Bazaar and revision control in general, I really don't understand what this means!

What is a "working tree" and why do I need it or not need it (in layman terms)?

Is the tutorial method normally how most people would set it up?

I need to rely on the remote machine (not my local machine) to keep all the revision history. Is that what this does?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Vincent Ladeuil
Solved:
Last query:
Last reply:
Revision history for this message
Vincent Ladeuil (vila) said :
#1

A working tree is where the files you're modifying reside.
A revision is a snapshot of a working tree and its parent revisions (i.e. what was modified in the parent revision(s) to obtain this new state).
A repository is where all the revisions are stored.
A branch is a pointer in the revision graph defining the whole history of a development line.

http://wiki.bazaar.canonical.com/MatthewFuller/SpotDocs/PiecesInBrief explains this with more words and we should certainly include it in our documentation.

Revision history for this message
Best Vincent Ladeuil (vila) said :
#2

Hmm, I forgot to mention: depending on how you plan to use a branch, you don't necessarily need a working tree.

If nobody "works" (as in edit files) on the remote server, there is no need for trees there, so when you create a repository with the --no-trees option you instruct bzr that all branches that will be created under this repository don't need a working tree. They only need the minimum data to describe the branch, the pointer into the revision graph.

Various workflows use various setups regarding where the working trees and the branches (and their associated repository) are located.

All directories managed with bzr store their data into a '.bzr' directory.

A repository creates a 'repository' subdirectory in '.bzr'.
A branch creates a 'branch' subdirectory in '.bzr'.
A working tree creates a 'checkout' subdirectory in '.bzr'.

Branches that share a repository (when they are part of the same project, many revisions are common) will not define a 'repository' subdirectory in their own '.bzr' directory but will instead find it by walking up the file system hierarchy: for example 'project' will contain a '.bzr/repository' folder while 'project/trunk/', 'project/bugs/fix-gui' and 'project/features/new-back-end' will contain a '.bzr/branch' folder but no '.bzr/repository' folder.

Standalone branches will contain 'checkout', 'branch' and 'repository' folders.

Lightweight checkout will contain only a 'checkout' folder and will point to a '.bzr/branch' folder somewhere else (including a remote server).

Etc.

Revision history for this message
jsherk (jeff-forerunnertv) said :
#3

Thanks Vincent Ladeuil, that solved my question.

Revision history for this message
jsherk (jeff-forerunnertv) said :
#4

That helps considerably... I think I understand now!