I can’t imagine life without subversion. If I look back, I can still see we maintaining different “change log files” to track the changes and doing a daily local backups to preserve daily changes. Every other week we used to have (almost unpleasant) discussion, “who made this change?“, “What happen to the previous copy, do you have a local copy?“.
What is SVN?
Definition says, “open source version controlling system using a center repository with great unique features like directory versioning, true versioning, atomic commits, versioned metadata, plugin with Apache for new network mechanisms, consistent data handling, efficient branching and tagging and hackability”.
According to me, “It is my personal programming assistant, I do the logic and program and it takes care of the rest”. I can’t image programming with SVN.
SVN functional cycle
Let the image do all the explanation, I have tried to keep it simple. Do let me know if it is not clear.
Summarizing the red-bean svnbook
Some of the commands that will take care of 99% of your svn work (for details read the book).
- SVN Checkout – (shortcut svn co) This will create a private copy/local copy of the project for you.
- SVN Commit – (shortcut svn ci) Publishing your changes to main repository, making it a part of main work. You can commit any number of files at one go. Use atomic commits as much as possible.
- SVN update – (shortcut svn up) Update your local copy with the latest changes done to the main repo. Remember you can also do a svn update -r445 (445 is revision number, a previous snapshot of the porject).
- SVN diff – compare two revisions (revision is like a snapshot of the project). See SVN cat also.
- SVN log – this shows the log message done with SVN commits. Always do verbose comments with svn commits for YOURSELF.
- SVN add – This is to schedule a file/directory to be added with next commit. It is not added to the center/main repo till next commit.
- SVN delete – schedule a file/directory to be deleted with next commit
- SVN copy – creates a duplicate copy but it maintains the copy history. The best part is certainly the copy history very useful for branching and tagging.
- SVN move – makes like simpler, it is just a rename (I used to do a cp, del, svn add for one command).
- SVN status – I think I use this command more often that any other command as it doesn’t do anything. It shows you all the changes that has happened to your local copy. (If you are interested in understanding, read how SVN maintains a local copy of checkout version to track changes). You will A (svn add),C (conflicts, you are changing something that is already changed),D (svn del),M (this is with svn up, new changes syncing to your local copy),X (I have never seen this),? (not a part of SVN),! (SVN expecting a missing file),~ (some changes to the attribute of the object), L (Locked files) and I (ignored) labels for changed files.
- Svn revert – undo the changes done to the local copy. Works well with svn diff.
- SVN cleanup – When subversion operation (SVN writes to a log file before doing the final task and removes when done) are interrupted (stays unfinished) in between, the log files are not deleted.
- SVN propedit – Ignoring some cache folders can be helpful svn propedit svn:ignore ‘cache/temp/’ –editor-cmd ’emacs’. This will open emacs editor, enter * (or any rule) to ignore all and save.
- SVN info – Print information about paths.
- SVN Merge – It applies the changes unlike svn diff. Useful when you do branching or tagging. I haven’t used it in a convincing way as branches for our projects did not make much sense to me.
- SVN Switch
- SVN ignore
- SVN mkdir
- SVN blame
- SVN propdel
- SVN propget
- SVN proplist
- SVN resolved
Some admin help
- SVNlook – (subcommands) author, cat, changed, date, diff, dirs-changes, history, info, log, propget, proplist, tree, uuid and youngest.
- SVNadmin – As an admin you can’t live with out. (subcommands) create (to create the project), deltify, dump (when you need to get a part of the repository as a new repository, very useful when some revisions are corrupted, you can use dunpfilter with it), hotcopy, list-dblogs, list-unused-dblogs, load, lstxns, recover (very helpful when nothing else works), rmtxns, setlog and verify (most of the troubleshooting starts and ends with verify).
Also read about fsfs (name of a Subversion filesystem implementation) and its advantage over Berkeley DB-based implementation. Then there can be a 2 GB Apache problem (which it is solved with the latest apache releases).
Hope this will give you an overall summary of SVN – subversion.
hi aji,
this is a very useful post.now i dont have to go google when i am in trouble with svn.:)
great, enjoy it.
Dear Aji,
I read about the SVN. Ur post about SVN is more compact and easy I found.
Good to hear that it was helpful for you, do let me know if I need to cover something more. I forgot to add about branches and tags, I will be doing it soon.