Why Do We Need It?
� How do you keep straight production vs. development code?
� How can you easily refer back to a previous version of a piece of code?
� If several people are working together on the same code, how can you keep straight who is editing what?
Possible Solutions
� Manual file copy
� You could do all of this just by making appropriate copies of files.
o May require various new tools installed (ftp, sftp, scp, �)
� Rsync
o A bit better than manual file management
o Is actively integrated with other solutions for distribution models
o Again doesn�t really fix the above problems
Real Solution � Source Code Management
� There are many such tools, the first of which were simply shell scripts on ancient Unix boxes such as RCS however the modern implementations are both robust and very stable to prevent code loss
� Key features provided by all major source code managers:
o Branching
� Needed to allow better management policy
o Check in, check out
� The basic means of getting the central code to you
� Generally a check in will tell you if something you modified conflicts with something else that has been changed since you last checked out (resolution varies based on tool)
o Merging branches
� After a branch is done being worked on (feature complete) you need to merge it back into the main branch
o Capacity to check out old revisions
� If you think an error appeared 10 revisions ago you can easily get that code and test it
� Most common ones today are CVS and SVN
o CVS
� Good
� Very well established and widely used
� Many CVS like kits are available
� TortoisCVS is a common Windows variant
� Supports modules
� Bad
� Slow
� No good integrated diff
� Requires a CVS server
� Can be difficult to administer
� Can only be distributed with RSYNC
o SVN
� Good
� Supposed to be, and is, CVS done right
� It supports more logical command functionality than CVS
� Example: support for recursive file move
� Bad
� It can be argued that the idea for CVS is flawed so CVS fixed is still flawed
� Again not distributed naturally
� Also requires a server where there is no official way to setup layout
� However both CVS and SVN suffer from the listed issues and simply aren�t good for every situation
� Introducing Git and Bazaar (and others such as Monotone)
o Both are distributed managers
� Allows you to get a branch and continue to commit even without internet
� Lets you manage your own repository on your own server
� When something is complete it may be moved back into the next most central node
o Git
� Developed by Linus Torvalds for the Linux kernel
� Makes policy easier as a manager can suddenly manage their own repository without having to interact
� Microsoft is an example of this being a problem where a change could take months to work its way into the main tree
� Makes geographic distribution simpler
� Provides all the usual source code management tools too
� Sadly Git is incredibly difficult to use
o Bazaar
� Developed for the Ubuntu project
� Essentially a stripped down Git
� Incredibly easy to use while maintaining mostly the same distribution features that Git has
Issues
� Once a management is chosen it is normally used for the whole of the project
� Poor repository design on a CVS or SVN server can have terrible consequences
o If the repo was designed for a single user and then grows there is no easy way to change the directory layout
� Policy must be developed for each project pending on a number of factors
o Number of developers
o Physical distribution of developers
o Multiple language or OS support
o Chosen management system
� Policy may include:
o Branching rules (when to branch, when not to branch)
o Naming schemes (for branches, folders, �)
o Folder architecture rules
o Commit rules
Other Uses
� Managing documentation
� Managing homework
� Easy remote backup solution
Bazaar Example
� Create the repository:
o bzr init .
� Add the current code
o bzr add
� Commit the first version
o bzr commit �m �Initial commit�
� Push repo up to zeus (Note: Loren Hoffman left this summer, this example won�t work but you see how it would.)
o bzr push sftp://lhoffman@ssh-server.eecs.wsu.edu/~/public_html/repo/proj
� Branch from central repo
o bzr branch http://www.eecs.wsu.edu/~lhoffman/repo/proj/
� Bazaar website: http://bazaar-vcs.org/�� CHECK IT OUT!!!