Reputation: 6657
Is there a way to have a file that is modified / touched whenever the WC is updated to a new revision? Or, as the second-best option, whenever svn update
is executed?
Here's the motivation: I want to have the SVN revision number inside my executable. So I have to run SubWCRev as part of the build. The output file of SubWCRev is re-created every time, even if the revision number has not changed. This means that the exe is linked on every build, even if nothing has changed. I want it to be linked only as needed.
Upvotes: 0
Views: 556
Reputation:
You might even be able to do this with a .bat file (using fc
). Something like...
REM ***UNTESTED***
FC temp.rev curr.rev | FIND "FC: no dif" > nul
IF NOT ERRORLEVEL 1 COPY /Y temp.rev curr.rev
DEL temp.rev
Edit: As an aside, you can do this in Mercurial by making the rev-number-file depend on .hg/dirstate
.
Upvotes: 3
Reputation: 5330
This sounds like a duplicate of this discussion here: Embedding SVN Revision number at compile time in a Windows app
My approach, described in that question, works across platforms and can output to whatever format you program so it will work in any situation where including a file is a viable solution.
In your case, you want to watch for the M modifier in svnversion's output: that will let you know that your WC has been modified.
Upvotes: 1
Reputation: 604
My answer will probably be too short, but might give you some direction.
SVN has hooks. They are scripts that get executed everytime code is commited.
Maybe?
Upvotes: -1