Subversion is considered by many to be the successor to CVS for affordable electronic file version control. Many Operating System distributions come with svn already installed. For example Apple's OS X 10.5.X now includes svn 1.4.X, where previous releases required special installers.
# yum list \*subversion\* ... Available Packages subversion.i386 1.4.2-4.el5 base subversion-devel.i386 1.4.2-4.el5 base subversion-javahl.i386 1.4.2-4.el5 base subversion-perl.i386 1.4.2-4.el5 base subversion-ruby.i386 1.4.2-4.el5 base # yum install subversion ... Installed: subversion.i386 0:1.4.2-4.el5 Dependency Installed: apr.i386 0:1.2.7-11 apr-util.i386 0:1.2.7-7.el5_3.1 neon.i386 0:0.25.5-10.el5 perl-URI.noarch 0:1.35-3 postgresql-libs.i386 0:8.1.11-1.el5_1.1 Complete! # yum list \*inet\* ... Available Packages perl-IO-Socket-INET6.noarch 2.51-2.fc6 base xinetd.i386 2:2.3.14-10.el5 base # yum install xinetd ... Installed: xinetd.i386 2:2.3.14-10.el5 Complete!
$ ls -lhd /public/svn drwxrwsr-x 7 rickatech subvsn 4.0K Jul 5 20:40 /public/svn $ svnadmin create /public/svn
$ ls -R um um: notes.txt $ svn import um file:///public/svn/um -m "fp" Adding um/notes.txt Committed revision 1.
$ svn co file:///public/svn/um A um/notes.txt Checked out revision 1. $ ls -Ra .: . .. um ./um: . .. notes.txt .svn ./um/.svn: . .. entries format prop-base props text-base tmp ... $ svn info um Path: um URL: file:///public/svn/um Repository Root: file:///public/svn Repository UUID: 2a33dff9-0b7b-49a1-a411-a1b6993661c1 Revision: 2 Node Kind: directory Schedule: normal Last Changed Author: rickatech Last Changed Rev: 2 Last Changed Date: 2009-07-05 20:52:13 -0700 (Sun, 05 Jul 2009)
$ svn co file:///public/svn/um $ svn co svn://192.168.2.24/um A um/notes.txt Checked out revision 1. $ svn co svn://localhost/um ... requires authentication, creates ~/.subversion user settings ... $ svn co svn co file:///public/svn/um ... bypasses authentication, creates ~/.subversion user settings ...
# cd /public/svn # ls -al conf dav db format hooks locks README.txt # cd /public/svn/conf # rcsdiff * diff -r1.1 passwd 8a9,10 > rickatech = 1234 diff -r1.1 svnserve.conf 11a12 > anon-access = none 18c19 < # password-db = passwd --- > password-db = passwd # service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ]
Common commands ...
|
|
Review existing tags and branches. Create a tag, delete a tag.
$ svn list https://svn.motmd.com/svn/foobar branches/ tags/ trunk/ $ svn list https://svn.motmd.com/svn/foobar/tags 1.0.0/ ... 1.0rc3/ $ svn copy -m "Rick's patches" https://svn.motmd.com/svn/foobar/trunk https://svn.motmd.com/svn/foobar/tags/1.0.5 ... $ svn delete -m "poof" https://svn.motmd.com/svn/foobar/1.0.5 ...
Switch working files from trunk to branch. This is a handy non-invasive way to see what files have changed since a branch was made. Reverse the parameters to switch from branch back to trunk.
$ svn status $ svn info | grep URL URL: .../svn/nimbus/trunk $ svn switch .../svn/nimbus/tags/1.0.4 D public_htdocs/XPButtonUploadText_61x22.png D public_htdocs/swfupload A public_htdocs/flash A public_htdocs/flash/swfupload_f9.swf ... U nimbus.tmproj U classes/ComponentNew.php $ svn info | grep URL URL: .../nimbus/tags/1.0.4
svnlook is a non-invasive command that works directly on the file system to get status and other state information. It can not be used with a repository URL (red-bean.com).
$ svnlook diff -r 6185 /disk1/svn_repos/nor1upgrades Modified: trunk/include/classes/UtilsNor1.php =================================================================== --- trunk/include/classes/UtilsNor1.php 2010-08-10 16:41:21 UTC (rev 6184) +++ trunk/include/classes/UtilsNor1.php 2010-08-10 19:07:50 UTC (rev 6185) @@ -720,11 +720,20 @@ $emailQueue->_type = EmailQueue::$_TYPE_EXTROOMCD; $emailQueue->_status = EmailQueue::$_STATUS_WAIT; if (self::hasValidObjStatus($property) && self::hasValidObjStatus($chain)) { - $emailQueue->save(); - $emailQueue->_body = "Please add the room code '$code' into iProp (test system)\r\n" - ."Property: ".$property->_name." (".$chain->_name.")"; - $emailQueue->save(); - } else { + $emailQueue->save(); /* Note: email body is written to .../emails/[year]/[month]/... */ + $emailQueue->_body = "<!--\r\n<TEXT>\r\n"; + $emailQueue->_body .= "Please add the room code '$code' into iProp (test system)\r\n"; + $emailQueue->_body .= "Property: ".$property->_name." (".$chain->_name.")\r\n"; + $emailQueue->_body .= "\r\nURI:\r\n".$_SERVER['REQUEST_URI'].")\r\n"; + $emailQueue->_body .= "</TEXT> -->\r\n"; + $emailQueue->_body .= "<HTML>"; + $emailQueue->_body .= "\n<p>Please add the room code '$code' into iProp (test system)"; + $emailQueue->_body .= "\n<br>Property: ".$property->_name." (".$chain->_name.")"; + $emailQueue->_body .= "\n\n<p>URI:\r\n".$_SERVER['REQUEST_URI'].")</p>"; + $emailQueue->_body .= "\n</HTML>\n"; + $emailQueue->save(); + } + else { return Errors::addDebug(__METHOD__, "No email, because property or chain is not active yet"); } $ svnlook log -r 6185 /disk1/svn_repos/nor1upgrades RESOLVED - bug 2214: Include DLMI request URL in error email https://bugs.nor1solutions.com/show_bug.cgi?id=2214 $ svnlook info -r 6185 /disk1/svn_repos/nor1upgrades rarmstrong 2010-08-10 19:07:50 +0000 (Tue, 10 Aug 2010) 116 RESOLVED - bug 2214: Include DLMI request URL in error email https://bugs.nor1solutions.com/show_bug.cgi?id=2214
Elsewhere
External command line diff
$svn diff -x -b --diff-cmd /usr/bin/diff
Merging branch back into trunk
$ cd /var/www/proj1/ $ svn switch svn+ssh://qa.yours.com/svn_repos/proj1/branches/cp_addon_rick $ svn info ... URL: svn+ssh://qa.yours.com/svn_repos/proj1/branches/cp_addon_rick Last Changed Rev: 776 $ svn log --verbose --stop-on-copy ------------------------------------------------------------------------ r753 | rarmstrong | 2010-11-04 10:44:59 -0700 (Thu, 04 Nov 2010) | 1 line Changed paths: A /branches/cp_addon_rick (from /trunk:752) branch of trunk for control addon development ------------------------------------------------------------------------ So base revision when branch was made is 753, the latest branch revision is 776. $ svn switch svn+ssh://qa.yours.com/svn_repos/proj1/trunk $ svn merge -r 753:HEAD svn+ssh://qa.yours.com/svn_repos/proj1/branches/cp_addon_rick U ... $ svn status M ... Now preform diff's, check what will be committed. $ svn commit -m "Merged branches/cp_addon_rick changes r341:405 into the trunk." Sending Committed revision
Eventually after performing many merges strange double MM file modified and C file conflicts will occur. The MM are harmless and can be ignored - they occur usually becuase checkout and commit are not taking place from the same directory. Conflicts must be dealt with. Best to type p and then review the left and right merge files that will be created. Often the conflict file must be removed and replaced with a clean merged file for the C to change to a M so that commit command will execute.
What about conflicts?
$ svn merge -r817:HEAD svn+ssh://qa.yours.com/svn_repos/proj1/branches/cp_addon_rick --- Merging r818 through r826 into '.': U selfcontrolpanel/views/helpers/wizard.php U selfcontrolpanel/views/dashboards/summary_form.ctp Conflict discovered in 'selfcontrolpanel/views/elements/menu.ctp'. Select: (p) postpone, (df) diff-full, (e) edit, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: p $ svn status M selfcontrolpanel/views/helpers/wizard.php M selfcontrolpanel/views/dashboards/summary_form.ctp ? selfcontrolpanel/views/elements/menu.ctp.merge-left.r817 ? selfcontrolpanel/views/elements/menu.ctp.merge-right.r826 ? selfcontrolpanel/views/elements/menu.ctp.working C selfcontrolpanel/views/elements/menu.ctp
Now you can review the conflict files, make changes accordingly, and perform final commit to trunk. You may need to rename the confict file, pull down current file, then copy resolved conflicts back to the file. The 'C' should now be a 'M' and commit can proceed.