|
SvnTips : Working With SVN
SVN Repository: http://svn.freepbx.org/ (See also SvnMirrors)
SVN web viewer: http://freepbx.org/trac/browser/
If you are not a developer, and are just looking for a snapshot copy of the svn, see SvnPull
Checking out
You should be in a new, empty directory before doing this.
Checking out a copy of FreePBX:
svn co http://svn.freepbx.org/freepbx/trunk
Or for a release branch:
svn co http://svn.freepbx.org/freepbx/branches/2.3
Note that modules are in their own directory:
svn co http://svn.freepbx.org/modules/branches/2.3/
Basic workflow
For editing, the basic workflow is:
Switch into a checked-out working copy. Be sure you're running the latest copy:
svn update
Note that you can run this anywhere in the working copy, it recursively updates. You don't necessarily have to be at the root.
Make changes in your editor of choice, and be sure to test everything (for syntax, and hopefully, that it actually works).
Examine your changes:
svn status (gives overview of what was changed) svn diff (shows diff of your copy against svn) svn revert (oops, if you want to back out a change)
It's a good idea to update again before attempting to check in, but if someone has changed a file you're working on, svn will tell you and prevent you from checking in.
svn commit
Adding/removing files
When you add a new file, you have to tell svn about it before it will be under version control.
svn add filename.ext
You can also add directories, which will recursively add the contents of that directory.
To delete a file, you have to delete it with svn:
svn delete filename.ext
If you delete it from your file system only, svn will simply consider it a "missing" file, and then next time you update it will be added back.
Examine your changes to be sure you're doing what you want, and then commit:
svn status svn commit
More tips
Shortcuts
| Full command | Shortcut |
| svn checkout | svn co |
| svn update | svn up |
| svn commit | svn ci |
| svn status | svn stat |
| svn diff | svn di |
Properties
svn pl filename
That'll list all the properties that are set on the file. Usually it'll be 'eol-type' and possibly 'mime-type'
Ryan turned on mime-checking the other day, so _every file_ commited from now on needs to have a mime-type set before you can add it. So lets say you've added a php file, foo.php:
svn add foo.php svn propset svn:mime-type text/html foo.php svn ci
Or a new image:
svn add wibble.png svn ps svn:mime-type image/png wibble.png svn ci
Not sure what it should be? You can also query the type for another file:
svn pg svn:mime-type amp_conf/htdocs/admin/images/amp.png
You've commited a script that needs to be executable?
svn ps svn:executable ON perlscript.pl
Here's a comprehensive listing of MimeTypes
Using svnmerge
Note. This is not 'svn merge'. This is 'svnmerge.py', it came in your subversion.tgz. Changes should be done in trunk, and then merged to the branch as appropriate (currently, svnmerge is not setup to go the other way).
In a branch, use
svnmerge.py avail
That will show any available revisions that can be merged.
To merge one, you can use:
svnmerge.py merge -r 1234
(also note, specifying multiple like 1234-1237 or 1234,2345, etc are allowed)
It's a good idea to svn diff at this point, just to be sure you got what you wanted. Once you're ready to checkin:
svn commit -F svnmerge-commit-message.txt
This will do the commit, with the message that svnmerge.py created (which contains a note saying it was merged, and the original commit message(s) from the revision(s) you checked in).
To block a specific revision from being merged (eg, it's already been merged by other means, or is incompatible for some reason):
svnmerge.py block 1234
Setting up for merge
cd to the branch, and run:
svnmerge.py init
(more details..?)
Migrating from sourceforge.net SVN to svn.freepbx.org
NOTE: On 2007-09-20, we moved the subversion repository to svn.freepbx.org, running on our own server. See the blog entry.
To switch your existing working copies, switch to the top-level directory where it was checked out, and then run
svn info
You should get something like this:
$ svn info Path: . URL: https://amportal.svn.sourceforge.net/svnroot/amportal/freepbx/branches Repository Root: https://amportal.svn.sourceforge.net/svnroot/amportal ...
Using the URL shown, change the https://amportal.svn.sourceforge.net/svnroot/amportal/ bit to http://svn.freepbx.org/'''and use svn switch --relocate, eg. in this case:
svn switch --relocate https://amportal.svn.sourceforge.net/svnroot/amportal/freepbx/branches http://svn.freepbx.org/freepbx/branches
Note that your credentials on http://svn.freepbx.org are the same as your credentials on http://freepbx.org.
Need subversion?
Debian/ubuntu/etc
apt-get install subversion
RHEL/Centos 4+
yum install subversion
RHEL 3
Look here: http://dag.wieers.com/packages/subversion
