Branch and Tag Support in Subversion
Subversion is becoming an increasingly popular software configuration management system. VP products can talk to Subversion directly to provide revision control and collaboration functionalities. You can import projects, commit and update your modeling project to the Subversion repository. If there is more than one team member modifying the same set of models at the same time, you can also resolve conflicts with the assistance of the comprehensive conflict resolution UI.
Other than primitive revision control and collaboration, you can also manage your modeling project with branches and tags. Tags are used to mark milestones or release-quality projects, so used to keep your work isolated from any changes. Branches are separate lines of development isolated from the main line, to avoid making unstable changes to the main line. Once the changes are stable enough the branch can be merged back into the main project (the trunk). Branching from a project can keep the modeling going on while the core project is kept stable.
Importing a Project into the Repository
Animated Demo
To start modeling collaboratively, you have to use the Teamwork Client to import the project to the Subversion repository. Open the Teamwork Client via Tools> Teamwork> Open Teamwork Client...
The login dialog box will appear. Select ‘Subversion’ from the drop-down menu, fill in the login details and click OK.
The ‘Manage Project’ dialog box will appear. As we are creating a new project we do not need to select a repository. Click Cancel to proceed.
Import a project to the repository by selecting Project> Import Project to Repository
The import project box will appear. Create a remote folder by right-clicking and select ‘New Remote Folder’.
Enter the name and a comment for the folder and click OK.
Select a folder for containing the new project. Enter the name of the project and select ‘Create New Project’. It is also possible to use a currently opened project as the source or import it from an external project. When you have checked your settings, click OK.
The project will be checked out automatically
Managing a Project in the Teamwork Client
Animated Demo
First connect to the subversion repository (see steps above). Then open the ‘Manage Projects’ dialog box using Project> Manage Project
To manage a project select a project node and click the ‘>’ button to add it to the projects list.
To discard a managing project just select it and click the ‘<’ button to remove it from the list.
When you are satisfied with your list click OK to confirm.
Checking out a Project
Animated Demo
Checking out a project from the repository means to copy the project from the repository into your local drive. Select a project to check out and click the ‘Checkout’ button in the bottom right corner.
The project is now checked out into your local drive. You can open it in VP-UML by click ‘Open Project’. Clicking ‘Open Project’ without checking out will automatically check out the project before opening it.
Committing Changes to the Repository
Animated Demo
Let’s have a look at our modified project.
To commit it to the repository select Tools> Teamwork> Commit.
Committing can also be done by clicking the ‘Commit’ icon in the toolbar or right-clicking a project node in a tree and selecting Teamwork> Commit from the pop-up menu.
Enter a comment for the project commit and press OK.
The ‘Commit Model(s)’ box list of modifications that will be committed to the server. Click OK to proceed committing.
Updating Changes from the Repository
Animated Demo
To update changes from the repository select Tools> Teamwork> Update.
The ‘Update Model(s)’ dialog box lists all the changes that will updated to your project. Click OK to proceed. The changes made by other team members will be brought to your copy.
Branching and Tagging a Project
Branches are tags are quite similar things, but with different purposes. Tags are used to mark milestones or release-quality projects, to keep your work isolated from any changes and are therefore rarely modified. Branches are for when modeling activities will be carried out that may make the project unstable, but can always merge back to the trunk, or vice versa.
Creating a Branch
Animated Demo
To create a branch or tag first connect to the Subversion repository (please refer to section above). Select a project from the Projects list where you want to create a branch and click Projects> Branch from the menu.
Enter the branch name and select the action you want to take after creating the branch.
By selecting ‘Stay in trunk’ it will stay at the current branch, trunk or tag. ‘Start working in branch’ will checkout and switch to the new branch, while ‘Check out branch’ will download the branch to the local drive, but stay at the current branch, trunk or tag. We will select ‘Stay in trunk’.
Click OK to continue. A warning dialog box may ask if you want to create the branch. Click Yes.
The branch is now created.
Creating a Tag
Animated Demo
To create a tag for a project connect to the Subversion repository and select the project you want to add a tag to from the Projects list. Select Projects> Tag from the menu.
Enter a tag name and select the action you want to take after creating the tag. As with the branches, selecting ‘Stay in trunk’ will stay at the current branch, trunk or tag. ‘Start working in branch’ will checkout and switch to the new branch, while ‘Check out branch’ will download the branch to the local drive, but stay at the current branch, trunk or tag. We will select ‘Stay in trunk’.
A warning dialog may ask if you want to create the tag. Click Yes to create.
The tag is now created.
Suggested Branch Usage
Here is an example of how branches might be used in Subversion.
Merge Changes from Trunk to Branch
Animated Demo
From time to time the trunk of the project may keep modifying, for instance, to fix modeling issues. You can bring the changes from the trunk into a branch by using the Merge function. This is the branch project. The color of its classes has been modified to orange.
To merge select Tools> Teamwork> Merge.. and a dialog box will show.
Enter the path you want to merge from. By default this path is set to the trunk. Press OK.
The ‘Merge Project’ box will show the changes that will be merged to the branch. Click OK to continue.
After the merging is complete it will automatically start to commit the changes made in the local copy to the repository. Enter a comment, and press OK to continue.
Click OK again in the ‘Commit Model(s)’ dialog box.
The changed are merged and committed. In this example the ‘TransactionType’ class has been added from the trunk to the branch for further formatting improvement.
Merge Changes from Finished Branch to Trunk
Animated Demo
After a branch is finished, you can merge all the work from the branch back to the trunk. Before merging from branch to trunk, please make sure all trunk work has been merged to the branch. After merging a finished branch back to the trunk, the branch will usually be deleted.
We are now in the trunk of the project.
Let’s merge the ‘Improve-Formatting’ branch back to the trunk. Select Tools> Teamwork> Merge...
In the Merge dialog box, select the path you wish to merge from by clicking the ‘...’ button next to the path field. In this case it is the branch project.
The ‘Merge Project’ dialog box will show all the changes that will be merged back into the trunk. Click OK. It will automatically ask you to commit the changes. Select OK to continue and commit.
The trunk is now modified as the changes made in the branch are merged into the trunk.
Normally no more changes are made to a branch after it has been merged back to the trunk. In this case you are advised to delete the branch altogether.
Deleting a branch
To delete a branch, open the Teamwork Client and select Project> Delete Branch... from the menu.
From the ‘Delete Branch’ box, click the ‘...’ button to choose which branch to be deleted, then press ‘Select’.
Enter a comment in the dialog box and click OK to delete the branch.
Resources