Move Branch to another folder on TFS - Branch Exists error - tfs

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.

Related

Apply a changeset to a branch when directory has been renamed

I have made some changes in a branch which involve renaming the sub-dir a project's code files live in, and committed this branch. I was unaware that while I was working on my branch, another developer made changes to one of the source files in this sub-directory and committed this.
When I merged my branch, it didn't detect the other developer's changes and undid them silently, which we only found later. When I try to re-apply their changeset, it just restores the files in their previous location.
I can manually re-apply their changes since it's an isolated case, but is there actually a way I can apply a changeset in this scenario, tell TFS the two directories are equivalent or something?
In your scenario, you can use tf merge command from command line with /recursive keyword, as since there is no way to specify the old name of the source branch from the UI, but we can from the TF merge command line.

Why isn't source control working when I use a workspace in Xcode 5?

Normally I just create a new project, select the option to keep it under source control, and everything works.
Today I tried using a workspace, and it doesn't work. Here is what I did:
File->Xcode->New WorkSpace. (Create the workspace in a new folder). hit Save.
File->New Project->iOS->Single View Application->Next
Enter product name etc, Next
Make sure "Create git repository on My Mac" is checked. Select the folder where the workspace is saved. Choose "Add to"->The workspace you created. Hit Create.
Type some stuff into app delegate. Build. Save file.
Try to commit in source control --> Can't! All the options are greyed out. Even though changes are made to app delegate, the "m" symbol does not appear near it.
How do I correctly set up my workspace so I can use source control ? What is wrong with my set up ?
EDIT: Trying to add new files doesn't make the "A" symbol show up near the new files either. Clearly source control isn't on.
If I create a project that isn't part of the workspace, source control works fine.
EDIT: Navigating to the folder directory and running git status , gives the following message:
fatal: Not a git repository (or any of the parent directories): .git
Why wasn't a git repository created ? and how do I get it to work?
EDIT: I deleted my project from the workspace. Closed the workspace. Created the project again outside the workspace. Closed the project. Dragged the project into the workspace, and now the project is both part of he workspace, and it is under source control. Can't tell why it didn't work when I created the project within the workspace.
EDIT: As I don't know the reason why source control didn't work when I created the project within the workspace, I'm leaving this open in case someone has an answer, or knows if it is a known bug.
Looks like your .git directory is not inside the main workspace directory. Enable hidden file view in Finder and see where your .git directory is.
Xcode makes it rather confusing working with workspaces, since it does enforce any logical directory structure.
You can try using IDEs such as AppCode to give you better idea, you can get a free 30 day version of it from JetBrain's website.

What happens when moving unneeded files out of a TFS branch

I want to clean up our mainline branch by moving many files to an "Archive" folder outside the branch. These files still exist in the branches that are branched from mainline. What will happen the next time I merge to these other branches? Will the files I moved be deleted out of the target branches? Will they be moved somewhere? Or left alone?
Also, will the files I archived still have a link to the files in the other branches?
When you move a file to another folder (say Archive), it will delete the file from your Main branch and then do a "Source Rename" operation to point it to the new location (Archive folder). The change that happens in your Mainline branch is the "Delete" operation, so the next time you merge your Main branch to the other chid branches it will "delete" the file from that child branches as well.

How to merge in TFS when a file has been moved?

Here's our situation:
In TFS 2010 we have the main dev branch and a release branch.
At some point, it was decided that some code was in a poorly named directory so it was renamed in TFS (only on the main branch as it wasn't a bug fiw).
I have now fixed a bug in this moved code on the dev branch and want to merge the fix into the release branch.
However, when I do this, rather than performing a merge on the file, it creates a copy of the file in the new location and labels the change as 'merge, branch'.
Am I doing something wrong or is this a 'feature' of TFS?
Update: I've just revisited this post and retried. steps to reproduce the error are:
I have a file (control.cs) in Main/Desktop/UserControls and
Releases/V5/Desktop/UserControls.
Using source control explorer I 'Move' UserControls to UserControls2 and check in (I've also tried 'Rename' btw with the
same results)
I Edit control.cs on Main and check in.
I merge Main into Releases/V5 (Note I am merging on the whole branch, not just UserControls)
I now see the modified control.cs in Releases/V5/Desktop/UserControls2 and the old one in Releases/V5/Desktop/UserControls
I answered it earlier with the assumption that you have the DEV branch and I have more inputs after I did some more research in TFS with what you explained above.
This is what I did, I have a Source branch call it Main, I branched from Main called Release. In Main, I have two folders (f1 and F2), I renamed folder F2 to F3 and checked in the changes. Then edited the file File1 within F2 (now F3) and made some changes to the content, checked in the changes.
Now I merged the Main to Release and every changes were merged properly. In Release, the folder F2 was renamed to F3 and the file1 was merged to the right folder as well.
The change should show up as merge, rename for the folder and edit for the file.
Everything worked like a charm. I am using TFS2010 as well. Can you please let me know if you have done anything differently than what I just explained above? Am i missing something?
UPDATE:
I tested the exact scenario that you mentioned above and it merges the control.cs file properly even after the Move/Rename in the source branch. I believe that in your case - in the Release branch someone recreated (deleted and added again) the Usercontrols folder and/or the Usercontrol.cs file, so TFS doesnt recognize that its the same file/folder from the source branch and hence its not getting merged properly.
Can you check the history of the Usercontrol file in the release branch to confirm that?
Just adding some screenshots from my test:

Moving source, labels, and history in TFS 2010 from root folder into a branch

I've got a situation that I'm not sure if I can work around.
I've recently started on a new team that had never used any type of Version Control system, and our organization uses TFS as a standard (which I'd never used before).
After a lot of pleadind, I got the admins to creat a TFS project for my existing code on our server, and since none of my project's code had ever been checked in (after many years of existence), I wanted it in version control asap, so I checked my project into the root folder of the project. Not having read the Branching Strategy at http://tfsbranchingguideiii.codeplex.com/ I hadn't setup "Main" and "Release" folders in my main project.
At the time, I had separate folders on my local workstation containing the different releases we had made. I checked each version in, labeled it with the release number, and then checked the next version in on top of that.
I'm now running into an issue/bug with one of my previous releases and I'm trying to branch off a label in order to make some changes in one of my releases. TFS throws an error that I can't create a branch in that location (because all of the source in under the main project folder).
I've tried creating a "Main" and "Releases" folder, and then moving all the source under the Main folder, but the trouble is that the history and labels are pinned to the original location which is the root folder. If I try to branch off a label, the label doesn't exist in the "Main" folder that I moved the code to, but rather where it was created (in the root).
As such, TFS is still trying to branch from the root folder when I attempt a branch from the label.
My question is this: As an administrator for the server, is there a way to move everything (source, history, and labels) from their original location?
Thanks!
I don't think you can "move" the history and the labels. As you say, they're bound to the original source location. A move is effectively a rename.
In my experience, even renames of folders to folders that were deleted have caused those new folders to acquire the deleted folder's history.
Have you considered branching your current team project into another team project while observing the folder structure that you want in the new team project.
Create a new team project with the folder structure you want. E.g.:
/NewTeamProject
/Main (branch into here)
/Src (or whatever your root source folder is)
/Doc
/Releases
You can then keep the old team project around for "insurance".
It shows how helpful it is to have a reasonably thought-out folder structure.

Resources