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 32 of 32.
-
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. -
Updated Owner Information
2006-10-11 06:45:29 Elise_van_Looij [Reply | View]
I agree that the article is a bit outdated. The chown -R www certainly is not necessary anymore. However, when I tried you suggestinon of using
chown -R daemon <path to repository>
I got a lot of "Operation not permitted" errors. Perhaps you meant something else?
-
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? -
Odd Error
2006-10-11 06:42:24 Elise_van_Looij [Reply | View]
I had a similar problem and I found out that Subversion needs webDAV to communicate with the Apache server. WebDAV allows your Apache server to not only read files but write them as well. WebDAV is open source and you can easily google up the site, but the least painful way of installing it, I found, is to use MacPorts (www.macports.org). Once you've installed MacPorts (read the beginners guide, it's quite good), tell it to install subversion with the variant web_dav_svn.
-
/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? -
cvs2svn does not work?
2005-01-25 13:04:29 aswift [Reply | View]
I haven't actually tried cvs2svn but the 'anydbm' module is included with the standard python distribution. A just confirmed that the python that comes with Panther (I've got Mac OS X 10.3.7) includes it.
Run python and issue the following command:
import anydbm
-
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). -
Can't import to svn
2004-09-28 11:53:07 christian_u [Reply | View]
I'm having the same problem (subversion 1.1RC4 from metissian.com) on OS X 10.3.5.
The error occurs when trying to import files with japanese glyphs in their filenames. One has to tweak the locale environment variable, but where do I do this in OS X ? Any hints appreciated, thanks.
-
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? -
Resource Forks
2005-01-28 08:49:26 mizumitai [Reply | View]
It seems that they are actually handled similarly to what happens when you burn a CD on a Mac... ._myFile.txt is created to deal with the resource fork data.
http://subversion.tigris.org/servlets/ReadMsg?listName=dev&msgNo=45800
In theory that should mean that things like InDesign files that store the "I open with this application" information in resource forks on Macs should be okay. But I would test it... -
Resource Forks
2005-02-24 14:53:45 blalor76 [Reply | View]
I don't think this is what the OP was referring do. If I commit a Finder "alias" to a svn repository and check it out, I lose the resource fork.
A svn property seems like a good place to stick this stuff (maybe not), but either way, svn 1.1.3 doesn't support resource forks. -
Resource Forks
2005-01-31 07:29:46 mizumitai [Reply | View]
I tested Subversion resource fork handling with some InDesign files. Subversion seems to handle their resource forks okay...
At least, when I double-click on the working copy in svnX, it opens properly, which doesn't happen when I double-click on a file that's had its resource fork annihilated with cp etc....
Can anyone else confirm my results?
-
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. -
Apache 2 Required?
2004-08-11 16:09:20 omnival [Reply | View]
Or, ignore Apache and user the built-in SVN server,svnserve.
It's easy to set up and use -- instrux are in the online book referenced above. There are some tradeoffs, but I didn't want to mess with getting Apache 1.3 and 2.0 working side-by-side at the moment, so svnserve was great for me.
And, it's not a 2nd-class choice -- it's one of the fully-supported methods of talking to SVN. -
Apache 2 Required?
2004-08-11 08:46:52 aswift [Reply | View]
You can definitely run both apache versions side by side. By running Apache2 on a different port from the standard Apache 1.3 installation you should see no intererference at all. See page 1 notes on configuring an alternate port for Apache2. -
Apache 2 Required?
2004-09-03 15:56:37 jamestichenor [Reply | View]
I've configured everything as per page 1 -- all seemed to go as it's supposed to. I started apache2, and got the message that the server has started. I made all the changes to the config file. But when I try and connect to localhost:8800 (as the server is local) I get: "could not connect to server (http://localhost:8800)".
I'm not smart enough to debug this on my own... Will try a reboot but suspect it won't make much difference. If I've configured Apache2 to listen on 8800, what else is there, as long as it's running?
J






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!