Making the Jump to Subversion
Pages: 1, 2, 3
4.3 Committing changes.
When you are ready to commit the changes you've made to your local work area and share them with the rest of your team, you need to commit those changes to the repository. Take a look at the status of your work area to verify what changes will be committed to the repository:
svn status
Before you commit your changes, you'll need to make sure your work area is up-to-date with the latest version of the repository (using svn update). And once everything looks ready to go, commit your project work area via the following command:
svn commit -m "Look at all the work I did"
You can optionally select files individually or in groups by specifying them in the command as follows:
svn commit -m "Look at some of the work I did" ./README.txt
4.4 Conflict resolution.
If you've made changes to a file, and your changes conflict with the changes it has in the repository, you won't be able to check in your changes until you resolve them (see page 28, Resolve Conflicts). When you attempt to update, Subversion will create three temporary copies of the file experiencing conflict:
filename.mine (your version – pre-update)
filename.r<OLDREV> (the version before you made your changes)
filename.r<NEWREV> (the newest revision from the repository)
It is now up to you to manually edit the filename file using the other three temporary files as reference to merge the changes from your version and the new repository version. Once this is finished let Subversion know the conflict is resolved by issuing the command:
svn resolved filename
This will delete the .mine, .r<OLDREV> and .r<NEWREV> copies of the file and you will be able to proceed with checking in your changes.
Conclusion
Congratulations! You've set up an industrial-strength revision control system, one that is secure, fast, flexible, and free.
Subversion and Apache provide a myriad of options and configurations that can be tailored to suit just about any type of organization's or individual's needs. The setup described in this article is designed to get you up and running with a solid, secure configuration with as little administrative overhead as possible. I hope that once you become comfortable with this basic configuration you will explore the many ways of enhancing your use of Subversion.
|
Related Reading
Version Control with Subversion |
Resources and Tips
Some useful resources and links:
- The Subversion book online
- Version Control with Subversion
- Converting a project from CVS to Subversion
- Official Subversion Project Site
- Subversion Project Links
- Subversion FAQ
- Linux Journal: Setting Up Subversion for One or Multiple Projects
- Setting up HTTPS on OS X
- Setting up HTTPS in Apache2
Things to Do
- Set up regular repository backups.
- Set up Apache for automatic launch, follow the instructions for configuring automatic launch via SystemStarter.
Things to Watch Out For
Some applications that store documents as directory bundles may delete the .svn folder that Subversion uses from inside the bundle directory. EOModeler will delete the .svn directory when you save your document. This is annoying but not difficult to work around -- when you are ready to check in your changes, if Subversion displays the status code '~' (meaning: versioned item obstructed by some item of a different kind) perform the following steps (based on a model named MyModel):
% mv MyModel.eomodeld MyModel.mine
% svn update MyModel.eomodeld
% mv MyModel.eomodeld/.svn MyModel.mine/
% rm -r MyModel.eomodeld
% mv MyModel.mine MyModel.eomodeld
An important note for former CVS users: Use svn status where you would have used cvs update to check the status of your work area. Use svn -u status to include working revision and server out-of-date information from the repository.
When Things Go Wrong
- Read Version Control with Subversion, see the subversion online resources, mailing lists, FAQs, etc.
- You made a backup, right?
- Send me an email and I'll try to help.
Adam Swift is a longtime software engineer, developing WebObjects applications since its first release, and Cocoa software since it was called the AppKit on his NeXT slab, circa 1991.
Return to MacDevCenter.com.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 18 of 18.
-
Bash script for packages
2006-04-09 08:37:09 wrashi [Reply | View]
As Adam mentions at the end of this article, programs that save stuff as packages (keynotes, TextEdit, etc) sometimes erase the .svn folder, making it impossible to commit the new version into the repository. Adam gives a series of instructions that I have turned into a bash script.
The script is called svnpackup. I like to put these kinds of scripts into script/ in the home Library, and put that directory on my path (so that it gets backed up, but can still be called directly from the Terminal).
svnpackup takes one argument -- the name of the package that needs to be updated. Call this script from within the directory containing the file to be updated.
#!/bin/bash
# @(#)svnpackup -- Update svn packages that have had their .svn folder removed and can't be committed -- Wrashi 06/04/07
# Based on code from Adam Swift's article Making the Jump to Subversion
#
# Check for package name to be updated
if [ $# -ne 1 ]; then
echo "Usage: svnpackup source"
echo "updates packages that have had their .svn folder removed so they can be committed"
exit 1
fi
# Set up variables for convenience
SOURCE=$1
TEMP=$1.mine
# Move the package aside
mv "$SOURCE" "$TEMP"
# Get original from the repository
svn update "$SOURCE"
# Move .svn folder
mv "$SOURCE/.svn" "$TEMP/"
# Toss away the old package
rm -rf "$SOURCE" # Using -f so confirmation is not needed for every file
# Move the package back so it can now be committed
mv "$TEMP" "$SOURCE"
-
Updated Owner Information
2006-04-09 07:08:41 wrashi [Reply | View]
The current config file that comes with Apache 2.2.0 has the owner already configured. Therefore, the instructions above are a bit outdated.
svnadmin create <path to repository>
chown -R www <path to repository>
should now read:
svnadmin create <path to repository>
chown -R daemon <path to repository>
And setting the User to www is no longer necessary.
# User nobody
User www ### Not necessary. Apache 2.2.0 already configured: User daemon
The rest of this article is spot on, and I have found it amazingly useful.
-
Odd Error
2006-01-13 15:05:05 lolajl [Reply | View]
I'm trying to get my subversion repository back up and running after having to wipe clean my hard drive. Installed all the packages from wsanchez's idisk. When I try to create a repository, here's the error message that I get:
httpd: Syntax error on line 98 of /usr/local/apache/conf/httpd.conf: Module "/tmp/roots.XgDlOrcG/src/subversion-1.2.3/subversion/mod_dav_svn/mod_dav_svn.c" is not compatible with this version of Apache (found 20050708, need 20051115). Please contact the vendor for the correct version.
What does this mean? how do I get this file that is needed? how do I install it?
-
/usr/local/apache/etc Directory
2005-07-13 12:32:50 lolajl [Reply | View]
I'm trying out these instructions in order to experiment with Subversion. I got all the packages from wsanchez link. However, poking around in /usr/local/apache, it seems that /etc directory doesn't exist; thus, the instructions to set the authentication file doesn't work. Should I create the /etc directory first before creating this file?
-
cvs2svn does not work?
2005-01-23 03:25:35 Thomas_Ganter [Reply | View]
Even though I followed all instructions in this article, and subversion seems to wirk fine, the cvs2svn script complains about some missing python module (anydbm) which I have absolutely no idea on how to obtain... 8^(
Any hint?
-
EOModeler .svn fix
2004-09-21 13:34:01 JimMcLoughlin [Reply | View]
There are a couple of patches available to fix the issue of EOModeler deleting the .svn folder. (A similar issue exists for .nib files).
See the bundles:
http://www.rtlabs.com/downloads/software/subvsupport.tgz
or
http://commons.ucalgary.ca/~king/eomsvn/
-
Another Subversion StartupItem
2004-09-02 12:25:55 aswift [Reply | View]
I put together a startup item that looks for apache in
(like the package referenced in the article does). The README.txt file provides installation instructions: Download Subversion-StartupItem.tgz/usr/local/apache
-
Can't import to svn
2004-08-27 14:08:39 jaw6 [Reply | View]
It gets part-way through and quits with:
svn: Can't recode string
A little googling suggests this is a file-naming issue/region/locale issue, but I'm not using non-ASCII characters (that I know of).
-
Resource Forks
2004-08-25 13:00:43 chopblock [Reply | View]
It seems as though subversion strips the resource forks from files, so unique application associations and icons are lost. Anyone know how to get around this?
-
Apache2 StartUpItem
2004-08-18 05:30:36 robbevan [Reply | View]
If anyone wants readymade Subversion-specific Apache2 StartUpItem, there's one here: http://type.robbevan.com/robbish/2004/08/subversion_on_m.html
-
Can't Log into idisk
2004-08-12 15:41:37 lolajl [Reply | View]
The idisk given in the article - idisk.mac.com/wsanchez/Public/Software/packages/ - doesn't seem to be working at all. Is it down temporarily, or permanently offline?
-
Subversion works for me
2004-08-12 09:51:59 hopelessOne [Reply | View]
I've been using Subversion on W2K for the last 18months (or more?). I've upgraded through the pre-1.0 repository schema changes and I have _never_ lost a repository, so I wouldn't take the first comment as indicitive of subversion's reliability.
Certainly, there are legacy issues if you're already using CVS but if you're setting up a new repository, you gotta try Subversion.
-
svnX : a GUI for svn
2004-08-12 05:12:53 dominiqueperetti [Reply | View]
Once you are familiar with svn CLI, don't hesitate : svnX.
-
caution
2004-08-11 12:17:46 synthoria [Reply | View]
I've been using subversion for production code since 1.0 and have experienced two complete repository failures (that's almost once a month). This is with a local repository and a single user. In over seven years of CVS usage I have never lost a repository like that.
I still use Subversion because it has features I've always wanted that CVS lacks but after that first failure I have implemented nightly incremental and weekly full backups. The second failure I didn't lost a thing.
Support Subversion but make the jump with your eyes open and your repository backed up!
-
Problem under 10.2.8
2004-08-11 09:18:45 guyumbright [Reply | View]
Following the instructions when I try to start Apache2, it complains that libiconv does not exist. I copied it from the (inactive) fink install then it complains about libresolv.9.dylib.
Any ideas?
-
Apple and Subversion
2004-08-11 09:12:56 jeffhuff [Reply | View]
Has anyone heard whether Apple is going to include subversion in the developer tools distribution? The new XCode 1.5 supports subversion, but you have to have the subversion client installed. I would think they would include it along side cvs at some point in the future.
-
Apache 2 Required?
2004-08-11 08:26:59 lolajl [Reply | View]
Looking at the required modules for server side installation, it looks like Apache 2 is required. However, I have version 1.3 installed on my laptop, which is the default install. How can I safely switch over to Apache 2? I'd like to keep the system default there in case I need to revert back to 1.3.






Since getting around to setting up SVN, I decided to turn it into an article as well, and ensure it was up to date.
My references are listed at the end of the article which cites my sources (including this article), ensuring that credit is given where due.
I hope that this may come in some use. Please post comments if you would like to contribute and/or share your opinion :)
http://www.bsodmike.com/pages/svn-on-os-x/
Now to catch up on much needed sleep!