Every once in a while I find myself in the middle of a change and think that the changes I am making need to be pushed into a new branch. Being in an evironment using TFS as the source control system, that kind of flexibility is not something I generally think of in the scope of TFS.
From a Stack Overflow question, I was able to get a start. The most important line was the TFPT line. It appeared the task at hand was achievable.
1. You need to include the new branch in your workspace in order to see any changes (otherwise you'll only see the checked-in versions). From Source Control Explorer, select Workspace->Workspaces... from the toolbar.
2. Select Edit for your workspace and add a mapping to your new branch, e.g. Active|$/Root/MyProject-Branch|<my Local TFS Storage>\MyProject-Branch
3 .Run the command tfpt unshelve <shelveset> /migrate /source:$/Root/MyProject /target:$/Root/MyProject-Branch. It should create a new shelveset with mappings changed to your new branch.
4 .Try unshelving the new, migrated shelveset onto your new branch.
This wasn't very clear, so I continued my search. I found Brian Franklin's post was far more detailed and gave a better picture of what needed to happen.
1. Shelve the pending changes.
2. Create a new Dev branch with the latest changes and perform a Get on the branch.
3. Start Visual Studio Command Prompt.
4. Set the path to the folder the new branch is mapped to.
5. Execute tfpt unshelve command supplying the following arguments:
1. Shelveset name
2. Source server path
3. Target server path
4. Migrate
5. No Backup
In the process of going through his steps, which was easy enough, I ran into a peculiar error.
TFPT.EXE unshelve bundles /migrate /source:"$/<TFS project path>/branches/Feature1Rewrite" /target:"$/<TFS project path>/branches/Feature1RewriteExploritory" An item with the same key has already been added.
Googling yielded no fruitful paths forward. And after some thought, it occurred to me that I might need to check in my branch before migrating my shelf to the new target. After checking in my branch and retrying, the did not occur.
It may be pertinent to note that when I create branches in this environment, I receive an error saying that I don't have permission to create a branch. However, the branch is created and everything seems to work.
No comments:
Post a Comment