We have situation where make label with 4 files (lets say that all project consists from 10 files, so another 6 files are not placed in our new label).
When do action Get Specific Version and for Version Type place Label and after that choose our new label, all files from local folder that are not included in new label (in our example, another 6 files) are being deleted!!! This is very weird situation, so could you explain scenario where I want to get specific version of files that are marked in new label, but to keep existing version for all other files and keep them in local folder, so I want just to update files that are in my new label and do nothing with files that are not in lablel???
I suppose that there is some setting in TFS that probably can prevent deleting these files!
TnX in advance!
Nemanja
This is working as designed. Be very careful with Labels in TFS, they're a bit different from the labels you might be used to in other types of source control. In TFS labels are very mutable, and can easily be moved on just a single file. They're powerful, but dangerous.
As mentioned, you can do the get by label for individual files and you'll be fine. However, when you do a specific get by label on a folder, you are asking TFS to restore everything in that folder to the same version that is indicated on the label. If a file in that folder is not labeled, it is not going to match any version label, and is going to be deleted.
Keep in mind that a single file/version in TFS can have multiple labels, so one way you could get around this is to label all files in that directory with a new label, then move this new label to the same revision as the other label.
Consider three files in $/Project/Folder
... two are labeled with LABEL_A
, and one is not labeled at all. You would do something like this.
tf label /server:http://tfs:8080 LABEL_B $/Project/Folder /recursive
This will label all of the files with LABEL_B. Now you need to move LABEL_B
to the correct version of the LABEL_A
files:
tf label /server:http://tfs:8080 LABEL_B $/Project/Folder /recursive /version:LLABEL_A
Note that there are two L's
after the /version:
... this tells TFS to move that label from one version of the file to another version.
Once that is done, get specific based on LABEL_B
, and you should be good to go.