I can't figure out a nice, succinct title for this question, so bear with me!
My overall goal is to have a variable in my source code which give the date, time, (and possibly commit id) of a class so that when exceptions get caught, I could output the error along with that said variable so I can easily track the source code version giving me the grief.
I'd like to accomplish one of two things. When I edit a java file such that mercurial or git picks up a change, I'd like for the class which got modified to get a new field:
public static final String commitTime = "yyyymmdd - hhmmss - <commitid>";
Or if inner class is too much, something appended to the bottom of the file such as:
public lass failname_stamp {
public static final String commitTime = "yyyymmdd - hhmmss - <commitid>";
}
Or something to that effect.
This doesn't have to be specific to mercurial or git, however it would be a feature that ties in with them. So when a commit happens on a file, a process will run to add such data to the file itself.
I imagine such a tool would need to integrate with my IDE (eclipse and intelliJ) if not a 3rd party plugin for my mercurial or git instance.
I know I have seen source code files with comment fields at the top such as:
/**
* @since 1.2
*/
But I'd like something more thorough and specific and not relying on a human to manually update comments.