All about SVN – subversion

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.

SVN - Subversion cycle

Summarizing the red-bean svnbook

Some of the commands that will take care of 99% of your svn work (for details read the book).

  1. SVN Checkout – (shortcut svn co) This will create a private copy/local copy of the project for you.
  2. 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.
  3. 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).
  4. SVN diff – compare two revisions (revision is like a snapshot of the project). See SVN cat also.
  5. SVN log – this shows the log message done with SVN commits. Always do verbose comments with svn commits for YOURSELF.
  6. 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.
  7. SVN delete – schedule a file/directory to be deleted with next commit
  8. 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.
  9. SVN move – makes like simpler, it is just a rename (I used to do a cp, del, svn add for one command).
  10. 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.
  11. Svn revert – undo the changes done to the local copy. Works well with svn diff.
  12. 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.
  13. 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.
  14. SVN info – Print information about paths.
  15. 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.
  16. SVN Switch
  17. SVN ignore
  18. SVN mkdir
  19. SVN blame
  20. SVN propdel
  21. SVN propget
  22. SVN proplist
  23. SVN resolved

Some admin help

  1. SVNlook – (subcommands) author, cat, changed, date, diff, dirs-changes, history, info, log, propget, proplist, tree, uuid and youngest.
  2. 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.

5 Replies to “All about SVN – subversion”

  1. 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.

Comments are closed.