TortoiseSVN

Setup a repository

[http://www.codinghorror.com/blog/2008/04/setting-up-subversion-on-windows.html]

Make file structure

  • If not present yet, make a folder for all your repositories, eg. D:\SVN.
  • Make a folder for the first repository, eg. D:\SVN\MyFirstRepository.

Create the repository

  • Right click on the new folder, and in the TortoiseSVN submenu, choose 'Create repository here'.
  • In the new version of TortoiseSVN, you can just click 'Create folder structure'. In older versions:
  • - Right click again on the folder and in the TortoiseSVN submenu, choose 'Repo-browser'.
  • - Create the folders 'branches', 'tags' and 'trunk'. (Choose 'Create folder', not 'Add folder'!)
  • Add the users (see Setup Subversion as Windows service - Add users)

Import an existing project into the repository

  • First delete the items that should not be under version control, such as bin and obj folders, *.suo and *.user files.
  • If this is an existing SourceSafe project, also remove the *.scc, *.vspscc and *.vssscc files.
  • Right click on the project folder. Choose 'Import' from the TortoiseSVN submenu.
  • The URL of repository should NOT be the bare repository, but the trunk folder.
  • The project is now imported into the repository, but the current folder is not yet marked as a repository instance. So we have to start using the repository.

Start using the repository

  • Right click on the project folder and select 'SVN Checkout'.
  • After opening the project again, the bin and obj folders will be regenerated by Visual Studio. Add them to the ignore list.

Remarks

  • Never change or delete the files in a repository folder.
  • For separate projects, set up separate repositories. With every commit, the complete repository gets a new revision.

Daily use

Copy/Move item

Do this with the right mouse button instead of the left. A menu will be shown with the SVN possibilities.
Mind that you cannot copy/move items to a newly created directory. You have to Add it first.

Deployment

- Tag: To path: /tags/Version_x.x.x
- Branch: To path: /branches/Version_x.x
- Switch working copy to new branch/tag not checked.

If changes need to be made after the deployment - the version stays the same

Small corrections (eg. mistakes during deployment process)

- Switch to the tag.
- Apply changes.
- Commit.
- Switch to trunk.
- Merge - Merge a range of revisions. From URL of the tag to working copy.
- Commit: Click on 'Recent messages' to get an automated message with the revisions you merged and their messages.

Bugs that need to be fixed - will be deployed afterwards with a new version

- Switch to the tag.
- Branch / Tag: To path: /branches/Version_x.x
- Switch working copy to new branch/tag checked.
- Fix bug(s).
- Commit.
- Execute deployment.
- Tag the branch.
- Switch to trunk.
- Merge - Merge a range of revisions.
URL to merge from: …/branches/Version_x.x
Revision range to merge: the revisions made in the branch that should go to the trunk
- Commit.

To avoid: A few changes have been made in the trunk after it has been tagged and the changes should also go to the tag

Remark: it is more logical to make the changes in the tag and later merge them to the trunk.
Switch to the tag.
Merge - Merge a range of revisions.
URL to merge from: trunk
Revision range to merge: the revisions that should be included in the merge.
Commit.

Merge a feature branch

Commit all the changes in the feature branch.
Switch to the trunk.
Merge - Merge a range of revisions.
In the next window, choost the branch to merge from.
Select 'all revisions'.

Resolving conflicts

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-conflicts.html

Externals

Add a project of another solution as an external

- Right click on the project. Choose Tortoise - Properties.
- Click on the svn:externals property. Click Edit.
- In the svn:externals window clik on New.
Enter the local path in the solution.
Mind that this is a relative path and that / should be use, not \.
The folder for the external project must not already exist! If it does, you will get an error.
Subversion will create it when it checks out the external working copy.
Enter the repository and the path of the project in the other solution.
Peg revision should be blank.
Normally choose the head revision.
- Click OK twice.
- Do Update to get the external project.
- Do Commit to save the changed solution properties.

Setup Subversion as Windows service

Install the service

Start the windows command line and execute:
sc create svnserve binpath= "\"C:\Program Files\Subversion\svnserve.exe\" —service -r C:\repositories" displayname= "Subversion Server" depend= Tcpip start= auto

Change the -r argument to the location of the repository.
Change the binpath to the location of svnserve.exe.

Add users

In the repository, directory conf, edit the passwd file. Add a user per line, followed by '=' and the password.
For instance:
jan =
Will allow the user jan to logon without a password.

In the file svnserve.conf (same directory), remove the # and the space! before the line
password-db = passwd
to use the default password file.

Troubleshooting

Can't connect to host …: Can't connect because the host refused the connection.

The service is probably not running.

Repository has not been enabled to accept revision propchanges

Ask the administrator to create a pre-revprop-change hook
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-repository-hooks.html

Remove the service again

sc delete svnserve

Split up a repository

svnadmin dump CodeSVN > svn.dump
cd SVN
svnadmin create Ondernemingsplan // Does this in the current directory
cat /home/peter/svn.dump | svndumpfilter include Ondernemingsplan | svnadmin load Ondernemingsplan

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License