Enabling Keyword Expansion

I can't find how to enable keyword expansion in source files (for example, expand the $History:$ keyword to include the check-in comments). Am I missing something?
[164 byte] By [DwayneA.Davis] at [2007-12-16]
# 1
Keyword expansion was planned, but unfortunately ended up being cut for v1. I know people want it, and there's some fun challenges around doing it right in a system that allows renames, shelvesets, and so on (I was the test owner). We just didn't have enough time left to do it 'properly', and we'd seen some really rough spots emerge trying to do a lighter version of it.

Sorry!
Chris

CRathjen-MSFT at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 2

Not having keyword expansion in a version control system is kind of like selling a car without tires: it's a pretty critical feature, especially for teams not willing to trust that the particular instance of Team Foundation Server being used to store a project's change history will be universally and eternally available.

Allenvm3 at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 3

I agree it's critical to some teams - but only those who really can't trust the system itself to provide the history. In any sort of controlled migration, you can extract such history (either directly - as part of the migration process, if it's a supported migration scenario for the target version control system; or indirectly, e.g. by extracting the history for each file and embedding it into the file before checking into the target system).

As I said before, it was a painful cut. I'm sure it'll be considered for a future release, though since I'm not actively involved with Version Control these days, I couldn't say when to expect it.

CRathjen-MSFT at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 4
I have to disagree with this statement, because this statement only seems to be considering the history keyword. There are other keywords that have some value, such as the version keyword.

For unix development, it is not uncommon to embed a version string as a constant into a source file. Then you can use strings | grep "$Version" to find the version strings. This allows you to find out what versions of the source files were used on an application or shared library (i.e. dll).

While it's true you could have some manual process to extract the data and place it back in the file, this data would always be off by one version. Not to mention the fact that if you forget to perform this process it would have out of date information, which is probably worse than no information at all.

The example in the previous post for extracting history and embedding it as part of a migration process is pretty bad, in my opinion. That's like saying an SQL server doesn't really need to support joins. For example, in order to perform a join, I could select data from one table, iterate over it and select data from another table to fill a temporary table with my output. It would work, but it's highly inefficient and prone to errors.

I'm not trying to be argumentative, I'm just hoping Microsoft will put this feature back into a future version.

DwayneA.Davis at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 5

FWIW, here's how we solve the version problem:

  • version info is stored in a file, say "version.h", that's part of the division-wide common includes stored in <branchroot>\commonstuff\*
  • version.h is updated by the official daily build process for each branch
  • every product has a set of includes common to that product. so for example in <branchroot>\tfs\common\common.h, we #include "..\..\commonstuff\version.h"
  • every file in that product #includes "..\common\common.h" directly or indirectly
RichardBergMSFT at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 6

I was speaking to the history keyword because that's what the other poster expressed interest in - and specifically in the context of moving to a different source control system. Remember, as long as your data is in TFS, full history, version information, etc., is part of the meta-data available through the history and changeset commands.

A version keyword would need different handling, and if that handling wasn't automatic, it would lose much of the value since no-one would remember to keep updating the version field by hand.

I didn't mean to imply that such a process for migrating history was "sufficient" - it was just a possible workaround. I'm sure there are better approaches. In fact, I believe TFS has extensibility points such that a "real" solution could be developed (e.g. using custom check-in policies). I'm not trying to say that TFS "doesn't really need to support keyword expansion" - I'm trying to offer some alternatives for those who need some of that functionality.

I still think that keyword expansion is just a tad less critical to source control than joins are to SQL - I think a lot more teams would consider atomic changesets or multiple checkout support to be 'critical'. But of course, every team's needs are different.

CRathjen-MSFT at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 7
I also agree that atomic changesets and multiple checkout support is more critical than keyword expansion. In fact, I don't consider keyword expansion critical at all, but it is a dissatisfier. When I'm trying to sell people on using TFS, they are always surprised that keyword expansion is not supported when it is supported in every other source control product they have ever seen.

As for SQL Joins, they are clearly far more critical than keyword expansion. I merely used them as an example, albeit a poorly conceived one, to show that workarounds are not always the answer.

I do like Richard Berg's workaround for the version keyword for C++. Not as simple as keyword expansion, but the end result of having a build number embedded is probably superior to the keyword version. Something similar could be done with constants and custom attributes.

DwayneA.Davis at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 8

I agree - "workaround" always carries a "POOR substitute" connotation for me.

You can be sure we'll be pointing to threads like this one, when we're considering which features should be added and/or which missing features should be filled in, for future releases.

Thanks for the feedback!

Chris

CRathjen-MSFT at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...

Visual Studio Team System

Site Classified