Yes, Perforce can do this. The easiest way involves creation of a text file that allows RCS keywords (file type 'text+k') and contains the '$Change$' RCS keyword
. In addition, there must be a way of ensuring that the file is always submitted, and doing so requires a trigger script or daemon of some kind.
One method is to use a 'change-commit' trigger that updates the relevant text file every time code is submitted to a particular branch. Examples of change-commit triggers can be found here.
It is important to note that either the trigger script or the trigger definitions must exclude the version file itself from causing the trigger to fire. For example the following trigger table stops 'mytrigger.sh' being fired when 'version.txt' is submitted:
version change-commit //depot/... "/path/mytrigger.sh"
version change-commit -//depot/.../version.txt "/path/mytrigger.sh"
Another method is to use a review daemon that gets notified of every change and submits the file when certain conditions are met (such as the path of a submitted file). Configuring the Review Daemon (p4review.py).