Difference between revisions of "SVN - Subversion"
(→Authenication Problems) |
m (→Authenication Problems) |
||
Line 164: | Line 164: | ||
Path 'admin/Photos/edit_photo.php' is no longer a member of a changelist. | Path 'admin/Photos/edit_photo.php' is no longer a member of a changelist. | ||
− | == | + | == Authentication Problems == |
if you're being asked everytime for your subversion password or phing gives you a "rejected Basic challenge" error, check your ~/.subversion/server file and make sure that the line | if you're being asked everytime for your subversion password or phing gives you a "rejected Basic challenge" error, check your ~/.subversion/server file and make sure that the line | ||
# store-passwords = no | # store-passwords = no |
Revision as of 14:38, 22 May 2012
Contents
- 1 Cheat Sheet
- 2 Important Note about versions
- 3 Installing SVN
- 4 Importing a Site
- 5 Checking Out a Site
- 6 Checking in your Changes
- 7 Working on Site (Branching)
- 8 Merging your work back into the Production (trunk)
- 9 Moving files or directories in SVN
- 10 Resolving Conflicts
- 11 Where to get more help
- 12 Viewing What Gaslight has in SVN
- 13 Advanced Topics
- 14 Authentication Problems
- 15 Adminstration of Subversion Repository
Cheat Sheet
Command | Alt Name | Options/Params | Summary |
---|---|---|---|
add | PATH | Add a file or directory to svn | |
checkout | co | URL PATH | checks out the URL to PATH |
cleanup | recursively cleans up working copy (take care of locks) | ||
commit | ci | -m "MESSAGE" PATH | commit a file or a directory recursively |
copy | cp | SRC DST | For making branches SRC or DST can be working copy or URL |
delete | del,remove,rm | PATH or URL | remove a file from svn if URL is given a log message is needed |
export | -r REV URL PATH | export a copy from svn without revision control | |
help | ?,h | can also give it subcommand as arg and get info on any svn command | |
import | -m "MESSAGE" PATH URL | Add the PATH to the svn located by URL | |
info | PATH | PATH can be working copy or URL | |
list | ls | TARGET | Gives info on the TARGET and it's contents in svn |
log | PATH | prints out log messages for PATH | |
move | mv | -m "MESSAGE" SRC DST | move the SRC to DST on the svn machine use URL's |
status | st | PATH | prints the status of the working copy recursively |
Important Note about versions
- If you plan on using svn to update and commit files from devsys2 through samba you'll need to be sure that your client version is the same an what's on devsys2 (currently 1.5.1)
- DO NOT USE a higher version client than this.
- The vrs # pertains to the svn client and not the application using svn
This mean that if your working on your own development (sandbag) area on devsys2 you'll have no problems. But for the common server directories that we have setup for clients under /var/www/server we'll need to make sure that only command line svn on devsys2 is used to update the files.
- if you choose to run a svn client make sure it is the correct version and that it doesn't update itself.
Installing SVN
For your own use on your machine you should have no problem using the latest greatest svn program. But for our Development projects that multiple user access and must commit please stick to using the ssh access to devsys2 machine to do any svn commands. It is not advised to use svn clients over samba (smb or cifs). Using a client may lock the working svn copy or make it unusable to others trying to do work on devsys2. So your safest bet is to only use svn from the devsys2 machine while working on devsys2. So with that said here's your gun. If you shoot yourself or another in the foot don't blame the gun.
Windows
- Windows Applications
- DO NOT USE THIS !!!!!!! Tortoise SVN vrs 1.5.10
- SVN for Eclipse http://subclipse.tigris.org
ubuntu
- Installing svn under ubuntu
- sudo apt-get install subversion
Mac
More Applications
Importing a Site
- Important Note: setup your ~/.subversion/config file to add ignore files
- global-ignores = .DS_Store ._* *.swp admin_setup.php setup_log.txt iconCache uploads cache compiled compile original resized midsized thumb thumbs ht_images photo-large photo-small prototype weather-feed.xml php.error reports editimagesworkwith editimagesoriginal editedImages editimagespng
- This way svn doesn't put these file types into svn.
- All Production sites will be placed under the prod directory of the svn repository
- svn import [PATH] URL
svn import www.newsite.com http://cvs2/svn/prod/www.newsite.com
- If your working on a development site needs to go to dev
svn import www.newsite.com http://cvs2/svn/dev/www.newsite.com
Checking Out a Site
- svn co http://cvs2/svn/{prod or dev}/modulename (www.ludingtonarea.com)
Checking in your Changes
- svn ci [PATH]
svn ci -m "some discriptive comment on what was changed" file1.xxx
Working on Site (Branching)
- Working on a branched copy is not difficult first create a copy of the site in svn
- svn copy SRC DST
- SRC and DST should be URL's of the site to make a branch
svn copy http://cvs2/svn/prod/www.newsite.com http://cvs2/svn/dev/www.newsite.com -m "branch off from prod/www.newsite.com"
- You can call the copy anything. In case there's someone else with that site in dev directory just make a new name
svn copy http://cvs2/svn/prod/www.newsite.com http://cvs2/svn/dev/steve.newsite.taskId# -m "branch off from prod/www.newsite.com"
- Check out the branched copy.
- svn co URL [PATH]
svn co http://cvs2/svn/dev/www.newsite.com
Merging your work back into the Production (trunk)
Easy Method
- to merge your branch back to the trunk you'll need a clean copy of the trunk (meaning when you run svn status it reports nothing)
svn merge --reintegrate http://cvs2/svn/prod/www.newsite.com
- don't forget to commit the trunk after this
svn ci -m "merge comment"
Hard Method
- to merge your copy of your working branch back into the main trunk you'll need to make sure that your work is commited first and then checkout a copy of the trunk.
- svn co URL [PATH]
svn co http://cvs2/svn/prod/www.newsite.com
- if you already have this then check that it is updated
- svn update [PATH]
svn update www.newsite.com
- You need to know at what point your last commited branch changes was at (what commit vrs #)
- you can find out by running a svn log command
svn log --verbose --stop-on-copy http://cvs2/svn/dev/www.newsite.com r98 | steve | 2010-02-03- 09:26:09 -0500 (Wed, 03 Feb 2010) | 2 lines Changed paths: A /dev/www.newsite.com (from /prod/www.newsite.com:97) branch off from prod/www.newsite.com
- from this we now know the branch started at revision 98 to get our copy into the trunk we'll need to merge in our changes from revision 98 to the HEAD revision (trunk)
- svn merge -r N:M SOURCE [PATH]
svn merge -r 98:HEAD www.newsite.com http://cvs2/svn/dev/www.newsite.com
NOTICE: that the URL used in both commands are from the dev branch. You're merging the dev branch over to the (trunk) prod. This merge command is done on a updated copy of the prod(trunk) for that site.
Moving files or directories in SVN
- svn move SRC DST
svn move -m "message" http://cvs2/svn/dev/www.oopswrongspot.com http://cvs2/svn/prod/www.nowitscorrect.com
Resolving Conflicts
Where to get more help
http://subversion.apache.org/docs/
Viewing What Gaslight has in SVN
http://cvs2/websvn websvn interface to svn repository
http://cvs2/svn direct to repository
Advanced Topics
- changelist
svn client 1.5 and above can help you out by creating a kind of filter of changed files called a changelist if you have many files that you have worked on this changelist can help you group them. For example if you made changes to the site, one with changes for a upgrade to the Toolbox code and another with changes to a Photo gallery you can assign files into --changelist to keep them grouped together. This changelist can be used to run a svn command such as commit or diff.
svn status M admin/Photos/list_photos.php M admin/Photos/edit_photo.php M Toolkit/Photos/Display.php
svn changelist Photo-Upgrades admin/Photos/list_photos.php admin/Photos/edit_photo.php Toolkit/Photos/Display.php Path 'admin/Photos/list_photos.php' is now a member of Photo-Upgrades Path 'admin/Photos/edit_photo.php' is now a member of Photo-Upgrades Path 'Toolkit/Photos/Display.php' is now a member of Photo-Upgrades
svn status --- Changelist 'Photo-Upgrades': M admin/Photos/list_photos.php M admin/Photos/edit_photo.php M Toolkit/Photos/Display.php
You can view the changelist in svn status anytime and then commit days or weeks later by committing the entire list:
svn ci -m "upgrading Photo App" --changelist Photo-Upgrades Sending admin/Photos/list_photos.php Sending admin/Photos/edit_photo.php Sending Toolkit/Photos/Display.php Transitting file data ... Committed revision 159.
NOTE: each file can only belong to one changelist at a time. If you assign a file that is already in a changelist svn will warn you that it is going to be removed from one changelist and added to the new one.
You can remove files from a changelist:
svn changelist --remove admin/Photos/edit_photo.php Path 'admin/Photos/edit_photo.php' is no longer a member of a changelist.
Authentication Problems
if you're being asked everytime for your subversion password or phing gives you a "rejected Basic challenge" error, check your ~/.subversion/server file and make sure that the line
# store-passwords = no
is commented out or change it to yes
also try removing the files in your ~/.subversion/auth/svn.simple folder and try it again
Adminstration of Subversion Repository
to dump a svn repository
svnadmin dump ${reposPath} > full.dump
to load a svn repository
svnadmin load ${reposPath} < full.dump
to upgrade a svn repository
svnadmin upgrade ${reposPath}