We faced this problem when compiling our projects for release builds, where a build server property (CruiseControl.NET project label) is used as part of the assembly and installer version.
The solution is easy where you are branching (or tagging) the working copy, e.g. for release builds.
Workflow:
- Checkout fresh working copy of trunk (or branch).
- Build your release, this updates files leaving your working copy in a modified state.
- If your build succeeds, svn copy the working copy into your new branch or tag.
If you want to commit your working copy without branching, then as you say this will fail (or at the least be unreliable) if someone has modified that path of the repository.
A way to solve this would be to use svn authorization control, adding a build server user to svn and have different authz
files for the repository.
Workflow:
- Replace
authz
with file granting write access for build server user and read access for all other users.
- Perform your build as per normal.
- Replace
authz
with file granting normal access for all users.
Note that svn authorization allows path-based control, so you could restrict this just to trunk (or wherever) to reduce impact on users.
Another way using a similar approach (same workflow) would be replacing pre-commit hook and checking the user; rejecting the commit (with appropriate error message) if it wasn't your build server user performing the commit. Again, this could be path based (with a little extra regex work) if needed.