<<

Version Version Management Management with Bazaar with Bazaar Outline Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example

Looking Version Management with Bazaar Looking deeper deeper

Getting A helping hand for tracking changes in your les Getting ˆ What is Bazaar? started started

Cooperating Cooperating ˆ What is Bazaar good for? More stu More stu ˆ A small sample session Joakim Lindblad Conclusions Conclusions [email protected] ˆ Getting started with Bazaar ˆ More features. . . Centre for Image Analysis ˆ Conclusions

2007-10-29

Version Version Management Management with Bazaar What is Bazaar? with Bazaar What is ? Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example http://en.wikipedia.org/wiki/Revision_control Looking Looking deeper deeper

Getting Getting started started Revision control (also known as version control (system) (VCS), http://bazaar-vcs.org/ Cooperating Cooperating source control or (source) code management (SCM)) is the

More stu More stu management of multiple revisions of the same unit of

Conclusions Bazaar is a distributed version control system available Conclusions information. under the GPL that reduces barriers to participation in your In computer software engineering, revision control is any project. practice that tracks and provides control over changes to source code. Software tools for revision control are increasingly recognized as being necessary for the organization of multi-developer projects.

Version Version Management Management with Bazaar What is version control good for? with Bazaar Why use Bazaar instead of. . . ? Joakim Joakim Lindblad Lindblad

Motivation A version control system keeps a history of the changes made to Motivation Example a set of les. Example Looking Looking deeper It answers questions like: deeper

Getting Getting started ˆ What has happened with this project since last week? started Cooperating ˆ Who changed what and when? Cooperating More stu More stu CVS, Subversion (svn), Visual SourceSafe, . . . ˆ What other changes did they make at the same time? Conclusions Conclusions And can perform actions like: ˆ Take me back to how the project looked last Tuesday! ˆ the changes Lisa did on the text with those that I did last night! It keeps track of all changes made to the les of a project during its entire lifetime. Version Version Management Management with Bazaar Distributed revision control with Bazaar Why use Bazaar instead of. . . ? (II) Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example

Looking Looking deeper deeper , BitKeeper, , , SVK, , . . .

Getting Getting started Distributed revision control takes a peer-to-peer approach, started I've tried cvs, svn, and darcs. . . Cooperating as opposed to the client-server approach of centralized Cooperating

More stu systems. Rather than a single, central repository on which More stu

Conclusions clients synchronize, each peer's working copy of the codebase is Conclusions Important is not what revision control software you use, but a repository. Synchronization is conducted by exchanging that you actually use it. patches (change-sets) from peer to peer. I think Bazaar is a good choice ,

Version Version Management Management with Bazaar Bazaar priorities with Bazaar A sample session Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example Looking ˆ Good performance Looking deeper deeper Arriving to work. . . Getting ˆ Safe with your data  No reported data loss bugs in the Getting started past two years. started $ cd my_project Cooperating Cooperating $ bzr update More stu ˆ Friendly  Bazaar "Just Works" More stu Tree is up to date at revision 5. Conclusions ˆ Free  Bzr is available under the GPL v2 or later. Conclusions $ ls -A ˆ Easy to integrate  Python API .bzr Makefile main.c parser.c Bazaar is designed to support GNU/, , Windows and the Mac OS. hack away at `main.c' . . . "If you can run Python 2.4, then you can run Bazaar."

Version Version Management Management with Bazaar Committing your changes with Bazaar Ok, there is more to it Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example

Looking $ bzr Looking deeper deeper $ make Getting $EDITOR: enter a log message Getting started started gcc -o glurk main.c parser.c Cooperating Alternatively: Cooperating main.c: In function 'main': More stu More stu main.c:2: warning: incompatible implicit Conclusions $ bzr commit -m "Print Hello world" Conclusions declaration of built-in function 'printf' modified main.c Committed revision 6. grmbl. . . What went wrong? That is all! , Version Version Management Management with Bazaar What has changed? with Bazaar Help! Joakim Joakim Lindblad Lindblad

Motivation Motivation Example Example $ bzr help Looking Looking usage: bzr diff [FILE...] deeper deeper aliases: di, dif Getting Getting started Compare current situation with what is commited: started Show differences in the working tree or between

Cooperating Cooperating revisions. ... More stu $ bzr diff More stu ... Conclusions $ Conclusions examples: No changes! bzr diff Shows the difference in the working tree versus the last commit bzr diff -r1 Difference between the working tree and revision 1 ...

Version Version Management Management with Bazaar Di again with Bazaar Syntax Joakim Joakim Lindblad Lindblad

Motivation Motivation Example $ bzr diff -r 5 Example Looking === modified file 'main.c' Looking deeper - main.c 2007-10-28 23:39:20 +0000 deeper $ bzr [opts] command [opts] [args] Getting Getting started +++ main.c 2007-10-28 23:44:32 +0000 started -1,1 +1,4 Cooperating Cooperating -int main() {return 0;} ˆ Commands More stu More stu +int main() { ˆ update  Upgrade branch storage to current format. Conclusions Conclusions + printf("Hello world!"); ˆ commit  Commit changes into a new revision. + return 0; ˆ diff  Show dierences in the working tree or between +} revisions. ˆ help  how help on a command or other topic. Negative numbers count from the latest revision, -1 is the last committed revision. You can also do things like bzr diff -r date:yesterday

Version Version Management Management with Bazaar Take me back! with Bazaar Take me back for real! Joakim Joakim Lindblad Lindblad

Motivation Motivation $ bzr revert Example Example M main.c $ bzr status Looking Looking deeper $ bzr uncommit deeper Removes changes made! Warning Getting 6 Joakim Lindblad 2007-10-29 Getting started started Print Hello world $ bzr help revert Cooperating Cooperating The above revision(s) will be removed. ... More stu Are you sure [y/N]? y More stu Conclusions Conclusions By default, any files that have been manually changed will be backed up first. (Files changed only by merge $ bzr status are not backed up.) Backup files have '.£#£' appended modified: to their name, where # is a number. main.c Puh!

Bazaar is nice to you , Version Version Management Management with Bazaar How does it work? with Bazaar Where do I nd information? Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example

Looking Looking deeper deeper

Getting Getting started As opposed to centralized revision control systems, Bazaar keeps started Cooperating Cooperating the repository in the working directory, in the directory .bzr. More stu More stu

Conclusions We don't need to know how data is stored in the repository. It Conclusions keeps all information from the beginning of times! ,

Version Version Management Management with Bazaar More useful commands with Bazaar Solo workow Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example

Looking Looking deeper ˆ bzr help commands  lists all commands deeper Getting ˆ bzr init  create new project Getting started started

Cooperating ˆ bzr add [file]  add new le Cooperating More stu ˆ bzr log  show project log More stu Conclusions Conclusions ˆ bzr whoami  show or set user id ˆ bzr annotate  show the origin of each line in a le ˆ bzr mv  move or rename a le ˆ bzr ignore file  ignore le

Version Version Management Management with Bazaar Partner workow with Bazaar Working with others Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example

Looking Looking deeper deeper

Getting Getting started started Cooperating Cooperating ˆ branch  Create a new copy of a branch. More stu More stu ˆ merge  Perform a three-way merge. Conclusions Conclusions ˆ resolve  Mark a conict as resolved. Version Version Management Management with Bazaar 3 way merging with Bazaar Conicts Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example

Looking Looking deeper To intelligently merge changes, the content of the "best deeper ˆ Some merges can only be completed with the assistance of Getting Getting started common ancestor" is considered started a human Cooperating Given ancestor A and branches B and C: Cooperating More stu More stu ˆ The merge command reports these les as having conicts ˆ A B C then line unchanged Conclusions = = Conclusions and creates: a le with embedded markers showing the ˆ A = B 6= C then take line from C areas it couldn't resolve three les to assist you: ˆ A = C 6= B then takes line from B ˆ foo.THIS ˆ foo.OTHER ˆ A B C then conict! 6= 6= ˆ foo.BASE

Version Version Management Management with Bazaar Resolving conicts with Bazaar Sharing your work Joakim Joakim Lindblad Lindblad

Motivation Motivation ˆ push  Update a mirror of this branch. Example $ cat main.c Example $ bzr merge ../my_branch/ int main() { ˆ pull  Turn this branch into a mirror of another branch. Looking M main.c Looking deeper TREE deeper Text conflict in main.c <<<<<<< Getting printf("Goodbye world!"); Getting Example: started 1 conflicts encountered. started ======bzr push sftp://majestix.cb.uu.se/£/bzr/my_project $ ls -A Cooperating printf("Hello world!"); Cooperating .bzr Makefile main.c Pull and push automatically to keep things in sync. More stu MERGE-SOURCE More stu main.c.BASE main.c.OTHER >>>>>>> Conclusions return 0; Conclusions main.c.THIS parser.c ˆ checkout  Create a new checkout of an existing branch. } ˆ bind  Convert the current branch into a checkout of the supplied branch. After editing to clear up the mess: ˆ unbind  Convert the current checkout into a regular $ bzr resolve branch. $ bzr commit -m "Merged to Hello and goodbye" When disconnected from the master branch (e.g. on the road), commits can still be made locally: bzr commit local

Version Version Management Management with Bazaar Centralized workow with Bazaar Centralized workow Joakim Joakim Lindblad Lindblad Disconnected at times Motivation Motivation

Example Example

Looking Looking deeper deeper

Getting Getting started started

Cooperating Cooperating

More stu More stu

Conclusions Conclusions Version Version Management Management with Bazaar Migrating from other tools with Bazaar More features. . . Joakim Joakim Lindblad Lindblad

Motivation Motivation

Example Example

Looking Looking deeper deeper Getting I have successfully used Tailor to move from CVS to Bazaar. Getting started started ˆ Plugins  extending Bazaars Cooperating Cooperating abilities More stu http://progetti.arstecnica.it/tailor More stu Conclusions Conclusions ˆ Editor Integration  emacs, Supports: ArX, Bazaar, Bazaar-NG, CVS, , Darcs, Git, eclipse, . . . Mercurial, Monotone, , Subversion and Tla repositories. ˆ GUIs  bzr-gtk, tortoiseBZR, nautilus-bzr

Version Version Management Management with Bazaar Bazaar at CBA with Bazaar Conclusions Joakim Joakim Lindblad Lindblad Add the following to your environment Motivation (£/.login or £/.bash_profile) Motivation Example Example Working on larger projects, by yourself or with others, version Looking ˆ PYTHONPATH = /usr/local/bzr/lib64/python Looking control software can be a very useful tool. deeper deeper ˆ Getting PATH = /usr/local/bzr/bin Getting I use Bazaar practically every day, because it helps me to keep started started ˆ MANPATH = /usr/local/bzr/man Cooperating Cooperating order among my les. Maybe it can help you too

More stu More stu I've writen two scripts , Conclusions Conclusions http://bazaar-vcs.org/ ˆ ~joakim/local/noarch/bin/bzrdirs  print all Bazaar versioned directories ˆ ~joakim/local/noarch/bin/bzrall  run command in all Bazaar repositories These slides where made with the aid of wiki2beamer Example: http://wiki2beamer.sf.net $ bzrall -r update