User talk:Rtownsend

From Warwick Student Cinema
Jump to: navigation, search

[Note, this is not finished yet.]

About Bazaar

Bazaar is a distributed source control system, similar to git or mercurial. It's used on the various projects embarked upon by the IT team. Bazaar

  1. keeps track of every old version of every file and
  2. merges different versions of the code, so that team-mates can work independently on the code and merge their changes later.

Bazaar differs from Subversion

Instead of simply storing snapshots of files, like Subversion, Bazaar stores a list of changes made to every file since it was added to the repository.

Using Bazaar

Note: You can install Bazaar from here[1].

Setting up Bazaar

Before you can commit using Bazaar, you'll need to tell it who you are. To do this, type bzr whoami "name <email]>"' e.g. bzr whoami "Richard Townsend <Richard.Townsend@warwick.ac.uk>".

Command-line

Most people work with Bazaar through the command line, which runs on Windows, Mac and Linux. The command for Bazaar is bzr Running bzr on its own gives you this:

richard-townsends-macbook:htdocs anonymous500r$ bzr
Bazaar 2.2.0 -- a free distributed version-control tool
http://www.bazaar.canonical.com/

Basic commands:
  bzr init           makes this directory a versioned branch
  bzr branch         make a copy of another branch

  bzr add            make files or directories versioned
  bzr ignore         ignore a file or pattern
  bzr mv             move or rename a versioned file

  bzr status         summarize changes in working copy
  bzr diff           show detailed diffs

  bzr merge          pull in changes from another branch
  bzr commit         save some or all changes
  bzr send           send changes via email

  bzr log            show history of changes
  bzr check          validate storage

  bzr help init      more help on e.g. init command
  bzr help commands  list all commands
  bzr help topics    list all help topics

Workflow: Checking out

In bazaar, checking out gives you a complete copy of the repository, containing everyone's changes from forever. Bazaar can checkout over sftp to your local computer, or from another part of the server (if you're logged in using a shell). The syntax for the command is bzr checkout remote_path [local path]

richard-townsends-macbook:htdocs anonymous500r$ bzr checkout sftp://csukak@filmsoc.warwick.ac.uk//srv/bzr/website-v3-php/dev /Applications/MAMP/htdocs
csukak@filmsoc.warwick.ac.uk's password: 
Format RepositoryFormatKnit1() for file:///Applications/MAMP/htdocs/.bzr/ is deprecated - please use 'bzr upgrade' to get better performance
richard-townsends-macbook:htdocs anonymous500r$         

Workflow: Making changes

Once you've checked out the repository, the first thing to do is unlink your local copy with bzr unbind. This means that you can commit on your own computer, so if your network connection goes down, you can still save your work, and other people are less likely to be affected if your work doesn't work. You can then get to work! Bazaar will notice if you change any of the files it tracks. You can see what's going on at any time using the bzr status command.


richard-townsends-macbook:htdocs anonymous500r$ bzr status
modified:
  process.php

Don't be afraid to commit! Even if your code doesn't work yet, it's a great way of saving where you are. An additional benefit of using Bazaar is that you can use version control without making your changes available to anyone else until they're ready. To commit the change to my local repository, I type bzr commit -m <description of changes> [<list of files for selective commit>]. Bazaar then computes the differences between your version and the previous version and saves the changes to the repository.

You can make as many changes as you want to, and commit as many times as you need to before you commit the repository. Type bzr bind and then bzr commit to send all the changes made to the central repository.

Workflow: Merging