Dmitry Misyura

We are migrating from SourceOffSite to TF Server and we are in proof-of-concept stage atm.
We need label functionality to mark specified version of code(single file) with corresponding environment where this code was deployed.
Lets now take example.
I have file vb.sql:

ChangeSet Change User Date Comment
1103949 edit Dmitry_Misyura 25.07.2007 12:49 xez
1017118 edit Andrew_J_O'Brien 29.05.2007 16:56 added []
1013380 add Andrew_J_O'Brien 14.05.2007 17:43

Now I am apllying label "test zbone" to version 1017118

tf label "test zbone" "$/EMEA - Sandbox/Andrew/vb.ini";1017118 /child:Merge
Updated label test zbone@$/EMEA - Sandbox

Checking in SC Explorer - Yes. Label is apllied.

Now I am apllying label "test zbone" to version 1103949 and I want that label of version 1017118 remain safe:

tf label "test zbone" "$/EMEA - Sandbox/Andrew/vb.ini";1103949 /child:Merge
Updated label test zbone@$/EMEA - Sandbox

Checking in SC Explorer - Yes. Label is apllied to 1103949 but it was removed from 1017118.

So here is the question:
Why /child:Merge wasn't successfull
Is this my misunderstanding of label concept, my wrong actions or bug


Re: Team Foundation Server - Version Control Label command with /child:Merge option

Eugene Zakhareyev

When you label certain item, it will appear in the label at most once. The whole idea of label is to take snapshot of the repository at specific point (identified by date, changeset etc.), thus it does not make sense to have same item appear in the label twice, does it When you apply the same label on the different version of the same item for the second time, it will update the label with the newer version of the item (essentially, you are changing that "labeling" point).

If I understand you rightly, what you are trying to do is not to update the label, but create a new one. Then you will have to specify different name for the label (say "test zbone 1.1.1", "test zbone 1.2.2" etc.). When you want to reproduce the environment, you may just get the labeled item(s).

Hope that helps,

Eugene






Re: Team Foundation Server - Version Control Label command with /child:Merge option

Dmitry Misyura

Thnak you for your reply Eugene.
Maybe I was not clear enough.
1. If label command simply moves specific label from one changeset to another when it has same name then what the difference between /child:Merge and /child:Replace

I'll cite MSDN documentation:

"Using the /Child Option to Avoid Labeling Mishaps

If you issue a label command together with a pre-existing label name and an itemspec that includes files that are already marked by the same label, the value of the /child option determines whether the marked files are updated with new revision information. That is, the files are labeled by the same name, but have different scope.

For example, assume that you have folder named c:\projects that contains two files, 314.cs and 271.cs. Also assume that version C70 of 314.cs is labeled "ready." The latest version of 314.cs is version C93. If you apply a label, "ready" to the latest version of the folder and the files it contains using the following command, the "ready" label is moved from 314.cs;C70 to 314.cs;C93:

tf label ready c:\projects /recursive /version:T /child:Replace

On the other hand, if you do not want to move the existing label "ready" from version C70 to version C93 of 314.cs, you would use the following syntax:

tf label ready c:\projects /recursive /version:T /child:Merge

When you specify Merge as the value for the /child option, pre-existing instances of the issued label are left alone.
"

2. The point is to mark stage of specific file. It can have several stages: development, local test, global test, stress test, preprod test and production. We have to know was some specific file deployed on some environment or not. Thats it.




Re: Team Foundation Server - Version Control Label command with /child:Merge option

Eugene Zakhareyev

Dmitry,

As to your first point, I should say I do not know what is the difference in merge vs. replace. I performed the test as described in the docs, and the version of the labeled item was replaced though merge flag was set. It appears the feature does not work as advertised; I would assume that it is a bug.

As for marking certain file, I think you objective may be achieved using several labels instead of modifying the same label. Personally, I am dead against modifying labels at all as I think it defeats the purpose of labeling - you do not know whether specific label was modified, when and by whom. If the label had the history it would have been different, but as it is it seems better not to modify it ever and then you can assume that all labels are alike (snapshot at some point, effectively frozen).

Cheers, Eugene






Re: Team Foundation Server - Version Control Label command with /child:Merge option

Chandru R - MSFT

Dmitry,

To clarify - The /child option refers to how to resolve conflicts found by labels with the same name at or underneath the scope.

e.g You can have a label TestLabel@$/proj/folder ($/proj/folder is the scope) containing:

$/proj/folder/foo.cs (changeset 100)

You can then create a label TestLabel@$/proj ($/proj is the scope).

When creating TestLabel@$/proj

1. Merge - this means that copy over any items which are not already being labeled. If the item exists in a child label and is being labelled in the current operation, the current operation gets precedence.

2. Replace - this instructs the server to ignore any items in the child labels. i.e. All items in the child label will be deleted

Hope that helps

Chandru






Re: Team Foundation Server - Version Control Label command with /child:Merge option

Eugene Zakhareyev

Chandru,

That sure explains a lot. But what do you say about documentation I'd read it again after your clarification, and it seems to me that it says altogether different thing (it does not mention scope even).

Cheers, Eugene






Re: Team Foundation Server - Version Control Label command with /child:Merge option

Dmitry Misyura

Chandru, thank you for your answer.
So this means there is no possibility to set same label for different changesets of the same file "by design"




Re: Team Foundation Server - Version Control Label command with /child:Merge option

Eugene Zakhareyev

The fact that you cannot have the same file in the label twice is a given Smile I thought you are interested in maintaining the label on the same file through merge (namely, execute label command on same folder for the second and if the file is already labeled do not update the labeled revision).

Cheers, Eugene






Re: Team Foundation Server - Version Control Label command with /child:Merge option

Chandru R - MSFT

Dmitriy - A label is a set of items at points in time. Having the same item at 2 different changesets wouldn't be very useful as you wouldn't be able to perform a get it or build it (only 1 version can exist on your disk locally).

Thanks!






Re: Team Foundation Server - Version Control Label command with /child:Merge option

Chandru R - MSFT

Thanks Eugene - I will forward this information to our doc folks.