I'd like to filter files using RCS keyword expansion so that instances of $Change$
are translated to 1745
rather than the default behaviour of $Change: 1745 $
. I realize that this would prevent future expansions, but that's acceptable for the purposes.
Other methods of inserting the changelist number into a file are also welcome. This is the only method I've seen with Perforce that works during submission -- it's just that I'd like to clean it up so that it can be cleanly inserted into version numbers. Could this also be accomplished with triggers?
What you are asking for cannot be done with triggers. The only triggers that are active during submit are
change-submit
,change-content
andchange-commit
. You can only retrieve the file-content for the latter two, but with thechange-content
trigger, the changelist number is not yet fix, and with thechange-commit
trigger, the file-content is already committed and can't be changed. What's worse, though, is that you wouldn't have a way to submit a changed file-content back to the server from within your trigger.The RCS keyword expansion works because it is done by the server itself and because Perforce does a refresh-after-submit, i.e. the client refreshes all files of a submitted change from the Perforce server, thereby getting the content with expanded RCS keywords.