Permalink
Browse files

Merge pull request #1 from espenhw/master

Add support for specifying permalinks in from/to parameters
  • Loading branch information...
2 parents 8eb8a2f + 486fa63 commit e2aba7ae3979cb290a209b999182d7d6b4dfbe5a @wolfs wolfs committed Sep 18, 2011
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/main/resources/org/jenkinsci/plugins/all_changes/AllChangesAction/index.groovy
@@ -40,8 +40,8 @@ st = namespace("jelly:stapler")
l.layout(title: _("all.changes.title", my.project.name)) {
st.include(page: "sidepanel.jelly", it: my.project)
l.main_panel() {
- def from = request.getParameter('from')
- def to = request.getParameter('to')
+ def from = buildNumber(request.getParameter('from'));
+ def to = buildNumber(request.getParameter('to'));
h1(_("All Changes"))
def builds = Functions.filter(my.project.buildsAsMap, from, to).values()
@@ -53,6 +53,16 @@ l.layout(title: _("all.changes.title", my.project.name)) {
}
}
+private buildNumber(String build) {
+ if (build?.isInteger()) {
+ return build
+ } else {
+ def permaLink = my.project.getPermalinks().get(build)
+ def run = permaLink?.resolve(my.project)
+ return run?.number?.toString()
+ }
+}
+
private showChanges(Collection<AbstractBuild> builds) {
boolean hadChanges = false;
for (AbstractBuild build in builds) {

0 comments on commit e2aba7a

Please sign in to comment.