How do I figure out which changeset a label in TFS

2020-02-23 06:54发布

问题:

We're using Team Foundation Server and we are using Labels to create points in our version history where specific versions (either internal or external) were produced.

Right now we were wondering if a particular changeset was done before or after a specific label (and thus included in that version or not), but we must be looking in the wrong place. This information is usually provided in the bug-tracking system but this time this field was left open so we thought we could use TFS to figure it out.

The version history for a file doesn't include labels applied. To find labels, the place I know to look is to use the "Get Specific Version" dialog, set type to Label and use the Label selection dialog to see which labels we've made, but this dialog doesn't tell me the changeset before/after the label was applied.

Is the only way to figure out if a particular change was part of that release or not to create a new workspace, map up the directory with the files to a temporary directory on disk, use the Get Specific Version dialog to extract that release and do a file-diff?

Please tell me how stupid I am and point me in the right direction.

回答1:

Have you tried opening Source Control Explorer, File -> Source Control -> Labels -> Find Label? [EDIT: that may have been in a beta version, and I don't have TFS here atm...]

Also, are you using SideKicks? The Labels SideKick allows you to find a label and see the related changesets.



回答2:

A label in TFS does not represent a specific point in time - and a label can actually be edited after the event. See the following posts for more information:

  • Buck Hodges: Finding Changes between two labels in TFS VC
  • Brian Harry: Why TFS Label are not like VSS Labels.

For this reason, I tend to use Changesets in TFS when recording the point in time for a particular release (in fact we label our binaries and installers with the actual changeset number that they were built from just to make it easier to track). (A changeset does represent a unique point in time for the state of the repository).

Hope this helps,

Martin.



回答3:

Run in your local workspace

tf history . /stopafter:1 /noprompt /r /version:Lmylabel

to get

Changeset User          Date       Comment
--------- ------------- ---------- --------------------------------------------
88888     brian_low     11/11/2012 did some work


回答4:

Faced this issue for the first time today. From now on I am including the changeset-number in the label-comment. Not very elegant workaround, but meets my needs.