RevisionControl
Revision Control is a process for tracking changes made to an individual file or an entire directory tree. It is commonly used during development of large programs when it is helpful to log changes to the many files that might change as the result of a large programming project. It is similarly useful for small (single user) projects. Another use might be for tracking changes in parameter files during a period of parameter exploration with an existing program.
These are 3 common programs for Revision Control:
- SCCS/RCS (Revision Control System): "The Revision Control System (RCS) manages multiple revisions of files. RCS automates the storing, retrieval, logging, identification, and merging of revisions. RCS is useful for text that is revised frequently, for example programs, documentation, graphics, papers, and form letters." Note that 'SCCS' is an older version of RCS and is no longer used.
- ci ("check in"): used to copy any changes in the file since the last 'ci' into the RCS archive file. The archive file will be stored in the subdirectory called 'RCS' (if it exists) and with have a ',v' appended to the file name. Note that when a file is checked into the archive, the user is prompted for a description of the changes. This is appended to a log that is also stored in the archive. 'ci' can also be used to create the archive.
-
[fisher@jkim25]$ ci foo.c
- co ("check out"): used to retrieve a copy of the file from the archive for more editing. If the "-l" (locked) flag is not used then the file is retrieved as read-only, with the "-l" flag the RCS archive is then locked and the file is retrieved as writeable. The RCS archive is unlocked again when the file is checked back in with "ci". Thus preventing multiple people from simultaneously editing the same file. Note that 'co' can be used to check out any previous version of the file.
-
[fisher@jkim25]$ co foo.c
[fisher@jkim25]$ co -l foo.c
- rcsdiff ("rcs diff"): used to compare any two versions of the file in a 'diff' like fashion. This is often used to compare the currently edited version to the most recent archived version.
-
[fisher@jkim25]$ rcsdiff foo.c
[fisher@jkim25]$ rcsdiff -r 1.4 foo.c
[fisher@jkim25]$ rcsdiff -r 1.3 -r 1.5 foo.c
- rlog ("rcs log"): used to view the log entries for the archive. This is useful when seeking specific changes that have been made to a file.
-
[fisher@jkim25]$ rlog foo.c
- CVS (Concurrent Versions System): "CVS is a version control system, which allows you to keep old versions of files (usually source code), keep a log of who, when, and why changes occurred, etc., like RCS or SCCS. Unlike the simpler systems, CVS does not just operate on one file at a time or one directory at a time, but operates on hierarchical collections of directories consisting of version controlled files. CVS helps to manage releases and to control the concurrent editing of source files among multiple authors. CVS allows triggers to enable/log/control various operations and works well over a wide area network."
- The CVS commands are very similar to the RCS commands, you just prepend "cvs" to them. For example, to checkin a document you'd type:
cvs ci documentname
. However, first your need to setup a repository. see the link below ("Open source Development with CVS") for an explanation of how to setup the repository.
- A very good introduction to CVS is "Open source Development with CVS" available here: http://cvsbook.red-bean.com/cvsbook.html.
- Read the section entitled "A Day with CVS" (takes about 10 mins) to get started and have a good sense of the possibilities. Once you've gained a little familiarity with CVS you can refer back to the book for doing fancier things.
- For a Windows version of CVS see:
- On Linux to extract a cvs archive to the current directory:
- cvs -d
checkout .
- cvs -d
- Subversion: "The goal of the Subversion project is to build a version control system that is a compelling replacement for CVS in the open source community."
- Free book for SVN: http://svnbook.red-bean.com/
- Old SVN website: http://subversion.tigris.org/
- New SVN website: http://subversion.apache.org/
- Random blog with some command examples: http://pointbeing.net/weblog/2009/03/command-line-subversion-tutorial-part-1.html
- Create SVN Repository
-
[fisher@kimclust15]$ svnadmin create /home/fisher/svn
- Import files from directory called 'foo' into SVN Repository
-
[fisher@kimclust15]$ svn import foo file:///home/fisher/svn --message 'Initial Import'
- Checkout files from SVN Repository to directory called foo
-
[fisher@kimclust15]$ svn checkout file:///home/fisher/svn foo'
- Accessing SVN via ssh (ex from the Mac command line):
-
[fisher@sf-mbp]$ svn list svn+ssh://fisher@kim.bio.upenn.edu/home/user/svn
- Huge list of SVN clients: http://en.wikipedia.org/wiki/Subcommander
- For Mac development, SVN is included in XCode.
- If working with XCode, you may want to remove {user}.pbxuser and {user}.mode1v3 files from repository. Can put {default} versions in repository.
- SVN client that works within Finder (this does not work with 10.6.5): http://scplugin.tigris.org/