Subversion: Add revision data to code file on commit

后端 未结 7 784
挽巷
挽巷 2020-12-05 18:21

Is there an easy way to, on commit of a file, automatically insert information into the code file itself (like author, commit comment, commit date, etc)? I would want this i

7条回答
  •  伪装坚强ぢ
    2020-12-05 19:11

    Here is an approach. Use a second version control tool, such as Visual Source Safe, which has a History keyword. Below I will say VSS but you could use any old tool that has a History keyword or Log keyword. Then follow a two step process. [1] check the source file into VSS. This allows you to write your comments and VSS will update the revision history in the source file itself. If convenient, you could do a multi-file check-in in one step and have the same comment inserted in all the files checked in. Alternatively, you can do the comments file by file. [2] check the resulting file, which is now updated with your latest revision comment inserted, into Subversion as you normally would.

    By the way, as a matter of style, I find it more convenient to keep the revision history at the bottom of the source file, not the top. Most people read from the top and won't see the revision history at the bottom, so it won't bother them. Also, source code line numbers stay the same because when the revision history is at the bottom of the file, there is no source code beyond the revision history. This is convenient in some types of debugging where you don't want the source code line numbers to change every time you do a check-in.

提交回复
热议问题