Consider software spread in two separate repositories, Pub and Priv. Pub repository is public. Priv is closed. An continuous integration server builds both Pub and Priv when either side changes. It then creates downloadable binaries from Priv that are available to users of Pub. Those binaries are labeled internally and on the file name with the subversion revision.
Question is: How to have programs built from Pub aware of the correct, corresponding Priv revision number so they can auto download and run?
The current solution is for the build server to modify files in Pub to set the revision number of Priv and commit those changes to Pub. However, this presents 2 significant problems:
The build takes a long time so if someone commits changes to Pub (or Priv) during the build, it creates conflicts. That can be forced resolved but the log history looks odd as if those revisions made it into that build.
The subversion log has many entries like "Auto build updated the version." from every time the build run which polutes the otherwise informative subversion log.
So can we do this in a way which doesn't require changing the repository.
Sincerely, Wayne
You can use a revision property (see the section entitled "Unversioned properties) to store the appropriate revision of Priv against the appropriate revision of Pub. The nice thing about revision properties is that they don't need a commit - so no history pollution.
Revision properties, in Subversion parlance, are attached to a particular revision rather than a versioned folder. These properties, unlike the properties that get attached to files or folders, are non-versioned. They just get applied straight away. Revision properties are added by using the --revprop switch to "svn propset". In TortoiseSVN they are added via the history log (right click a revision then select "Show Revision Properties") rather than the properties of a file or folder and are applied immediately without making a commit.
For example, to associate r1234 of Priv with r6789 of Pub you could do this from a checkout of Pub.
svn propset --revprop -r6789 "priv:version" "1234"
Now when r6789 of Pub is built you can do this
svn propget --revprop -r6789 "priv:version"
to retrieve the appropriate revision number of Priv. In order to cope with other commits that happen after the last Priv build your script would have to "walk" down the history asking each revision for "priv:version" until you get a value. Or you could have a post-commit hook that copies the property to each revision as it occurs.
One gotcha though. You need to have a pre-revprop-change hook that will allow you to work with revision properties. The simplest way is to have it always return 0 so any revprop is allowed. On Windows I do this simply creating an empty "pre-revprop-change.bat" file in the hooks directory. If you take a look at the example hook script that's provided when you create a property, it's actually pretty well documented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With