Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1303 from daniel-beck/JENKINS-18902
[FIXED JENKINS-18902] Exclude lower bound of range from changes
  • Loading branch information
daniel-beck committed Jul 27, 2014
2 parents 75578e9 + 25acdd8 commit 578b513
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 7 deletions.
14 changes: 14 additions & 0 deletions core/src/main/java/hudson/Functions.java
Expand Up @@ -543,6 +543,20 @@ public static <V> SortedMap<Integer,V> filter(SortedMap<Integer,V> map, String f
return map.subMap(Integer.parseInt(to),Integer.parseInt(from)-1);
}

/**
* Creates a sub map by using the given range (upper end inclusive).
*/
@Restricted(NoExternalUse.class)
public static <V> SortedMap<Integer,V> filterExcludingFrom(SortedMap<Integer,V> map, String from, String to) {
if(from==null && to==null) return map;
if(to==null)
return map.headMap(Integer.parseInt(from));
if(from==null)
return map.tailMap(Integer.parseInt(to));

return map.subMap(Integer.parseInt(to),Integer.parseInt(from));
}

private static final SimpleFormatter formatter = new SimpleFormatter();

/**
Expand Down
13 changes: 10 additions & 3 deletions core/src/main/resources/hudson/model/AbstractProject/changes.jelly
Expand Up @@ -36,10 +36,17 @@ THE SOFTWARE.

<h1>
${%Changes}
<j:if test="${from!=null}">${%from.label(from)}</j:if>
<j:if test="${to!=null}">&#160;${%to.label(to)}</j:if>
<j:choose>
<j:when test="${from!=null and to!=null}">
${%range.label(from, to)}
</j:when>
<j:otherwise>
<j:if test="${from!=null}">${%from.label(from)}</j:if>
<j:if test="${to!=null}">${%to.label(to)}</j:if>
</j:otherwise>
</j:choose>
</h1>
<j:set var="builds" value="${h.filter(it.buildsAsMap,from,to).values()}" />
<j:set var="builds" value="${h.filterExcludingFrom(it.buildsAsMap,from,to).values()}" />
<st:include it="${it.scm}" page="project-changes.jelly" />
</l:main-panel>
</l:layout>
Expand Down
Expand Up @@ -21,5 +21,6 @@
# THE SOFTWARE.

changes.title={0} Changes
from.label=from #{0}
to.label=to #{0}
from.label=since #{0}
to.label=up to #{0}
range.label=between #{0} and #{1}
Expand Up @@ -23,4 +23,5 @@
Changes=\u00c6ndringer
from.label=# fra #{0}
to.label=# til #{0}
range.label=fra #{0} til #{1}
changes.title=# {0} \u00c6ndringer
Expand Up @@ -22,5 +22,6 @@

Changes=Änderungen
changes.title=Änderungen in {0}
from.label=von #{0}
from.label=seit #{0}
to.label=bis #{0}
range.label=zwischen #{0} und #{1}
Expand Up @@ -23,4 +23,5 @@
changes.title={0} Cambios
from.label=desde #{0}
to.label=hasta #{0}
range.label=desde #{0} hasta #{1}
Changes=Cambios
Expand Up @@ -24,3 +24,4 @@ changes.title=Changements dans {0}
Changes=Modifications
from.label=de #{0}
to.label=à #{0}
range.label=de #{0} à #{1}
Expand Up @@ -23,4 +23,5 @@
changes.title={0}\u306e\u5909\u66f4
Changes=\u5909\u66f4\u5c65\u6b74
from.label=#{0} \u304b\u3089
to.label=#{0} \u307e\u3067
to.label=#{0} \u307e\u3067
range.label=#{0} \u304b\u3089 #{1} \u307e\u3067
Expand Up @@ -23,3 +23,4 @@
Changes=Izmai\u0146as
from.label=no #{0}
to.label=l\u012Bdz #{0}
range.label=no #{0} l\u012Bdz #{1}
Expand Up @@ -25,5 +25,6 @@ Changes=Mudan\u00e7as
from.label=de #{0}
# to #{0}
to.label= para #{0}
range.label=de #{0} para #{1}
# {0} Changes
changes.title={0} Mudan\u00e7as
Expand Up @@ -23,3 +23,4 @@
Changes=\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f
from.label=\u0441 #{0}
to.label=\u0434\u043E #{0}
range.label=\u0441 #{0} \u0434\u043E #{1}
Expand Up @@ -24,3 +24,4 @@ Changes=De\u011fi\u015fiklikler
changes.title={0} degi\u015fiklik
from.label=#{0}'dan
to.label=#{0}'a
range.label=#{0}'dan #{1}'a
Expand Up @@ -25,3 +25,4 @@ changes.title={0} \u8b8a\u66f4
Changes=\u8b8a\u66f4
from.label=\u5f9e #{0}
to.label=\u5230 #{0}
range.label=\u5f9e #{0} \u5230 #{1}

0 comments on commit 578b513

Please sign in to comment.