### Eclipse Workspace Patch 1.0
#P m2release-hudson
Index: plugin/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly
===================================================================
--- plugin/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly	(revision 27857)
+++ plugin/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly	(working copy)
@@ -2,18 +2,25 @@
 	Displays the form to choose the tag name.
 
 	This belongs to a build view.
+
+
 -->
 <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
 	<l:layout>
 		<l:main-panel>
 			<f:form method="post" action="submit">
 				<f:section title="Perform Maven Release">
-					<f:optionalBlock name="specifyVersions" title="Specify release version(s)" checked="false">
+					<f:optionalBlock name="specifyVersions" title="Specify release version(s)" checked="false">			   				
 							<j:forEach var="m" items="${it.modules}">
-								<f:section title="${m.moduleName}">
+								<f:section title="${m.moduleName}">						
 									<f:entry title="Release Version">
 										<f:textbox name="-Dproject.rel.${m.moduleName}" value="${it.computeReleaseVersion(m.version)}" />
 									</f:entry>
+									<j:if test="${it.afficheVCSVersion}">
+										<f:entry title="VCS Version pour le projet">
+											<f:textbox name="VCSVersion" value="${it.computeReleaseVCSVersion(m.version)}" />
+										</f:entry>	
+									</j:if>									
 									<f:entry title="Development version">
 										<f:textbox name="-Dproject.dev.${m.moduleName}" value="${it.computeNextVersion(m.version)}" />
 									</f:entry>
@@ -42,8 +49,9 @@
 					</td></tr>
 				</f:section>
 			</f:form>
-
-
 		</l:main-panel>
 	</l:layout>
+	<j:if test="${it.razVCSVersion}">
+											
+	</j:if>		
 </j:jelly>
\ No newline at end of file
Index: plugin/src/main/resources/index.jelly
===================================================================
--- plugin/src/main/resources/index.jelly	(revision 27857)
+++ plugin/src/main/resources/index.jelly	(working copy)
@@ -4,5 +4,5 @@
   Since we don't really have anything dynamic here, let's just use static HTML. 
 -->
 <div>
-  A plug-in that enables you to perform releases using the <a href="http://maven.apache.org/plugins/maven-release-plugin/">maven-release-plugin</a> from Hudson.
+  A plug-in that enables you to perform releases using <a href="http://maven.apache.org/plugins/maven-release-plugin/">maven-release-plugin</a> from Hudson.
 </div>
\ No newline at end of file
Index: plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java
===================================================================
--- plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java	(revision 27857)
+++ plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java	(working copy)
@@ -79,6 +79,7 @@
 	private transient Map<String, String> versions;
 	private transient boolean             appendHudsonBuildNumber;
 	private transient String              repoDescription;
+	private transient String			  VCSVersion;
 	
 	public String                         releaseGoals        = DescriptorImpl.DEFAULT_RELEASE_GOALS;
 	
@@ -98,6 +99,7 @@
 		MavenModuleSet mmSet;
 		final String mavenOpts;
 		
