Wednesday, August 18, 2010

Create a new Subversion Repository

Create a repository by right clicking inside the new repository empty folder.


You can access your repository using the repo browser. Right click anywhere in the windows explorer to open the repo browser.


Provide a valid Uri. If the new repository was created inside c:\test\MyRepo, then the Uri would be file:///c:\test\MyRepo
Notice the extra escape forward slash in the Uri.


If you were using a remote repository then this Uri would be the http path to your repository.

The repo browser is basically the "windows explorer" of subversion. It let's you view your repos and in addition it allows basic server side operations. Note that anything you do using the repo browser is a connected operation.


Now let's define the top level structure for our repository. Following subversion best practices we will create at the root folder 3 sub-folders: trunk, tags, branches.
You can create a new folder directly in the repo browser by right clicking at the level you would like your new folder to be created.


You need to give the new directory a name (example trunk) and also provide a meaning full comment. The creation of this folder creates basically a new revision to your repository. Make sure that you are not lazy with comments; the comment doesn't have to be long but it needs to give a clear explanation of the transaction that happened.


After you create all 3 top level folders your root structure should look like the following picture.



  • trunk is the main line of development in a SVN repository.
  • A branch is a side-line of development created to make larger, experimental or disrupting work without annoying users of the trunk version. Also, branches can be used to create development lines for multiple versions of the same product, like having a place to back port bug fixes into a stable release.
  • tags are markers to highlight notable revisions in the history of the repository, usually things like "this was released as 1.0". Please note that by convention you never alter code inside tags; you are better off revoking write access from tags to the majority of developers.
  • spikes are similar to branches (never for stabilizing) but for less formal work. An example is that I have under branches work that I need also to build on the build server, under spikes I have usually private paths or experiments that might not even be ever merged back to the main line "trunk".

image

Another top level structure for more demanding projects is the multi project repository structure. In this case the 1st level of directories contain names of projects and the second level of directories the same structure as before. This is a "hack" you can do in Svn in order to kind-of-mimic a distributed repository. Note that distributed facilities are not explicitly available in Svn, so you need to improvise each time you need operations such as merge, branch, etc across projects. In another source control like git, mercurial or Bazaar this would have no meaning since any operation across repositories is by nature supported.


My recommendation is to use the multi project repository in ANY CASE. Even if you don't needed yet... it's a win-win situation for the future.









0 comments:

Post a Comment

Post a comment