Detecting inconsistent revisions of shared sources in SVN
I have an SVN repository containing several components:
- LibraryA
- LibraryB - depends on LibraryA
- Application - depends on LibraryB and LibraryA
More detailed structure (branches and tags are not related to the problem):
- LibraryA
- LibraryA_code
- LibraryB
- LibraryB_code
- svn:externals to a fixed revision R1 of LibraryA_code
- Application
- Application_code
- svn:externals to a fixed revision R2 of LibraryA_code
- svn:externals to a fixed revision R3 of LibraryB_code
The problem I'm trying to solve is automatic detection of situation when R2 differs from R1 (breaking expectations of LibraryB_code) and notification about this (e.g. build failure).
I'll describe in an answer the only solution which I see for now, but I hope for something more elegant :)
Environment: Windows, Vi开发者_如何学Csual Studio, SVN.
When you modify the svn:externals
property of Library B and commit this change, you create a new revision of Library B. This means, the Application repository is still consistent. You
only need to worry when you modify an svn:externals
property of Application itself.
This case can be dealt with in a repository hook for the Application repository. That hook checks out the specified revision of Library B to a temporary directory and compares its required version of Library A with that of the version required by the application. See Repository Hooks for a list of available hooks.
Store for each library a file with required revision for each dependency. Add a post-build event which compares these revisions with results of "svnversion" and breaks build if any check fails.
Drawbacks:
- requires installed command-line svn client (while developer may be happy with TortoiseSVN alone
- doesn't work for exported sources, only for checked out working copies
精彩评论