From 7bfd874064bf065256ec5ec13a5c9b246b9e432b Mon Sep 17 00:00:00 2001 From: Espen Wiborg Date: Fri, 16 Sep 2011 15:38:38 +0200 Subject: [PATCH 1/2] Allow permalink-based selection of build range --- .../all_changes/AllChangesAction/index.groovy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/resources/org/jenkinsci/plugins/all_changes/AllChangesAction/index.groovy b/src/main/resources/org/jenkinsci/plugins/all_changes/AllChangesAction/index.groovy index fb7e891..bdad3a2 100644 --- a/src/main/resources/org/jenkinsci/plugins/all_changes/AllChangesAction/index.groovy +++ b/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 builds) { boolean hadChanges = false; for (AbstractBuild build in builds) { From 486fa635c97c9e39ad0c769e48cf9d266755164e Mon Sep 17 00:00:00 2001 From: Espen Wiborg Date: Fri, 16 Sep 2011 15:58:05 +0200 Subject: [PATCH 2/2] I broke the case where one or more of to and from where unspecified --- .../jenkinsci/plugins/all_changes/AllChangesAction/index.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/org/jenkinsci/plugins/all_changes/AllChangesAction/index.groovy b/src/main/resources/org/jenkinsci/plugins/all_changes/AllChangesAction/index.groovy index bdad3a2..60d7d68 100644 --- a/src/main/resources/org/jenkinsci/plugins/all_changes/AllChangesAction/index.groovy +++ b/src/main/resources/org/jenkinsci/plugins/all_changes/AllChangesAction/index.groovy @@ -59,7 +59,7 @@ private buildNumber(String build) { } else { def permaLink = my.project.getPermalinks().get(build) def run = permaLink?.resolve(my.project) - return run?.number.toString() + return run?.number?.toString() } }