SubWCRev when building TSVN source outside a Subversion WC

14 views
Skip to first unread message

Julian Foad

unread,
Oct 26, 2017, 12:17:37 PM10/26/17
to TortoiseSVN-dev
We copied TSVN source code into a git repo and then tried to build. It failed on the step where 'versioninfo.build' runs SubWCRev to try to construct a version number from the Subversion revision number.

It already bypasses this step and uses the result '0' (zero) if SubWCRev tool is not available. I changed it to also bypass this step if SubWCRev tool returns an error. (See diff below.)

I think it is useful to be able to move the source code to a different VCS and still work with it. This is one of only two issues with building outside an svn WC. (The other is the use of svn externals. I might send a separate message about how we are working around that.)

Would you be interested in having this change in the main code?

[[[
    Allow the build to work in a non-svn checkout.

    When calling 'SubWCRev' to generate version numbers, if this fails because
    it's not an svn WC, fall back to just saying '0', the same as we already
    did if SubWCRev program is not found.

diff --git a/versioninfo.build b/versioninfo.build
index 8746c586f..6aeb7a942 100644
--- a/versioninfo.build
+++ b/versioninfo.build
@@ -34,14 +34,14 @@
          SubWCRev! So only use it if it exists and replace the WCREV with
          0 if it doesn't -->
     <if test="${file::exists(SubWCRevFileName)}">
-      <exec program="${SubWCRevFileName}">
+      <exec program="${SubWCRevFileName}" failonerror="false" resultproperty="exitcode">
         <arg value="." />
         <arg value="version.build.in" />
         <arg value="version.build" />
         <arg value="-f" />
       </exec>
     </if>
-    <if test="${not file::exists(SubWCRevFileName)}">
+    <if test="${not file::exists(SubWCRevFileName) or property::get-value('exitcode')!='0'}">
       <copy file="version.build.in" tofile="version.build">
         <filterchain>
           <replacetokens begintoken="$" endtoken="$">

]]]

- Julian

Stefan

unread,
Oct 26, 2017, 1:59:38 PM10/26/17
to TortoiseSVN-dev


On Thursday, October 26, 2017 at 6:17:37 PM UTC+2, Julian Foad wrote:
We copied TSVN source code into a git repo and then tried to build. It failed on the step where 'versioninfo.build' runs SubWCRev to try to construct a version number from the Subversion revision number.

It already bypasses this step and uses the result '0' (zero) if SubWCRev tool is not available. I changed it to also bypass this step if SubWCRev tool returns an error. (See diff below.)

I think it is useful to be able to move the source code to a different VCS and still work with it. This is one of only two issues with building outside an svn WC. (The other is the use of svn externals. I might send a separate message about how we are working around that.)

Would you be interested in having this change in the main code?

Change looks good, but you should also disable the 'msi' target if SubWCRev fails for some reason.
Because if there is no svn revision to use and zero is assumed instead, the msi installer will fail to update an already installed TSVN properly. So it's then best to just not build the msi at all.

Stefan

Reply all
Reply to author
Forward
0 new messages