Monday 1 August 2016

Svn


Creating New SVN Repository

It is recommended that you use meaningful names for your repository.

Do not let laziness take over and end up with a repo list like: x, y, abc, tot. You will forever being explaining to people what is in each of them.

Also, do not let your, or other's, inner child take over, or you will end up with a list like this: Optimus Prime, Bert and Ernie, or Batman, Robin, or whatever childhood fancy tickled your imagination.
$ svnadmin create D:\Subversion\{Repository Name}

If you use Apache to expose your repositories others, you need to add a new webdav section in your apache/Apache2\conf\httpd.conf file inside the Location tags.


 Allow from All
 DAV svn
 SVNPath d:\subversion\SCMWise
 AuthzSVNAccessFile d:\subversion\SCMWise-svnaccessfile.txt

 AuthName "SCMWise Subversion Repository"

 AuthType SSPI
 SSPIAuth On
 SSPIAuthoritative On
 SSPIDomain scmwise.com
 SSPIOfferBasic On
 SSPIUsernameCase lower

 require valid-user

In this example you would need to create a SCMWise-svnaccessfile.txt in the D:\Subversion Directory.

Here is some sample code:

[groups]
scmwise = scmwise\toad

[/]
@scmwise = rw


It is a wise idea to check in your httpd.conf and SCMWise-svnaccessfile.txt

You will need to restart the Apache web service to pick up the httpd.conf file changes.

Creating a Subversion Change Log

This seems to be one of the more popular Subversion Commands.

Development teams or Project Managers may want you to provide a list of all the changes to a specific Subversion Repository or to a specific Subversion branch of code.

To do this for a specific date range of one year for the trunk branch:
$ svn log --verbose -r {2010-01-01}:{2010-12-31} https://svn.scmwise.com/svn/scm/trunk

Here the Subversion Log Command for a specific date to the latest version for a whole repository:
$ svn log --verbose -r {2010-01-01}:HEAD https://svn.scmwise.com/svn/scm

Here is the example change log file:
------------------------------------------------------------------------
r75615 | scmwise\toad | 2011-01-03 10:00:46 -0600 (Mon, 03 Jan 2011) | 2 lines

Changed paths:
   M /Bank/branches/CMS/CMS.Suite_v2.9.0/Business/CADET.Business/LoanCuringBLL.cs

Refs #11895 PRJ203174Delivery-Cadet - Deficiency re-prioritization

------------------------------------------------------------------------
r75616 | scmwise\toad | 2011-01-03 10:00:58 -0600 (Mon, 03 Jan 2011) | 2 lines

Changed paths:
   M /Bank/branches/CMS/CMS.Suite_v2.9.0/Business/CADET.Business/RulesEngineBLL.cs

Refs #11895 PRJ203174Delivery-Cadet - Deficiency re-prioritization



Migrating Whole Repository

"How do you move code from one Subversion repository to another SVN repo?"

Logically, people look for a Subversion Commands like move and migrate, but these Subversion Commands are used inside of a single Subversion Repository.

If you find yourself in the situation where you want to migrate the source code and all of its history to another SVN repo, you need to use the svnadmin dump command.

The svnadmin dump command does not logically jump to the front of most people's mind when thinking of how to do this.

This is an example of creating a dumpfile for a whole SVN repository named Website:
$ svnadmin dump D:\Subversion\Website > Website.dump

Now, we want to load the dump file into a SVN repo named SCMWise.
$ svnadmin load D:\Subversion\SCMWise < Website.dump



Migrating a Partial Subversion Repository

If you need to move some subset of code and the history of this code from one SVN Repo to another, you need to perform the following Subversion Commands:
  • svnadmin dump
  • svndumpfilter include
  • svnadmin load
  • svn remove
You start with dumping the specific directory into the dump file. To help speed this up you can use the --revision option to only include a range of revisions:
$ svnadmin dump d:\Subversion\Website -r 999:12342 > Website.dump

Now, if you are only taking a portion of a SVN repo, you need to filter out the unwanted revisions.

Meaning, you only migrate the directories and revisions related to those directories.

To do this you use the svndumpfilter command:
$ svndumpfilter include Release2007 < SCMWise.dump > Release2007.dump

If you receive the error:

svndumpfilter: Unsupported dumpfile version: 3


In this case, it means that the dump file was created with the --deltas option.
You will need to recreate the dump file without this svnadmin dump option.

Here is the command for loading newly trimmed down dump file
$ svnadmin load D:\Subversion\SCMWise < Release2007.dump

Now, if you do not want a duplicate set of code in both directories, you need delete the remove the code from the original repo:
$ svn remove https://svn.scmwise.com/svn/Website/Release2007

Undoing Committed Changes

You may notice that changes committed to the repo are not working or altogether wrong. You may just want to revert back to a previous version of the repository.

You can easily do this from your current working copy.
In this example you want to revert from your current repo version of 393 to the earlier version 268.
It is a wise practice to utilize the dry run option to see want will take place before actually running the merge
$ svn merge --dry-run -r 393:268 https://svn.scmwise.com/svn/scm/trunk

If you like what you see, now run the real merge:
$ svn merge -r 393:268 https://svn.scmwise.com/svn/scm/trunk

Check to make sure everything looks good.
$ svn status

If everything worked now commit your changes to the repo and BAM!, you are back to the working version.
$ svn commit -m "Reverting back to the working version"



Reference: http://www.scmwise.com/subversion-commands.html

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home