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 version control? 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! Merge 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 Darcs, BitKeeper, Git, Mercurial, SVK, Monotone, . . .
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/Linux, UNIX, 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 commit 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 diff 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, Codeville, Darcs, Git, eclipse, . . . Mercurial, Monotone, Perforce, 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