Why cant I branch a TFS project? - tfs

Its driving me crazy already, I have a folder converted into a branch, when I try to branch this one, the dialog suggests a name, which I accept, then after confirming that I really want to branch I get the nice error message:
TF10175: The MYPROJECT-branch team project does not exist.
Althoug the branch dialog clearly states: "The new branch will be created and commited as single operation"
Ok, so, when I branch to a existing but empty folder (converted to a branch according the MS doc) I get the opposite message:
The item $/MYPROJECT-TEST already exists.
So what is it now? It really drives me crazy. I just cant branch this damn project.

Please follow these steps to delete the workspace:
In "Team Explorer" select "Pending Changes"
Beside the "Check In" button click on "Actions" and select "Manage Workspaces…"
Select the Workspace and press "Remove"
Then follow these steps to branch a TFS project
when I branch to a existing but empty folder
We cannot specify an existing folder as a target. It will create a new folder based on the target path you entered, we should branch to a folder that does not exist. Then we can convert the folder to a branch via the button convert to branch.
Steps:
a.
b. Check in the new folder
c. Convert the folder test to branch:
Update1
Branch a TFVC project
Steps:
Select the TFVC project and convert the project to branch via the button Convert to branch.
Branch the TFVC project to an existing project repository folder.
Note: The target folder should not exist until the branch is completed. And we just can branch the project to another project repo folder.

Related

How do I branch?

https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/branching-strategies-with-tfvc?view=azure-devops
I have a brand new project in Azure DevOps. There's nothing in it yet, but I want to set up the branches to model the Servicing, Hotfix, Release isolation strategy from the link above.
To do this, I need a branch, and a branch of a branch.
When I right click my project and say "Branch", it prompts for a Target.
This is where everything I try does not work.
First thing I tried was to use $/Master/HotFix. This returns an error "The target item $/Master/HotFix cannot be under the source item $/Master.
Then, I tried just $/Master-HotFix and get an error "Source control must branch into an existing team project. Master-HotFix is not a team project"
So, I went to Azure DevOps and I created a new project called Master-HotFix. I mapped it in Visual Studio, and tried again. This time, I got the error "Unsupported pending change attempted on team project folder $/Master-HotFix. Use the Project Creation Wizard in Team Explorer to create a project.
Surely making a branch isn't this difficult? What am I missing?
According to your description, seems you get promoted a kind of below dialog
I have a brand new project in Azure DevOps. There's nothing in it yet
You are trying to branch a Team Project rather than a folder containing your code.
You should first have your code in a folder, say "Master", under the "$/TeamProject/" folder. You can then branch "$/TeamProject/Master" to "$/TeamProject/Master/child".
If you have dumped all of your code into the root of your team project then you will need to move it into a folder first, then branch that folder.
warning: You can create a new team project that is a branch of this one, giving you "$/Master". However this method is a terrible idea and will lead to pain and suffering
For more details please refer our official tutorial:
Convert a Folder to a Branch
Branch a folder or file
In order to branch in TFVC you first need to create you master/MAIN branch as a folder. Then you check that folder in. After you can convert it to a branch from the branch menu. After that you'll be able to branch off that master/MAIN branch and create the structure you are trying to do.
Cheers,
ET

Cant create a branch from a TFS project

I started using TFS and I was not using branches for my project, but now I need to manage releases, so my Idea is to make Branch from the project and for every release create new branch from the main branch.. so
In VS2015 Source Control Explorer, i click on TFS project > Branching and Marging > Convert To Branch and this error happened
TF203028: You cannot create a branch at $/ProjectA because a branch alreadyexists at $/ProjectA/Main. If $/ProjectA/Main is not a branch convert it back to a folder and retry the operation.
the problem is that I don't see any branches in source control manager neither in TFS website, I created empty branch earlier but I deleted it. What to do ? I don't want to create new project with Main branch and copy/paste the source codes because I want to preserve the commits.
In TFS, you never really delete anything. In fact, if you look under Tools -> Options -> Source Control -> Team Foundation Server, there is an option to show deleted items:
To actually delete an item, have a look at the tf destroy command.
I believe that you can simple rename the folder, and that will maintain your history, should you not wish to permanently delete the old branch.

Teamfoundationserver branching not working in any form

