Bazaar

Bazaar

 




Wiki Tools

  • Find Page
  • Recent Changes
  • Page History
  • Attachments

Resting trees that can be updated remotely

Introduction

A resting tree is a directory with project files. Resting trees should not be edited by a user, and command that are normally used on a working tree, such as commit and revert, will not operate. Unlike working trees, resting trees can be updated when using remote protocols such as ftp.

User story

Tiana and Etienne have a simple website (just a bunch of html and image files) that they maintain. Currently their hosting only provides file storage that is updated by ftp, and can be accessed by http. They decide to start using bzr to version control their website. They create a branch, and they push this branch to the website. They want their website files to also be automatically updated when they push the branch. They don't need to work in the hosted tree.

Details

  • We need to save in the .bzr dir whether or not we are using a resting tree.
  • We need to save the last revision that the tree was updated to.
  • When we need to update, we look at the last revision we updated to. We then do a diff to the latest revision in the branch to work out what files have changed. Then we put the files that have changed. Do any renames and deletes.

Implementation details

  • We need new working tree format: without branch, repository, only with checkout.
  • Checkout contains only information about revision id it represents.
  • We need to have a way to asks remote working tree for revision id
  • We need to have a way to update remote working tree to any arbitrary revision id:
    1. calculate changes in files/dirs for two revisions at local machine
    2. prepare new versions for all changed files
    3. upload all new files first
    4. upload all changed files to server
    5. delete all old files
    6. update revision id pointer in .bzr control directory
Notes:
  1. steps 3-5 should allow repeat of actions, to support of operation resume in the case of connection break during operation. To support bad dial-up connection and big size of updates it's worth to implement logging of successfully finished operations somewhere in .bzr, so each next attempt to update remote working tree will skip already finished steps.
  2. rename could be implemented as add + delete

Discussion

I think support for remote or resting trees is nice-to-have thing but don't expect that it will be implemented and included to mainline soon. So better approach here is prototype support for remote tree in some plugin.

Gary, contact me if you want to write such plugin, probably I can help you.