summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-23 08:13:21 (EST)
committer Winston Prakash2011-12-01 20:47:09 (EST)
commit00fe49d4ab0087511a4281d64aebf12835594da5 (patch)
tree3b3eeea8caf94d78654191dbf4f3e322f4ed67f2
parent3122f68d48cc8eea5aa4dbd6eb2a4a4714d1fd55 (diff)
downloadorg.eclipse.hudson.core-00fe49d4ab0087511a4281d64aebf12835594da5.zip
org.eclipse.hudson.core-00fe49d4ab0087511a4281d64aebf12835594da5.tar.gz
org.eclipse.hudson.core-00fe49d4ab0087511a4281d64aebf12835594da5.tar.bz2
Improved SCM cascading.
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/AbstractProject.java8
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java2
-rw-r--r--hudson-core/src/main/resources/lib/form/radioBlock.jelly48
-rw-r--r--hudson-core/src/main/resources/lib/form/section.jelly59
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-scm.jelly35
-rw-r--r--hudson-war/src/main/webapp/css/style.css6
6 files changed, 96 insertions, 62 deletions
diff --git a/hudson-core/src/main/java/hudson/model/AbstractProject.java b/hudson-core/src/main/java/hudson/model/AbstractProject.java
index cf14b63..947c7a8 100644
--- a/hudson-core/src/main/java/hudson/model/AbstractProject.java
+++ b/hudson-core/src/main/java/hudson/model/AbstractProject.java
@@ -343,6 +343,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
convertQuietPeriodProperty();
convertScmCheckoutRetryCountProperty();
convertJDKProperty();
+ convertScmProperty();
}
void convertBlockBuildWhenUpstreamBuildingProperty() throws IOException {
@@ -394,6 +395,13 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
}
+ void convertScmProperty() throws IOException {
+ if (null == getProperty(SCM_PROPERTY_NAME)) {
+ setScm(scm);
+ scm = null;
+ }
+ }
+
@Override
protected void performDelete() throws IOException, InterruptedException {
// prevent a new build while a delete operation is in progress
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
index 380d2bf..8d57a20 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
@@ -182,4 +182,4 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
public T getOriginalValue() {
return originalValue;
}
-}
+} \ No newline at end of file
diff --git a/hudson-core/src/main/resources/lib/form/radioBlock.jelly b/hudson-core/src/main/resources/lib/form/radioBlock.jelly
index a9e0e3e..bf3f291 100644
--- a/hudson-core/src/main/resources/lib/form/radioBlock.jelly
+++ b/hudson-core/src/main/resources/lib/form/radioBlock.jelly
@@ -1,6 +1,6 @@
<!-- **************************************************************************
#
-# Copyright (c) 2004-2009 Oracle Corporation.
+# Copyright (c) 2004-2011 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
@@ -9,7 +9,7 @@
#
# Contributors:
#
-# Kohsuke Kawaguchi
+# Kohsuke Kawaguchi, Anton Kozak
#
#
#************************************************************************** -->
@@ -39,25 +39,33 @@
If specified, the (?) help icon will be rendered on the right,
for in place help text. See &lt;f:entry> for the details.
</st:attribute>
+ <st:attribute name="isPropertyOverridden">
+ if present and true - value is overridden
+ </st:attribute>
</st:documentation>
- <tr class="radio-block-start" hasHelp="${attrs.help!=null}"><!-- this ID marks the beginning -->
- <td colspan="3">
- <input type="radio" name="${name}" value="${value}"
- class="radio-block-control" checked="${checked?'true':null}" />
- <st:nbsp/>
- <label class="attach-previous">${title}</label>
- </td>
+ <j:if test="${attrs.isPropertyOverridden==null}">
+ <j:set target="${attrs}" property="isPropertyOverridden" value="false"/>
+ </j:if>
+ <tr class="radio-block-start" hasHelp="${attrs.help!=null}"><!-- this ID marks the beginning -->
+ <td colspan="3" class="${attrs.isPropertyOverridden? 'modified': 'original'}">
+ <input type="radio" name="${name}" value="${value}"
+ class="radio-block-control" checked="${checked?'true':null}"/>
+ <st:nbsp/>
+ <label class="attach-previous">${title}</label>
+ </td>
+ <j:if test="${attrs.help!=null}">
+ <td>
+ <a href="#" class="help-button" helpURL="${rootURL}${help}">
+ <img src="${imagesURL}/16x16/help.gif" alt="Help for feature: ${title}"/>
+ </a>
+ </td>
+ </j:if>
+ </tr>
<j:if test="${attrs.help!=null}">
- <td>
- <a href="#" class="help-button" helpURL="${rootURL}${help}"><img src="${imagesURL}/16x16/help.png" alt="Help for feature: ${title}" /></a>
- </td>
+ <f:helpArea/>
</j:if>
- </tr>
- <j:if test="${attrs.help!=null}">
- <f:helpArea />
- </j:if>
- <d:invokeBody />
- <!-- end marker -->
- <tr class="radio-block-end" style="display:none" />
-</j:jelly>
+ <d:invokeBody/>
+ <!-- end marker -->
+ <tr class="radio-block-end" style="display:none"/>
+</j:jelly> \ No newline at end of file
diff --git a/hudson-core/src/main/resources/lib/form/section.jelly b/hudson-core/src/main/resources/lib/form/section.jelly
index c9dcab8..b879a14 100644
--- a/hudson-core/src/main/resources/lib/form/section.jelly
+++ b/hudson-core/src/main/resources/lib/form/section.jelly
@@ -1,6 +1,6 @@
<!-- **************************************************************************
#
-# Copyright (c) 2004-2009 Oracle Corporation.
+# Copyright (c) 2004-2011 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
@@ -9,33 +9,42 @@
#
# Contributors:
#
-# Kohsuke Kawaguchi
+# Kohsuke Kawaguchi, Anton Kozak
#
#
#************************************************************************** -->
-<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">
- <st:documentation>
- Section header in the form table.
-
- <st:attribute name="title" use="required">
- The section header text.
- If null is given, the entire &lt;f:section> tag becomes no-op.
- </st:attribute>
- <st:attribute name="name">
- Optional attribute to create a JSON object from this section.
- </st:attribute>
- </st:documentation>
-
- <f:rowSet name="${attrs.name}">
- <j:if test="${attrs.title!=null}">
- <f:block>
- <div style="font-weight:bold; border-bottom: 1px solid black; margin-bottom:0.2em; margin-top:0.4em">
- ${title}
- </div>
- </f:block>
- </j:if>
- <d:invokeBody />
- </f:rowSet>
+<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">
+ <st:documentation>
+ Section header in the form table.
+ <st:attribute name="title" use="required">
+ The section header text.
+ If null is given, the entire &lt;f:section> tag becomes no-op.
+ </st:attribute>
+ <st:attribute name="name">
+ Optional attribute to create a JSON object from this section.
+ </st:attribute>
+ <st:attribute name="resetUrl">
+ If present, Redo icon will rendered and Reset will be available.
+ </st:attribute>
+ </st:documentation>
+ <f:rowSet name="${attrs.name}">
+ <j:if test="${attrs.title!=null}">
+ <f:block>
+ <div style="font-weight:bold; border-bottom: 1px solid black; margin-bottom:0.2em; margin-top:0.4em">
+ ${title}
+ </div>
+ <j:if test="${!empty(attrs.resetUrl)}">
+ <div class="section-reset">
+ <a href="#" class="reset-button" resetURL="${resetUrl}">
+ <img src="${imagesURL}/16x16/undo.png" alt="Reset ${attrs.title}"/>
+ </a>
+ </div>
+ </j:if>
+ </f:block>
+ </j:if>
+ <d:invokeBody/>
+ </f:rowSet>
</j:jelly>
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-scm.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-scm.jelly
index 1598107..55ab426 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-scm.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-scm.jelly
@@ -1,6 +1,6 @@
<!-- **************************************************************************
#
-# Copyright (c) 2004-2009 Oracle Corporation.
+# Copyright (c) 2004-2011 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
@@ -9,24 +9,27 @@
#
# Contributors:
#
-# Kohsuke Kawaguchi
+# Kohsuke Kawaguchi, Anton Kozak
#
#
#************************************************************************** -->
<!-- SCM config pane -->
-<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">
- <f:section title="${%Source Code Management}">
- <j:set var="scms" value="${h.getSCMDescriptors(it)}" />
- <j:forEach var="idx" begin="0" end="${size(scms)-1}">
- <j:set var="descriptor" value="${scms[idx]}" />
- <j:set var="scmd" value="${descriptor}" /><!-- backward compatibility with <1.238 -->
- <f:radioBlock name="scm" value="${idx}" title="${scmd.displayName}" checked="${it.scm.descriptor==scmd}">
- <j:set var="instance" value="${it.scm.descriptor==descriptor ? it.scm : null}"/>
- <j:set var="scm" value="${instance}" /><!-- backward compatibility with <1.238 -->
- <st:include from="${scmd}" page="${scmd.configPage}"/>
- </f:radioBlock>
- </j:forEach>
- </f:section>
-</j:jelly>
+<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">
+ <j:set var="scmProperty" value="${it.getScmProjectProperty(it.SCM_PROPERTY_NAME)}"/>
+ <j:set var="scm" value="${scmProperty.getValue()}"/>
+
+ <f:section title="${%Source Code Management}" resetUrl="${scmProperty.isOverridden()?jobUrl+'/resetProjectProperty?propertyName='+it.SCM_PROPERTY_NAME :''}">
+ <j:set var="scms" value="${h.getSCMDescriptors(it)}"/>
+ <j:forEach var="idx" begin="0" end="${size(scms)-1}">
+ <j:set var="descriptor" value="${scms[idx]}"/>
+ <f:radioBlock name="scm" value="${idx}" title="${descriptor.displayName}" checked="${it.scm.descriptor==descriptor}"
+ isPropertyOverridden="${scmProperty.isOverridden()}">
+ <j:set var="instance" value="${it.scm.descriptor==descriptor ? it.scm : null}"/>
+ <st:include from="${descriptor}" page="${descriptor.configPage}"/>
+ </f:radioBlock>
+ </j:forEach>
+ </f:section>
+</j:jelly> \ No newline at end of file
diff --git a/hudson-war/src/main/webapp/css/style.css b/hudson-war/src/main/webapp/css/style.css
index 0203a9d..141daa4 100644
--- a/hudson-war/src/main/webapp/css/style.css
+++ b/hudson-war/src/main/webapp/css/style.css
@@ -1019,6 +1019,12 @@ tr.modified > td.setting-leftspace {
margin-top: 5px;
}
+.section-reset{
+ float: right;
+ margin-right: -20px;
+ margin-top: -10px;
+}
+
/* ======================= Job Configuration table ========================== */
table.configure {
border-spacing: 0px;