+		
 		synchronized (getModuleSet(build)) {
 			if (!doRelease) {
 				// we are not performing a release so don't need a custom tearDown.
@@ -119,6 +121,9 @@
 				else {
 					mmSet.setGoals(releaseGoals);
 				}
+				if(versions.get("VCSVersion") != null) {		
+					mmSet.setGoals(generateVersionString(build.getNumber()) + releaseGoals+" -Dtag="+versions.get("VCSVersion"));
+				}
 			}
 			else {
 				// can this be so?
@@ -161,6 +166,7 @@
 						                                     getDescriptor().getNexusUser(),
 						                                     getDescriptor().getNexusPassword());
 						MavenModule rootModule = mmSet.getRootModule();
+						
 						// TODO add support for a user supplied comment.
 						StageRepository repo = client.getOpenStageRepositoryForUser(rootModule.getModuleName().groupId,
 						                                                            rootModule.getModuleName().artifactId,
@@ -199,6 +205,10 @@
 		// expects a map of key="-Dproject.rel.${m.moduleName}" value="version"
 		this.versions = versions;
 	}
+	
+	void setVersionsVCSVersion(String VCSVersion) {
+		this.VCSVersion = VCSVersion;
+	}
 
 
 	public void setAppendHudsonBuildNumber(boolean appendHudsonBuildNumber) {
@@ -218,15 +228,18 @@
 		// -Dproject.rel.org.mycompany.group.project=version ....
 		StringBuilder sb = new StringBuilder();
 		for (String key : versions.keySet()) {
-			sb.append(key);
-			sb.append('=');
-			sb.append(versions.get(key));
-			if (appendHudsonBuildNumber && key.startsWith("-Dproject.rel")) { //$NON-NLS-1$
-				sb.append('-');
-				sb.append(buildNumber);
+			if(!key.startsWith("VCSVersion")) {
+				sb.append(key);
+				sb.append('=');
+				sb.append(versions.get(key));
+				if (appendHudsonBuildNumber && key.startsWith("-Dproject.rel")) { //$NON-NLS-1$
+					sb.append('!');
+					sb.append(buildNumber);
+				}
+				sb.append(' ');
 			}
-			sb.append(' ');
 		}
+		
 		return sb.toString();
 	}
 
Index: plugin/src/main/java/org/jvnet/hudson/plugins/m2release/ReleaseCause.java
===================================================================
--- plugin/src/main/java/org/jvnet/hudson/plugins/m2release/ReleaseCause.java	(revision 27857)
+++ plugin/src/main/java/org/jvnet/hudson/plugins/m2release/ReleaseCause.java	(working copy)
@@ -23,6 +23,8 @@
  */
 package org.jvnet.hudson.plugins.m2release;
 
+import org.acegisecurity.vote.AuthenticatedVoter;
+
 import hudson.model.Hudson;
 import hudson.model.Cause.UserCause;
 
Index: plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java
===================================================================
--- plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java	(revision 27857)
+++ plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java	(working copy)
@@ -23,6 +23,7 @@
  */
 package org.jvnet.hudson.plugins.m2release;
 
+
 import hudson.maven.MavenModule;
 import hudson.maven.MavenModuleSet;
 import hudson.model.Action;
@@ -41,7 +42,7 @@
 import org.kohsuke.stapler.StaplerResponse;
 
 /**
- * The action appears as the link in the side bar that users will click on in order to start the release
+ * The action appears as thelink in the side bar that users will click on in order to start the release
  * process.
  * 
  * @author James Nord
@@ -50,6 +51,7 @@
 public class M2ReleaseAction implements Action {
 
 	private MavenModuleSet project;
+	public boolean i = true;
 
 
 	public M2ReleaseAction(MavenModuleSet project) {
@@ -75,7 +77,7 @@
 		return "m2release"; //$NON-NLS-1$
 	}
 
-	public Collection<MavenModule> getModules() {
+	public Collection<MavenModule> getModules(){
 		return project.getModules();
 	}
 	
@@ -83,6 +85,24 @@
 		return version.replace("-SNAPSHOT", ""); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
+
+	
+	public String computeReleaseVCSVersion(String version) {
+		i = false;
+
+		String temp = "v"+version.replace(".","_");		
+		return temp.replace("-SNAPSHOT", "");
+	}
+	
+	public boolean isRazVCSVersion() {
+		this.i = true;
+		return i;
+	}
+	
+	public boolean isAfficheVCSVersion(){
+		return i;
+	}
+	
 	public String computeRepoDescription() {
 		return "Release " + computeReleaseVersion(project.getRootModule().getVersion()) + " of " + project.getRootModule().getName();
 	}
@@ -126,7 +146,6 @@
 	public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException {
 		M2ReleaseBuildWrapper.checkReleasePermission(project);
 		M2ReleaseBuildWrapper m2Wrapper = project.getBuildWrappers().get(M2ReleaseBuildWrapper.class);
-
 		// JSON collapses everything in the dynamic specifyVersions section so we need to fall back to
 		// good old http...
 		Map<?,?> httpParams = req.getParameterMap();
@@ -140,10 +159,13 @@
 		if (httpParams.containsKey("specifyVersions")) {
 			versions = new HashMap<String,String>();
 			for (Object key : httpParams.keySet()) {
-				String keyStr = (String)key;
+				String keyStr = (String)key;				
 				if (keyStr.startsWith("-Dproject.")) {
 					versions.put(keyStr, (String)(((Object[])httpParams.get(key))[0]));
 				}
+				if (keyStr.startsWith("VCSVersion")) {
+					versions.put(keyStr, (String)(((Object[])httpParams.get(key))[0]));
+				}
 			}
 		}
 		
@@ -160,5 +182,4 @@
 		// redirect to status page
 		resp.sendRedirect(project.getAbsoluteUrl());
 	}
-
 }