Subversion Installation and Operation with Windows®

Subversion Terminology

The following is a list of commonly used terminology used when working with Subversion. Please refer to the Subversion Book (svn-book.pdf) for more terminology.
Term Definition
Subversion Client Software run by a user to access a Subversion repository locally or on a Subversion server.
Subversion Repository Location where project files are stored. Contains the most recent version as well as past versions of the project.
Project Tree A single project tree contains folders for project management and version control. Typical folders are trunk, branches, tags. These folders are used to keep the working copy, development copy, and code releases or snapshots.
Trunk Contains the main project source for team development. Consist of code that can compile, even if it contains stubs for an undeveloped code.
Branch Split from the main trunk to allow for development. Branches allow development without disrupting the trunk. Branches can remain a separate development path or can be merged back to the trunk later in time.
Tag Snapshot of the project at an important point in time. Typically a software release version.
Revision Stored change in a file's state. Revisions are incremented during the commit process where changes are saved.
Head Latest revision of all project files in the project trunk, branch, or tag.
Working Copy Local copy of a projects source code checked out from the repository.
Check-out Creates a local working copy for development, testing, or release. Can be the project head, a specific revision, or a tag of the project.
Update Merges any changes that have been made in the repository into the local working copy.
Commit Checking in or writing any project changes from the local copy to the repository.
Revert Process of changing a file back to a previous version of itself. Can be used to resolve conflicts.
Merge Process of combining the changes made in a working copy of a file in a project to the repository that contains a more recent revision of the same file than what was checked out before modifying it. Typically used in when multiple developers are working on the same file to avoid losing other developers changes.
Conflict Occurs when changes are made by different developers to the same file and the repository system is unable to reconcile the changes. Typically requires the files to be merged manually to resolve the conflict.

How to Install Subversion Client

The Subversion client contains the commands to interface with local and server repositories.

1

Download Subversion Client.

Subversion supports a wide variety of operating systems. Be sure to download the installer for your operating system. We will reference the Collabnet client download for Windows®.

2

Run the setup.exe file. For best results use the default selections for install options.

3

You may need to restart your computer after installation is completed.

How to Install TortoiseSVN

TortoiseSVN is a GUI interface that interacts with the subversion client and reduces the need for command line operation. TortoiseSVN also manipulates your icons for folders and files to show the file's state of control.

1

Download TortoiseSVN.

TortoiseSVN only supports Windows® OS.

2

Run the setup (*.msi) file. For best results use the default selections for install options.

3

Restart your computer after the installation is completed.

Creating a Repository

This process describes creating a local repository, not a subversion server repository.

1

After you have successfully installed Subversion and Tortoise SVN, browse to the location you would like to keep your repository. This location can be on your local computer or a shared network drive that you have folder access to with read and write privileges.

2

