We have a build properties file with the current global revision of the repository. This file was manually updated before someone tagged the project.
My idea is to write an ant task which updates the revision number in the properties file and set up a project builder in eclipse to execute the task. But the problem is, that you can only choose to run the task before or after a clean or on a manual or auto build.
Is there a way to execute the target before a commit, to ens开发者_StackOverflow社区ure that the revision number is always updated?
Let your versioning tool do the work, it's his part.
Here's an example for a build file header that makes use of the cvs keywords when using cvs or cvsnt.
You might have seen this before in several sources, as it is good practice.
Other versioning tools like subversion .. etc. have similar features, just check their manuals,
f.e. see Subversion, keyword substitution
<?xml version="1.0" encoding="UTF-8"?>
<!--+
| $Author:$
| $Date:$
| $Revision:$
|
| Description :
| bla bla bla
| bla bla
| bla
|
+-->
<project name="..." default="...">
<description>
description
</description>
...
the cvs meta informations get updated automatically with every commit and you can't forget.
put those keywords in the file templates in your editor and you're done
But beware, your difftool will show differences for every file, even if only the revision number has changed because of branching. f.e. i use Eclipse and their difftool is not smart enough to ignore specific parts like those keywords
(still waiting for a plugin to fix that..). But after some time you will get used to ;-)
When working in a team, there has to be an agreement about using keywords or not before conflicts occur because of that diff problem.
精彩评论