views:

177

answers:

2

I am trying to mirror my corporate Starteam CM server with a local distributed version controls system (Mercurial). I am running into problems with seeing many changes due to Starteam's keyword expansion on checkout feature. For example, the server is setup to expand $History to a log of each checkins comments and other metadata. These often cause annoying conflicts when I try to merge.

I can manually "un-expand" the keywords, but the codebase is extremely large and this would take a prohibitively long.

+1  A: 

If the keywords look like CVS/RCS keywords ($Id$ and so on), then the keyword extension bundled with Mercurial might be able to help with unexpanding those. But unfortunately it only supports simple keywords, and it sounds like $History will expand incrementally like the $Log$ CVS keyword.

But maybe you can use the keyword extension as a starting point?

Martin Geisler
A: 

Another option on the mercurial side would be to use a precommit hook to automatically un-expand the keywords in your starteam checkout files.

Something like this in your ~/.hgrc might do the trick:

[hooks]
precommit.unexpand_starteam = find . -name '*.cpp' -print0 | xargs -0 perl -pie 's/$History.*?\n\n//m' ; exit 0

That would remove everything from $History through the first blank line in every file right before committing. I've not used starteam, but there must be some way to identity the end of a history block (blank line was a guess), and with the perl line altered to reflect that you should be good to go.

Ry4an