UMANG SOFTWARE TECHNOLOGIES

Posts tagged ‘versioning’

Apache Subversion (SVN)

Apache Subversion is a software versioning and revision control system distributed as free software under the Apache License. Developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly compatible successor to the widely used Concurrent Versions System (CVS).

History

CollabNet founded the Subversion project in 2000 as an effort to write an open-source version-control system which operated much like CVS but which fixed the bugs and supplied some features missing in CVS. By 2001, Subversion had advanced sufficiently to host its own source code, and in February 2004, version 1.0 was released.

 

Features

  1. Commits as true atomic operations (interrupted commit operations in CVS would cause repository inconsistency or corruption).
  2. Renamed/copied/moved/removed files retain full revision history.
  3. The system maintains versioning for directories, renames, and file metadata (but not for timestamps). Users can move and/or copy entire directory-trees very quickly, while retaining full revision history.
  4. Native support for binary files, with space-efficient binary-diff storage.
  5. Apache HTTP Serveras network server, WebDAV/Delta-V for  There is also an independent server process called svnserve that uses a custom protocol over TCP/IP.
  6. Branchingis a cheap operation, independent of file size (though Subversion itself does not distinguish between a branch and a directory)
  7. Natively client–server, layered library
  8. Client/server protocol sends difference in both directions.
  9. Costs proportional to change size, not to data size.
  10. Parsable output, including XML log output.
  11. Free software licensed– Apache License since the 1.7 release; prior versions use a derivative of the Apache Software License 1.1.
  12. File locking for unmergeable files (“reserved checkouts”).
  13. Path-based authorization.
  14. Full MIME support – users can view or change the MIME type of each file, with the software knowing which MIME types can have their differences from previous versions shown.
  15. Merge tracking – Merges between branches will be tracked, this allows automatically merging between branches without telling Subversion what (doesn’t) need to be merged.

 

Repository access

Access to Subversion repositories can take place by:

  • Local filesystem or network filesystem,accessed by client directly. This mode uses the file:///path access scheme.
  • WebDAV/Delta-V (over http or https) using themod_dav_svn module for Apache 2. This mode uses thehttp://host/path access scheme or https://host/path for secure connections using ssl.
  • Custom “svn” protocol (default port 3690), using plain text or over TCP/IP. This mode uses either the svn://host/path access scheme for unencrypted transport or svn+ ssh://host/path scheme for tunneling over ssh.SVN Structure

 

Trunk, Branch and Tag in SVN

 

Technically all three i.e. trunk, branch and tag are folders in SVN. If you are using tortoise SVN, a popular windows client for subversion, you can explore trunk, branch or tag. If you browse SVN repository using Repo browser or simply open it on any browser e.g. Internet explorer, you will generally see three directories as trunk, branch and tags at root of project. This is actually one of SVN best practice to create this kind of directory structure. As I said earlier, trunk is place where main development happens, and branches are places where different developer work on different functionalities. This division is purely based on how programmer uses trunk and branches.

Similarly, tags are used to backup releases e.g. alpha release or beta release or any version of release. Main difference between branch and tag in subversion is that, tag is a read only copy of source code at any point and no further change on tag is accepted, while branch is mainly for development. Other source control like CVS doesn’t allow modification on tags but SVN allows changes on tags, which is considered as bad practice. You should not be making any change on tag once created, it should be treated as read only copy of source code only for restore purpose.

In short

– A trunk in SVN is main development area, where major development happens.

– A branch in SVN is sub development area where parallel development on different functionalities happens. After completion of a functionality, a branch is usually merged back into trunk.

– A tag in SVN is read only copy of source code from branch or tag at any point of time. Tag is mostly used to create a copy of released source code for restore and backup.

 

TortoiseSVN (SVN Client):

TortoiseSVN is free software for software developers (programmers). It helps programmers manage different versions of the source code for their programs. Tortoise SVN is a Subversion client, implemented as a Microsoft Windows shell extension. It is released under the GNU General Public License. In Windows Explorer, besides showing context menu items for Subversion commands, it also provides icon overlay that indicates the status of Subversion working copies.

 

Branching / Tagging

One of the features of version control systems is the ability to isolate changes onto a separate line of development. Branches are often used to try out new features without disturbing the main line of development with compiler errors and bugs. As soon as the new feature is stable enough then the development branch is merged back into the main branch (trunk).

Another feature of version control systems is the ability to mark particular revisions (e.g. a release version), so you can at any time recreate a certain build or environment. This process is known as tagging.

Subversion does not have special commands for branching or tagging, but uses so-called “cheap copies” instead. Cheap copies are similar to hard links in Unix, which means that instead of making a complete copy in the repository, an internal link is created, pointing to a specific tree/revision. As a result branches and tags are very quick to create, and take up almost no extra space in the repository.

SVN_Branch

Select the folder in your working copy which you want to copy to a branch or tag, then select the command TortoiseSVN → Branch/Tag….

The default destination URL for the new branch will be the source URL on which your working copy is based. You will need to edit that URL to the new path for your branch/tag. So instead of http://svn.collab.net/repos/ProjectName/trunk you might now use something like http://svn.collab.net/repos/ProjectName/tags/Release_1.10

 

Although Subversion itself makes no distinction between tags and branches, the way they are typically used differs a bit. Tags are typically used to create a static snapshot of the project at a particular stage. As such they are not normally used for development – that’s what branches are for, which is the reason we recommended the /trunk /branches /tags repository structure in the first place. Working on a tag revision is not a good idea, but because your local files are not write protected there is nothing to stop you doing this by mistake. However, if you try to commit to a path in the repository which contains /tags/, TortoiseSVN will warn you.

It may be that you need to make further changes to a release which you have already tagged. The correct way to handle this is to create a new branch from the tag first and commit the branch. Do your Changes on this branch and then create a new tag from this new branch, e.g.Version_1.0.1. If you modify a working copy created from a branch and commit, then all changes go to the new branch and not the trunk. Only the modifications are stored. The rest remains a cheap copy.

 

Advantages of SVN

  • CVS only tracks modification on a file-by-file basis, while SVN tracks a whole commit as a new revision, which means that it is easier to follow the history of your project. Add the fact that all modern source control software uses the concept of revision so it is far easier to migrate from SVN than it is from CVS.
  • There is also the atomic commit problem. While I only encountered it once, it is possible that 2 people committing together in CVS can conflict each other, losing some data and putting your client in an inconsistent state. When detected early, these problems are not major because your data is still out there somewhere, but it can be a pain in a stressful environment.
  • And finally, not many tools are developed around CVS anymore. While the new and shiny-new tools like Git or Mercurial definitely lack tools yet, SVN has a pretty large application base on any system.

References:

  1. http://en.wikipedia.org/wiki/Apache_Subversion
  2. https://subversion.apache.org/
  3. http://en.wikipedia.org/wiki/TortoiseSVN
  4. http://javarevisited.blogspot.in/2013/04/difference-between-trunk-tags-and-branch-svn-cvs-git-scm-subversion.html
  5. http://stackoverflow.com/questions/16142/what-do-branch-tag-and-trunk-mean-in-subversion-repositories

Tag Cloud