SVN is acronym as Subversion, a version control system. It lets several developers work on the same project at once without worrying about overwriting each other’s changes, and keeps track of previous versions of files. It is used to maintain the revisions of files such as source code, web pages and documentation. It is commonly used in many open source projects. The version control system puts all versions of a file in a place called repository. Source control tools track all prior versions of all files, allowing developers to “time travel” backward and forward in their software to determine when and where bugs are introduced. If a mistake is made, files can be rolled back to previous version. Subversion was started in 2000 as an effort to write a free version control system.
Subversion is designed to replace the commonly used CVS (Concurrent Versions System). The biggest change between CVS and Subversion is that Subversion versions the entire repository, instead of individual files.
Subversion offers two types of repository storage — Berkeley DB and FSFS
Berkeley DB – It is a very reliable database system. SVN uses Berkeley DB logging facilities, which means that the database first writes to on-disk log files a description of any modifications it is about to make, and then makes the modification itself. This is to ensure that if anything goes wrong, the database system can back up to a previous checkpoint—a location in the log files known not to be corrupt—and replay transactions until the data is restored to a usable state. But it has some limitations. First, Berkeley DB environments are not portable. We cannot simply copy a Subversion repository that was created on a UNIX system onto a Windows system and expect it to work.
FSFS – In mid 2004 FSFS (Fast Secure File System) repository came into being. FSFS works faster on directories with a large number of files and takes less disk space. An FSFS repository stores a revision tree in a single file. This storage format is portable across different operating systems and isn’t sensitive to CPU architecture. Transactions are created in separate sub directories. When complete, a single transaction file is created and moved to the revisions directory.
Basic SVN commands are:-
This will make svn list all the available functions.
svn co/checkout <Source repository path> <Destination path>
This command is used to pull an SVN tree from the server. If the directory structure is changed then it may occasionally need to delete the local copy and re-check it out.
Checks the status of the working copy.
‘?‘ Item is not under version control.
‘A‘ Item is scheduled for Addition.
‘D‘ Item is scheduled for Deletion.
‘M‘ Item has been modified.
‘C‘ Item is in conflict with updates received from the repository.
‘I‘ Item is being ignored (e.g. with the svn:ignore property).
‘!‘ Item is missing (e.g. someone has moved or deleted it without using svn). This also indicates that a directory is incomplete (a checkout or update was interrupted).
‘L‘ Item is locked.
‘~‘ Item is versioned as a directory, but has been replaced by a file, or vice versa.
svn add <filename|folder>
Add files, directories to the working copy and schedule them for addition to the repository. They will be added to the repository on next commit.
svn diff <filename>
Shows the difference of all modifications to file.
svn revert <filename>
Reverts back to the previous version and discard all modifications made in file.
svn ci/commit <filename|folder> -m “Comment: Commit message here”
Commit the changes made in file to the repository with new version.
svn up/update <filename>
Bring the current up-to-date working copy to the repository.
svn delete <filename|folder>
Delete files, directories from working copy and schedule them for deletion to the repository. They will be deleted from repository on next commit.
Cleanup subversion files resulting from escaped processes and crashed. Recursively clean up the working copy.
svn info <filename>
Display information about file or directory. (Date modified, author, revision, path in repository.)
svn mkdir <folder>
Create a new directory under version control.
svn mv/move <folder1> <folder2>
svn mv/move <file-old-name> <file-new-name>
Rename or move a file or directory. Moves/renames file/directory in repository and in local work area.