${svnrevision} property not defined in some cases

Daniel Tihelka <[email protected]> Mon, 3 Sep 2012 14:51:08 +0200
Newsgroups gmane.comp.java.cruise-control.devel
Message-ID <[email protected]>
Hi all,
we have found an issue in CC which I don't know if it is being a bug a 
feature. So I would like to discuss it with you.

When a project is correctly built, and  the build is invoked again manually 
(through dashboard), the ${svnrevision} property is not defined in the second 
run. Of course, there is no modification since the last successful build, so 
the code skips the property setting.

However,  we need that property being defined, since we use it during the build 
process.

So, the question is - is it correct that the property is not defined in case 
that there are no modification sound since the last build? Or should it rather 
hold the last revision? What do you think about it?

I attach trivial patch which defines the property even when no modifications are 
found. I did not write any unit test, but I can write one if you are happy 
with it. At least, the patch does not break any of existing tests for now.

Thank you for your response.
Regards,
Dan T.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
Cruisecontrol-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cruisecontrol-devel
svnrevision.patch (text/x-patch, 630 B)
Index: src/net/sourceforge/cruisecontrol/sourcecontrols/SVN.java
===================================================================
--- src/net/sourceforge/cruisecontrol/sourcecontrols/SVN.java	(revision 4606)
+++ src/net/sourceforge/cruisecontrol/sourcecontrols/SVN.java	(working copy)
@@ -505,6 +505,10 @@
             }
             properties.put("svnrevision", "" + maxRevision);
         }
+        else {
+            final String endRevision = execInfoCommand(buildInfoCommand(null));
+            properties.put("svnrevision", "" + endRevision);
+        }
     }
 
     public static DateFormat getOutDateFormatter() {
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)

iEYEABECAAYFAlBEp8UACgkQuYlVhxo/P1GapQCcC1PuB6lV600xxoMX23nRdE4q
Et8Anj4tmv0sXXgKY+7/gLbPH9Oq/6mL
=sHTf
-----END PGP SIGNATURE-----