Rollback on branched changes
Hi kids,
Today, we're going to learn how to perform a rollback in a TFS branch where you ONLY want to affect the current branch (i.e. you don't want your rollback to affect branches with whom you branch changes).
Scenario
We have "contaminated" a (Release) branch with changes that belongs to the next release down the road. An issue arrise in production, which needs immediate hotfixing. The responsisble team makes their change in their dedicated Hotfix branch, but when they are to merge their changes to the Release branch, they realize that the release branch does not look like they left it. (In this scenario, deployment scripts scripts are configured to deploy from the Release branch and nothing else). Technical Solution
(You'll need Microsoft Team Foundation Server Power Tools (TFPT))
We have "contaminated" a (Release) branch with changes that belongs to the next release down the road. An issue arrise in production, which needs immediate hotfixing. The responsisble team makes their change in their dedicated Hotfix branch, but when they are to merge their changes to the Release branch, they realize that the release branch does not look like they left it. (In this scenario, deployment scripts scripts are configured to deploy from the Release branch and nothing else). Technical Solution
(You'll need Microsoft Team Foundation Server Power Tools (TFPT))
-
Sequential rollback of changes in Release
-
Get history of changes in branch
CAREFULLY write down the change-set numbers
Undo (and shelf) any local changes to your workspace
Get latest from branch you want to roll back
Start Visual Studio 2008 Command Prompt
Go to the folder of your branch (eg. C:\Source\Release)
For Each Number Set in Change List, sorted highest to lowest:
-
Run tfpt rollback /changset:Number
Check in (with comment: "Rollback (Check-In/Total number of items in your change list) Changeset: Number)
Example: Rollback (1/12) Changeset: 34156
-
Get latest version (recursive, overwrite) of branch
Copy the physical folder to a temp folder (Ex: %TEMP%\COMPARE\LATEST)
Get specific version (recursive, overwrite) of branch from the changeset you wish to be in
Example: If I were to rollback change sets 5-10, I want the branch to return to the state of change set 4. Using, for example, WinMerge, compare the two folders. They should be identical.
-
Get latest version (recursive, overwrite) (again) of source branch (the one you have rolled back).
Get latest version (recursive, overwrite) of target branch.
Get history of your source branch, CAREFULLY write down the change set numbers of the changes you have made during your rollback
For Each Number in Change List, sorted lowest to highest:
-
tf merge /discard /recursive source_branch target_branch /version:CNumber
Example: tf merge /discard /recursive $/Release/DevXp $/Base/DevXp /version:C31342
Comments