Customizing the output of Perforce RCS keyword expansion

半腔热情 提交于 2019-12-10 16:12:35

问题


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?


回答1:


What you are asking for cannot be done with triggers. The only triggers that are active during submit are change-submit, change-content and change-commit. You can only retrieve the file-content for the latter two, but with the change-content trigger, the changelist number is not yet fix, and with the change-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.



来源:https://stackoverflow.com/questions/5088142/customizing-the-output-of-perforce-rcs-keyword-expansion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!