Subversion: Common Version Control Operations in Visual Studio 2008

Recently, I have introduced to a few of my friends which are ISV business owners Subversion. We were discussing the vulnerabities of other software which we have experienced. I thought would be worthwhile that I summarize commonly asked questions on version control operations especially if you are moving from one product to another product in this blog entry. 🙂
 
Lock an item
When you need to be the only user able to edit and commit changes to an item, you can use the Lock option. Examples of such situations are when you are working on files whose changes cannot be merged, such as graphics or binary files. Until you release the lock, other users will be blocked from committing their changes to that item.
 
Steps:
1. In the Solution Explorer, right-click a file and select Subversion > Lock.
2. In the Lock window, enter your reason for locking the file.
3. Click OK.
 
NOTE: When the operation completes, you will see a "lock" icon next to the item in the Solution Explorer. When you commit your changes to a locked item, the lock is released. If you want to retain the lock, select the Keep locks option while committing it.
 
Unlock an item
To allow other users to edit and commit changes to an item that you have locked, use the Unlock option and release the lock. When you commit a locked item, usually the lock is released. However, if you had selected the Keep locks option while committing it, the lock does not get released. In that case, you need to manually unlock the item.
 
Steps:
1. In the Solution Explorer, right-click a locked item and select Subversion > Unlock.
 
NOTE: When the operation completes, the "lock" icon next to the item is removed.
 
Undo changes
To undo all your local changes to an item since the last update, use the Revert option. This operation does not affect any changes that you have already committed. It only reverts your local changes, and restores the item to the version to which it was last updated. To undo all changes up to a specific revision, you need to use the Revert to Revision option.
 
Steps:
1. In the Solution Explorer, right-click an item and select Revert. The Revert window displays a list of all the items you changed locally since your last update.
2. In the Select items to revert window, check the required items.
3. Click OK.
 
Note: Since you cannot undo a revert operation, you might consider backing up your local changes before reverting them.
 
Compare revisions
To compare different revisions of a project file or folder, use the Diff option.
 
Steps:
1. In the Solution Explorer, right-click a projet file or folder and select Subversion > Diff.
2. In the Select items for diffing window, select the revisions you want to compare. For example, select the head and previous revisions to compare the latest revision with the previous one. To compare versions of the file or folder as it existed on different dates, select the Date option for the "start" and "end" revisions and specify the corresponding dates.
3. Click OK. By default, the differences are displayed in a Unified Diff format. You may find it helpful to check them before you commit your changes.
 
Revert an item to a specific revision
To revert an item to a specific version, use the Revert to revision option.
 
Steps:
1. To revert only your local changes since the item was last updated, use the Revert option.
In the Solution Explorer, right-click an item and select Subversion > Revert to revision.
2. In the Reverse Merge window, select the revison you want to revert to.
3. Click Merge.
 
Find out who made what changes to a line
When you need to know what changes were made to a specific line in a file, as well as who made them, you can use the blame option.
 
Steps:
1. In the Solution Explorer, right-click an item and select Subversion > Blame.
2. In the Blame window, the item appears selected. Specify its start and end revisions within which you want to view the changes.
3. Click OK.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: