I'm trying to unshelve a shelveset using the command line with team explorer everywhere. I keep receiving this error:
An error occurred: TF400016: Unshelve with Merge is not supported on the version of Team Foundation Server on which your team project is hosted.
The shelveset is on the same branch as the one I'm trying to unshelve onto. I've run tf undo -recursive . before trying to unshelve and it tells me there are no pending changes, so I'm unsure why it is trying to merge. Has anyone had any success with this? Thanks for the help.
Has the file changed in tfs since the shelve set was created? I have seen the same problem if you try to unshelve a set from previous version of the file over a subsequent version. To resolve, you can pull the code that matches the shelve set, then unshelve, then get the latest code and the merge will happen correctly.
Related
I checked out some files from the main branch of our code set in TFS. Later, a separate branch was created. I would like to check in my code to the new branch, even though I originally checked it out of the original one. Is this possible?
EDIT: I know I can check in to the main branch and do a merge, but I'd like to avoid that if possible.
Well, it's based on which version control you are using.
If you are using GIT, it's simple. After you created the new branch in the UI, you just need to do a 'check out' of the new branch. Any uncommitted changes will be automatically point to the new branch. You can then commit them there.
If you are using TFVC, you need to shelve your changes on the original branch and unshelve them on the other branch. This functionality is provided using tfpt unshelve /migrate command. More detail steps please refer the question: TFS: submit changes done locally in one branch to another branch
It's also a sample which shows the difference between GIT and TFVC.
Install TFS 2015 Power Tools
Create a shelveset of your changes
Open the Developer Command Prompt
Use the tfpt unshelve /migrate command as such
tfpt unshelve /migrate /source:$/Project/Branch1 /target:$/Project/Branch2
I couldn't do with the answers using Power Tools, so I checked in on the source branch, merged to target, and rolled back from source branch.
I downloaded Team Server Power Tools (TFPT) to be able to take a shelveset that was created on one branch and unshelve it on another. But for some reason, TFPT insists on asking for the target server path, which I find a bit ridiculous since it should be visible to TFPT.
A quick look around, it appears that there is an API that will state the server path, but I would rather have this available through scripting. Is there a way to get the server path through scripting?
If you have a shelveset called MyChanges on the Main branch in a Team Project called MyProject and you want to unshelve it to the Dev branch instead then the tfpt command would be:
tfpt.exe unshelve /migrate /source:"$/MyProject/Main" /target:"$/MyProject/Dev" "MyChanges"
I need help resolving the following issue:
I am attempting to unshelve code from the source branch onto a target branch.
I am using the following:
VS2012 RC
TFS 2012
VS2012 x64 Cross Tools Command Prompt
When I use the command prompt to perform the unshelve operation, the following occurs:
Shelveset details dialog gets displayed with list of change files.
Click Unshelve button.
Observe command prompt output: "An item with the same key has already been added."
I have downloaded ServicePack1 for power tools.
However, I have failed to resolve this issue.
I had the same issue and fixed it when I re-shelved the changeset from the source branch but chose not to preserve pending changes locally. After this the migration of the new shelveset ran smoothly.
(I also made sure I'd followed the below steps collected from other answers on this site)
Use a workspace that encompasses both source and target branches
Run the command from the folder mapped to the source branch
Check for quotes around any paths containing spaces
Deleting the cache in C:\Users[USERNAME]\AppData\Local\Microsoft\Team Foundation\4.0\Cache and restarting Visual Studio
I had the same error when using Visual Studio 2013 and the following command:
> tfpt unshelve /migrate /source:"$/Root/Solution" /target:"$/Root/Branches/Solution" "The name of my shelveset"
> An item with the same key has already been added
Research
Here's what I tried to fix the issue:
Clearing the Cache as per Andrey's answer
Try running the command from the Source -> Branch and Branch -> Source
My workspace already encompassed both source and target branches
Solution
Open up your equivalent of the VS2013 x86 Native Tools Command Prompt.
Check you have Team Foundation Power Tools installed:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\tfpt
Ensure you have 0 Pending and Excluded changes.
I had some Excluded changes which were detected but not added and this is what caught me out. Excluded changes should look like this:
Note: No "Detected: XX (adds)" - should not be visible
When you run tf status, you should see something like the following.
Either 1 change(s) for the .tfignore file or 0 change(s). Anything else will upset the merge.
C:\tfs\Root\Solution>tf status
File name Change Local path
$/Root .tfignore edit C:\tfs\Root\Solution.tfignore
1 change(s)
Ensure you are running the tfpt command from the source Solution directory
You should be now be able to successfully merge a shelveset from one branch to another.
Note on .tfsignore:
If you have a lot of pending changes that you don't want to undo for whatever reason, then
a modification to the .tfignore file is ok.
If this is the only file that you have left with changes, it won't brake the merge.
.tfignore reference => stackoverflow - How to ignore files/directories in tfs?
Try to undo all changes on Source and Target branch and then try again...
Try to delete all the files in the following folder and restart VS2012 (Source):
C:\Users[USERNAME]\AppData\Local\Microsoft\Team Foundation\4.0\Cache
I'm trying to use tfpt to migrate a shelveset from a source branch into a target branch, but it doesn't appear to do anything...not that I'd expect much more...but any chance anyone knows what's wrong? I'm following the instructions correctly I think...
I've got:
tfpt unshelve "DbMigrations" /migrate /source:$/TeamProject/Main /target:$/TeamProject/Releases/7.20
What happens after you run the command? You need to have a few things set up before migrating:
A workspace that encompasses both the source and target branches.
You need to run the command in a folder within the source.
Once you run the command you should be asked to merge the changes from the original shelfset into the destination branch and resolve any conflicts, which finally pends a changeset on your client. Nothing is touched on the server until you check that changeset into TFS itself.
I experienced the same problem and I could not get it to work by specifying the shelveset name. However, I discovered that if you remove the name of the shelveset altogether, TFS will pop up a window with a selection list of available shelvesets to choose from. Select the desired shelveset and perform all other merge operations as per normal.
Example: c:[mapped workspace target path] > tfpt unshelve /migrate /source:"$/Sourcepath" /target:"$/targetpath"
You need to use the branch paths on the TFS server, not your local machine. To find the paths, go to source control explorer in visual studio, right click the branch, advanced > properties, and you want the branch name, not the local path. If the path has spaces, wrap it in double quotes.
I need a way to force a branch in TFS to update itself to exactly match what is in the working folders. I need something that will delete files that are on the server but not in the working folders, add files to the server that are only in the working folders, and update the changed files by using the exact version that is in the working folders. I need this to be form the command line or the API’s and not a manually in the UI.
Does anyone know of any way to do this?
tf undo $/ /r
tfpt online /adds /deletes /diff /noprompt
tf checkin /comment:"synchronizing" /noprompt
Get tfpt here if you don't have it already: http://msdn.microsoft.com/en-us/teamsystem/bb980963.aspx