I have 55 branches in various locations. For example $/Repo/Trunk, $/Repo/Branches/branchNames, $/Repo/Features/branchNames, etc. I want to add some files to every branch. I scripted a copy and paste to put the files in the subfolder under each branch where I'd like to add them.
I then navigated to C:\TFS\Repo (my workspace for Repo) and searched for NewFile. Windows explorer brought up a list showing the 500 new files I'd just added across the 50 branch folders. I highlighted all of them, right-clicked, chose Team Foundation Server -> Add.
Here's my problem: it only added ten of them. I don't want to go back and redo that process, making sure to deselect everything I've already added (because if it's selected, the 'Add' option is disabled), and repeat this process 50 times. I also tried a script that will recursively search for files starting with NewFile and add them but it only added 300 of them (not sure why).
Am I missing something or is there no easy way for me to add all these files at once?
It sounds like you are using the File Explorer extension. Add the files via the Source Control Explorer in TFS. Right click on the root folder for the branches and choose Add Items to Folder. The dialog will show all files that could be added (including subfolders) and you can include/exclude as necessary.
This method will break the branching model for those files. After checkin there will be no branch relationship between the files and they will never merge.
You need to add the Files to one of the branches and merge them through the branch structure.
Ideally you would add them to your MAIN/TRUNK/MASTER and then merge that out to all of your DEV and FEATURE branches. You are unlikely to want to do this for RELEASE but I can imagine senarios where this would be necessary.
Related
I have couple of projects in which one or more files have been updated. These updates need not change the *.proj file but the overall project dll is changed.
Each project can have multiple folders and each folder can have multiple files.
Is there a way in TFS to know which file was when updated last?
If you want to simply see a list of changesets, then you can by going to:
View -> Source Control Explorer
Ctrl-G
Find
All Changesets and select $/Team project
That will give you a list of all changes.
You can get a more fine grained control of this using the:
tf history
Command; something like this:
tf history /recursive $/Project
I believe that if you wanted to list each file then you would have to go to the API.
Here is a slightly different take on this question (Find the tfs path of merged branch), different enough to deserve its own question.
In the above link, the authors describe how you can programmatically traverse the folder hierarchy using TFS API to determine the parent branch object from a folder or item within a branch, and then you can get the branch information for that branch.
However, a different question is: how do you use TFS API obtain a path to a different branch of the original folder or item, taking into account that the item may have been renamed or moved in the other branch?
For instance: if I have an object $/MyProject/Main/Foo/bar.txt, I can easily figure out that the parent branch is $/MyProject/Main using the method described. However, let's I also have the following versions of this file out there that were created by branching the original files:
$/MyProject/Dev/Foo/bar.txt
$/MyProject/Experiment/Foo/bar.renamed
$/MyOtherProject/Main/openbar.woohoo
How can I determine the list of references to the specific files or folders in a branch? Clearly there is a way to do this because Visual Studio's merge dialog automatically populates the list of available targets with all references to the source file or folder, even if the source is not a branch.
If TFS has been used to move files or rename them, as opposed to using the file system and then checking in 'new' files to TFS then you can use the history window to review the full history of a file, this will show you it's branch history and also any moves / renames that have occurred, this is because tfs uses an identifier for the file rather than its name.
I'm part of a large project mapped from TFS, within that project there is a folder which I have finished working on. I don't want that folder anymore so I'd like to delete my local copy. The problem is that TFS wants to mirror the change and delete the folder from source control, I don't want to remove it from TFS.
The only way I can find to do this is to unmap the workspace, and then go through and get all the other folders I need to work on.
Is there anyway I can just delete that folder locally?
This is an older post, but since the only given answer seems "not entirely correct" to me I'd like to answer anyway:
I blogged about this (in german) here: blog.nils-andresen.de
If you have a local copy, that you want to un-get or un-download like this:
simply right-click the folder and then click "Get Specific Version" or "Advanced > Get Specific Version" and specify Changeset 1.
Here's why from Martin Woodward's TFS Top Tips:
...if you do a "Get Specific Version..." on the files, and select Changeset 1, the files will be deleted locally and the server will know this. The color of the file in the Source Control explorer will go from black to gray and will have the phrase "Not downloaded" in the latest column.
Changeset 1 is a special changeset on your Team Foundation Server instance. It was created as part of the setup routine and only contains one thing - the root node ($/) in your source control tree. If you do a get for Changeset 1 on any actual files then they will not exist at that point in time on the system so will be deleted locally and the server will know this.
When the process is complete the "Latest"-column will show "not downloaded".
After that any remaining files in the filesystem can safely be removed.
You can cloak the folder in your local workspace.
By setting the working folder status to Cloaked, you can specify that a local folder should not copy files from the server when you perform a Get operation. You might choose to do this to conserve space on your local disk. If you later decide that you need to get files in those cloaked folders, you must change the status to Active and then perform a Get operation.
I have a local structure of directories and files. This codebase is a latest version of all of my code. I now need to upload that into TFS. How do I upload a bunch of folders and files at once?
Currently, I'm looking in the "Source Control Explorer". I see "Add Items to Folder". However, I can't figure out how to upload folders and files to the project I want to add it to.
What am I doing wrong?
Thanks!
First, make sure your local folder is mapped to a TFS
workspace.
In the Add Items to Folder dialog set the folders
and files you want in the Items to add and Exlcuded items tabs. These items gets into the list of pending changes.
Check-in pending changes.
if you want to keep your revision history you need to follow these steps:
http://www.robusthaven.com/blog/release-management/Migrating-TFS-to-New-Hardware
else follow #KMoraz answer to use source control explorer and right click to add items to the repository.
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.