I am attempting to get TortoiseSVN to automatically update a single, specific file in a repository so that it always has the correct $Revision$ when building. I don't greatly care if the $Revision$ is set before commit or after update; either will result in built executables having the correct revision number embedded. The $Revision$ is stored in a version file, which has the $Revision$ keyword property set. I haven't found a good method for doing this. What I have tried so far:
Use a pre-commit hook to call subwcrev on the version file (creating it from a template each time). This works (sort of), and is reliable because it happens on our end (rather than relying on the customer setting up hook scripts correctly which they may fail to do), but it assigns the previous revision number to the file (since the next revision number will be assigned as part of the commit). It also requires the version file to already have been selected for commit, otherwise it will be changed but not committed during this round.
Use a post-update hook to modify the version file, again using subwcrev. This also works, but now I'm relying on the customer setting up the hook, meaning I can still only have limited trust in reported revision numbers.
I have also considered server-side hooks, but according to the documentation they shouldn't be used to modify files after commit, making that a non-starter.
Obviously there's always the option of "the developer should just remember to update the version file each and every time he or she commits, and rely on the keyword properties to update automatically", but we find it is easy to forget this, and it is precisely this step I'm trying to automate.
It seems like a rather common thing that we are trying to do. Is there a better solution than the ones listed above?
The solution we are looking for would be:
- Automated, not relying on individuals taking manual steps on every SVN operation.
- Reliable, in the sense that the correct revision number is always there when a built is triggered (in particular, at the customer site. If it matters, their repository access is read only).
We primarily access SVN using TortoiseSVN, but are willing to consider another SVN client if it has a mechanism for dealing with this.
question from:
https://stackoverflow.com/questions/65936133/tortoisesvn-update-revision-in-file-after-update-or-before-commit 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…