Bug 410891 - SVN_REVISION not set when using @HEAD in Subversion URL
Summary: SVN_REVISION not set when using @HEAD in Subversion URL
Status: NEW
Alias: None
Product: Hudson
Classification: Technology
Component: SVN (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Winston Prakash CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-16 13:44 EDT by Jan Vervecken CLA
Modified: 2013-10-09 05:13 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Vervecken CLA 2013-06-16 13:44:17 EDT
hi

The SVN_REVISION environment variable does not seem to be set when using @HEAD in a Subversion URL.

Try to run the "echo.properties" Ant target below using Hudson.
---
<?xml version="1.0" encoding="windows-1252" ?>
<project name="SomeSVNRevisionProject" default="" basedir=".">
	<property environment="env"/>

	<target name="echo.properties">
		<echo message="env.SVN_REVISION = ${env.SVN_REVISION}"/>
	</target>
</project>
---

Using a Subersion URL without @HEAD suffix the console output is:
---
Started by user anonymous
Updating file:///D:/temp/some-repository/trunk revision: Jun 16, 2013 7:27:30 PM depth:infinity ignoreExternals: false
At revision 2
no change for file:///D:/temp/some-repository/trunk since the previous build
[temp] $ cmd.exe /C '"C:\oracle\jdevstudio111230-mw\jdeveloper\ant\bin\ant.bat -buildfile D:/temp/build.xml echo.properties && exit %%ERRORLEVEL%%"'
Buildfile: D:\temp\build.xml

echo.properties:
     [echo] env.SVN_REVISION = 2

BUILD SUCCESSFUL
Total time: 0 seconds
Finished: SUCCESS
---

Using a Subersion URL with @HEAD suffix the console output is:
---
Started by user anonymous
Updating file:///D:/temp/some-repository/trunk@HEAD revision: HEAD depth:infinity ignoreExternals: false
At revision 2
no change for file:///D:/temp/some-repository/trunk since the previous build
[temp] $ cmd.exe /C '"C:\oracle\jdevstudio111230-mw\jdeveloper\ant\bin\ant.bat -buildfile D:/temp/build.xml echo.properties && exit %%ERRORLEVEL%%"'
Buildfile: D:\temp\build.xml

echo.properties:
     [echo] env.SVN_REVISION = ${env.SVN_REVISION}

BUILD SUCCESSFUL
Total time: 0 seconds
Finished: SUCCESS
---

I would expect the SVN_REVISION environment variable to always be set, regardless the use of @HEAD in a Subversion URL.

(seems related to https://issues.jenkins-ci.org/browse/JENKINS-10942 )

many thanks
Jan Vervecken
Comment 1 Henrik Lynggaard Hansen CLA 2013-10-09 05:13:26 EDT
I see another case of SVN_REVISION not exported,

If I have a port specified in a svn URL is doesn't get a revision. I think is has something todo with the .svn files on disk doesn't have the port hence there is a mismacth

svn://scrbpwmdefrm612/MLT-DEV/... works
svn://scrbpwmdefrm612:3690/MLT-DEV/... does not export SVN_REVISION