Create a folder for your repository and name it (e.g., C://svn_repository).

3

Right-click on the folder you created and select '<TortoiseSVN/Create Repository Here>'.

This creates the file structure for use by SVN to track revisions, do not modify the file contents or folder structure unless you are familiar with how Subversion uses them.

4

Browse the repository by right-clicking on the repository and select '<TortoiseSVN/Repo-Browser>'. TortoiseSVN will remember the file path for future use.

Now you can create new folders for projects, check out revisions of files or projects, and manage your repository via TortoiseSVN.

Repository Folder Structure

You are free to choose any file structure you wish to use. The file structure below is a commonly used structure that clearly differentiates the separate pieces of the development process of a project. The following image shows the standard file structure viewed using the TortoiseSVN Repo-Browser.
SVN_FolderStructure.png
As you can see each project has its own set of folders for the branches, tags, and trunk. If your team performs many different types of development (e.g., CAD, hardware layout, firmware development, software development, white papers, application notes, etc.) you can create folders for each type of development that your projects reside in or you can create a completely separate repository for each development area.

Using Subversion and TortoiseSVN

The following are common Subversion operations used while maintaining a project under version control. All examples assume you are using a local repository and the typical folder structure from above and will be demonstrated using TortoiseSVN. Refer to the Subversion manual for command line options or more advanced topics.

Creating the Folder Structure for a New Project

The following steps demonstrate how to create the typical folder structure in a repository for use with a single project.

1

Open the TortoiseSVN Repo-Browser by right-clicking on the repository folder and selecting '<TortoiseSVN / Repo-Browser>'.

2

Enter the URL for the repository in the URL text box.

You can also navigate to the repository folder in Windows, right click on the repository folder, and select '<TortoiseSVN / Repo-Browser>', and it auto-populates the URL text box.

2

Create and name a new folder for the project in an appropriate directory by right-clicking and selecting 'Create Folder'.

3

Continue creating and naming folders for the trunk, tags, and branches.

Checking Out a Project

Once you have a folder in the repository for your project you need to check it out to a local folder on your computer. This associates the local folder and the folder in the repository.

1

From the TortoiseSVN Repo-Browser, right click on the trunk/tag/branch folder inside of the project you wish to check out and select 'Check Out'.

2

In the checkout window that opens, browse for the location that you wish to check the project out to. You may need to create a new folder for the project. You also have options for checkout depth and if you want to check out the head or any previous revision.

3

Click OK.

  • If the local project folder already has contents, you get a warning that the folder is not empty. If you wish to include the contents in your project, click OK. Otherwise, you need to move the contents of the folder to another location.
  • You should now have a project folder to start a project in. You may notice a hidden folder called .svn. Do not delete or modify this folder, it contains information needed to work with the Subversion client.

Adding Files to Subversion Control

Once you have files in your project you need to add them to version control. Initially, the Subversion client does not know which files are being managed and which files are being ignored. You do not need to add all files in a project to version control. Some files may contain local settings that all collaborators on a project may not need or there may be intermediary files that are not necessary to manage.

1

Locate a file or group of files you would like to add to version control, right click on the file(s), select '<TortoiseSVN/Add>'.
This step tells the Subversion to manage the file but has not yet sent the file to the repository.

2

Notice that the file now has a '+' icon overlay indicating that it has been added to version control but has not yet been committed. Also notice that the project folder now has a red exclamation mark indicating that there has been a change inside of the folder that has not yet been committed to the server. You can either commit the entire project or the individual file by right-clicking on the file(s) or project folder and selecting '<SVN Commit…>'.

3

In the dialog box that pops up, you can add comments regarding the commit event. Click OK. The file(s) or project folder changes will be sent to the server and the repository revision will be incremented.

Updating Changes to a Project

When other developers make changes to files and commit them to the server, they may contain changes that you need to work with. So you need to perform an update to pull in the changes.

1

Right click on the local project folder and select 'SVN Update…'.

2

A new window will pop up indicating the progress and actions performed during the update process. It is recommended to review these notes.

3

Click OK to close the dialog box.

Occasionally, there are situations where you have made changes to a file that another developer has made a change to and committed to the server. Subversion has diff and merge tools built in that help with merging the two resources together. This is discussed later in another topic.

Committing Changes to a Project

After you have made changes to files or added files to your project you need to commit the changes to the server.

1

Right click on the local project folder and select '<SVN Commit…>'.

2

If desired, add comments relating to the latest commit in the window that pops up.

3

Review the 'Changes Made' section to make sure all necessary files are included in the commit. Click OK.

4

Review the status window to make sure there were not any errors. Click OK.

Creating a Tag

Once your project is ready to create a test, alpha, beta, or release version, you may want to create a snapshot or tag of the project in its current state.

1

Right click on the local folder that contains the project you wish to create a tag of and select '<TortoiseSVN/Branch/Tag…>'.

2

Navigate the 'To URL' to a location in the repository, preferably in the Tags folder of the project directory.

Do not manually create a folder for Tag, manually append the name of the tag folder to the URL.

3

Select the source used for the tag, HEAD version, specific version, or working copy. Enter a message describing the tag. You also have the option to switch your working folder contents to the tag you created. However, this is not typical in a tag operation.

4

Select OK.

Creating a Branch

Occasionally, you may want to work on a new feature or test a new concept but don't want to disrupt the main project. To do this you can create a branch of the project or select files.

1

Right click on the local folder that contains the project you wish to create a branch of and select '<TortoiseSVN/Branch/Tag…>'

2

Navigate the 'To URL' to a location in the repository, preferably in the Branches folder of the project directory. Do not manually create a folder for Branch, manually append the name of the branch folder to the URL.

3

Select the source used for the branch, HEAD version, specific version, or working copy. Enter a message describing the branch. You also have the option to switch your working folder contents to the branch you created. This is done so that any changes you make will not affect the trunk.

4

Select OK.

Reverting File Changes

If you make a change to a file or a project and you have not committed the changes you can revert back to last committed version of the file.
Warning. Any changes made to the file since the last commit will be lost during the revert operation.

1

Right click on the local folder or file that you want to revert back to the last committed state.

2

Select 'Revert'.

Switching Projects

When you are working on the trunk, tag, or branch of a project you may need to switch to a different form of the project. This is done through the switch command. Be sure to commit any changes you have made.

1

Right click on the local folder or file that you want to switch to another version and click 'Switch'.

2

Browse to the location of the folder of the file that you want to switch to.

3

Select whether you want to switch to the HEAD revision or a specific version.

4

Select OK.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.