"tfpt unshelve /migrate" Doesn’t Account for Renames

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.

For Example:

Let’s say that I start with Branch A. One user (John Doe) get’s latest and starts making changes.

Branch A
    Src
        File1.txt

Then… a different user (Jane Smith) renames File1.txt and checks that in.

Branch A
    Src
        File1_RENAMED.txt

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:

Branch B
    Src
        File1_RENAMED.txt

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:

Branch B
    Src
        File1.txt
        File1_RENAMED.txt

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:

  1. Get the source and the target branches to the same version. (Merge changes as needed between the branches.)
  2. In the source branch, get latest version so that the local workspace has the latest version.
    1. This should propagate any pending renames / moves that were made in that source branch, or it’s parent branches.
  3. Shelve the changes that should be moved.
  4. In the target branch, get latest version.
  5. Run tfpt unshelve /migrate …

 

Cheers!

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

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: