In the bad old days, it was difficult to keep track of source code when several people were working on the large project. Generally, a master copy of the source was kept somewhere, and you just had to be careful when you made changes. You had to make sure that Bill’s latest change didn’t replace Elizabeth’s recent bug fix. What if you made a bad change? You hoped that you had a backup tape. It wasn’t a very good system.
In this lab, we will use Subversion, which is a system of source code management. It’s used to maintain the history of software changes (or any other file, for that matter), and to permit multiple developers to collaborate on a large project.
Think of it this way: somebody creates an svn repository, somewhere. It contains a number of files and directories. Often, this will be a large open-source software project. Using svn, you check out a copy of these files (like checking out books from a library, except that this is a copy). You can also:
You access this repository in a variety of ways: using ssh, using local file access, etc.
Subversion clients are free, and exist for Windows, Linux, Mac, you-name-it.
Subversion commands are generally like this:
svn
subcommand optional-filename
First, we will use svn to examine the svn repository that holds the source code for the svn command itself. These operations may be slow, depending on how full the intertubes are at the moment.
cd
into it
svn co http
://svn.collab.net/repos/svn/trunk/doc/tools/dtd/docbook41
docbook41
, which will contain a number
of files, and another directory.
cd docbook41
ls -l
docbook.cat
: svn log docbook.cat | more
Let’s use a local svn repository, for the sake of speed.
I’ve created one in: /s/bach/a/class/cs253/pub/svntest
cd
into it
svn co file
:///s/bach/a/class/cs253/pub/svntest
cd svntest
ls -l
cd calc
ls -l
The instructor will now change a file in the repository:
README
svn diff README
svn ci README
Now, everybody update their own copies:
svn update
You ought to see something like this:
U README Updated to revision <number>.
Notice how you haven’t had to specify that awful file
:///s/bach/
...
path since first checking out the repository. That’s good.
When you do svn ci
, it will attempt to check in any files
that you’ve modified. If somebody else has changed the repository
version of that file after you checked yours out, then svi ci
or svi update
will give you an error message, and present
a number of options.
With the help of a student, the instructor will now create such a situation:
svn update
svn update
svn ci
svi ci
.
See http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.resolve for more information on how conflict resolution works.
There are many aspects to svn that haven’t been covered. Do svn help
for an overview, and svn help
subcommand for information on
any of the svn subcommands. Some of my favorites:
svn blame
filename
svn add
filename
svn delete
filename
Modified: 2009-04-04T20:38 User: Guest Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |