A quick note about Team Foundation Power Tools (TFPT)'s "Unshelve" command…
tfpt unshelve has a /MIGRATE switch that will allow unshelving changes into a different branch / location than the one where they were originally shelved. I won't re-iterate the many articles describing how to use this command.
One issue that I ran into is unshelving a set of changes into a branch where some of the shelved files had been renamed / moved. It seems that the /migrate switch doesn't go back into TFS version history to locate the renames. Instead, it simply pulls out the changes and re-applies them to the new location.
Let's say that I start with Branch A. One user (John Doe) get's latest and starts making changes.
Then… a different user (Jane Smith) renames File1.txt and checks that in.
Then… (for some reason), they need to move John's changes from Branch A to another branch. (Let's pretend that Branch A is the main branch, but the changes are too large for this iteration, so they want to move them to a separate branch for a future release.) So they create Branch B, which looks like this:
Then… John shelves his changes and they attempt to use tfpt unshelve /migrate to move the changes to Branch B.
But a strange thing happens. They end up with this:
Huh? How'd that happen?
Someone who knows version control well could probably explain why, and suggest that this is obvious. But it wasn't to me, and as a result, some of the changes in the shelveset did not make it into the target solution.
How I should have done it…
If I was going to do this again, I think I'd:
- Get the source and the target branches to the same version. (Merge changes as needed between the branches.)
- In the source branch, get latest version so that the local workspace has the latest version.
- This should propagate any pending renames / moves that were made in that source branch, or it's parent branches.
- Shelve the changes that should be moved.
- In the target branch, get latest version.
- Run tfpt unshelve /migrate …