Adam Singer

Veni, vidi, expertus sum- I came, I saw, I tested

Alice in changesets

In our last episode, we discussed the checkin process. Of course, checking in changes isn’t the end of the process; it’s really just a new beginning. Changesets represent discrete points in time and can be used refer to a specific state of the repository. As such, you use changesets to specify a particular version of files and folders.

From the command line, if we want to see changeset 10, we run h changeset 10. This brings up the “changeset details” dialog, which looks very similar to the checkin dialog. Since we already exhaustively looked through all the tabs and options here, suffice it to say that all the data is in the same place, only now it’s a record of what was checked in. However, we’re able to update the checkin comment and checkin notes if we’re either the person who checked in originally or a project administrator.

One of the very exciting features of the changeset dialog is the “compare” functionality. For each item, we have the option to compare with the previous version (if it existed before), with the last version we downloaded (“workspace version”), or with the latest version. You can also view an item or get its properties, as seen here.

We should also here elaborate on the fact that since changesets are defined to be atomic, they represent a snapshot in time of the entire repository. Even if a file wasn’t changed in a particular changeset, it still has a discrete version that existed when the checkin occurred. Suppose, for example, a file “Progam.cs” was modified in changesets 7 and 14. Running h get Program.cs /version:C10 will get us the most recently changed version of Program.cs before changeset 10 (in this case 7).

As we noted in our discussion of the checkin process, a changeset can be associated with a work item. Suppose, however, that you want to create an association after the initial checkin. You navigate to the particular bug, task, etc, and then go to the “Links” tab. From here, you can link to a changeset. What if you don’t know the changeset number offhand? We’ll get to that in a moment.

Let’s say you’re trying to “Get specific version…” on a file or folder from within Visual Studio. Choose “Changeset” in the “version” dropdown, and then you can enter or search for a changeset number. Also, you can apply a label to an item as of a particular changeset number.

Searching for changesets brings up the “Find Changeset” dialog. In this dialog, we can search with several different options. We can specify a particular file or directory (wildcards allowed), particular users, and then search for all matching, only those between two changesets, or only those between two dates (inclusive). For example, we could do this or we could try this. In this dialog, we can resort the results as well as get details on the individual changesets.

That’s all for now. Tune in next time, (hopefully not too far in the future) when we delve into the history command!