I have tried branching in a very simple sample project and it worked. Now I want to branch a real life project and it is simply not working.
When I try to branch the whole team project, tfs tells ask for a destination. If I choose a new destination it tells me, that the destination does not exist. If I create a new one and point to it, it tells me that the folder already exists.
When I try to branch the team project into a sub-folder within the team project it tells me that this procedure cant be done, fair enough.
But when I try to branch a single project within the team project to another sub-folder it tells me that there was no correct mapping ('keine passende Zuordnung', in German I don't know the exact English error message).
Any help on this is very appreciated. I fail to see, what I do differently here, then I did before in my test project.
Edit: As suggested I post an image of my project structure. The upper folder is my actuall project which I have converted from a teamproject to a branch. The second on is the destination folder which is empty.
When branching a whole team project ($/ProjectName), you either need to use the New Project Wizard to create a new project and specify that it should branch from your current project.
When branching a sub-folder of your team project, that should work, unless a parent of that sub-folder is marked as a branch root, in which case there is no location to branch to.
Any folder that either holds a branch root as a child, or has abranch root as a parent cannot be used to create a new branch:
On the commandline try running tf branches . from the folder that you want to branch (to see if it is part of a branch) and from the folder you want to branch to. If the target folder is already under a branch, you can't branch to it. You might need to use the Convert to Folder option in the Source control explorer to allow branches to be created there.
It looks like you've already created the target folder, and the target folder is already a branch. You haven't described how that came to be, if it's a result from a Branch action on the source folder, then instead of choosing Branch pick Merge instead.
If there is no relationship between the two folders then it won't be pre-populated in the list of possible merge targets. If you're using Visual Studio 2013 you can enter the path manually and TFS will create the relationship by doing a baseless merge. If you're using an older version of Visual Studio you may need to create this relationship from the commandline:
tf merge "$/TeamProject/Machinenzustandsanzeige" "$/teamproject/Machinenzustandsanzeige NC-Prä" /baseless /recursive /collection:{uri}
You can also destroy the target branch that you've created using the commandline and then re-attempt the branch, which should then succeed.
tf destroy "$/teamproject/Machinenzustandsanzeige NC-Prä" /recursive /collection:{uri}
tf branch "$/teamproject/Machinenzustandsanzeige;T" "$/teamproject/Machinenzustandsanzeige NC-Prä" /recursive /collection:{uri}
tf checkin "$/teamproject/Machinenzustandsanzeige NC-Prä" /recursive /collection:{uri}
In case the workspace isn't setup correctly yet you can either do it through the UI using the steps outlined here or from the commandline using:
tf workfold /map "$/teamproject/Machinenzustandsanzeige NC-Prä" c:\path\where\you\want\it
followed by:
tf get "$/teamproject/Machinenzustandsanzeige NC-Prä" /recursive
to effectuate the addition of the folder.
There is a very slim chance that the a-umlaut is causing the issue. Have you tried a path without special characters?
What you want to achieve is a standard operation and TFVC supports it, but somehow you ended up in a situation that is non-default. Even in such a situation you can get it fixed, but you might need to resort to advanced features such as /baseless or /force or tf destroy which are not available from the UI.

Move Branch to another folder on TFS - Branch Exists error

I have a project setup with the folder structure underneath
Project
Archive
Source
Development
Source
I want to move some old branches under Development/Source to Archive/Source. I can move it, however, when I try to commit the changes for the move, it states that the branch already exists. I can view all deleted branches and I cant see anything in the archive folder which state that it already exists.
Try converting deleted branches into folders. Maybe that helps.

Is there a way to start a branch (based on a label) in the root of a team project?

I'm in the following situation with TFS 2010:
I have a team project (with 2 sub-folders of source code).
The team project has no branches but has been labelled in the past.
I need to create a branch in the root of the team project, based on a specific (and historic) label.
I have tried this method (all in Source Control Explorer):
Right-click team project and go to Branch...
Change Target to $/MyTeamProject/NewBranchName
Choose appropriate label.
Uncheck "Convert source and target folders to branches".
When I click OK I receive this error:
The target item $/MyTeamProject/NewBranchName cannot be under the
source item $/MyTeamProject.
Any ideas?
PS. I was able to branch the label into a different team project, but that doesn't solve my problem.
My guess is that the item $/MyTeamProject is included in your label, then TFS can't create a branch under that path.
So edit the label and remove the $/MyTeamProject path and try again.
EDIT :
You can only remove a folder using the TFS Sidekicks.
The problem is that you are trying to create a branch under the root of the branch you are branching from. That is, by right-clicking on the team project and selecting branch, you cannot create a branch under that team project.
Instead, try the branch operation from the folders. That will allow you to place them under the team project. If you want them to have a single common root, you will likely need to branch them separately into a subfolder under the team project.

Resources