From 7208f798280a7536b11aa8a287b4186b8ff66a93 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Thu, 25 Feb 2010 15:32:56 +0000 Subject: [PATCH] inital version of links to diff in scm --- src/lib/Hydra/Controller/Build.pm | 3 +++ src/root/common.tt | 19 ++++++++++++++++++- src/sql/hydra.sql | 5 +++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index e94f1559..bf640a2c 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -18,6 +18,9 @@ sub build : Chained('/') PathPart CaptureArgs(1) { $c->stash->{prevBuild} = getPreviousBuild($c, $c->stash->{build}); $c->stash->{prevSuccessfulBuild} = getPreviousSuccessfulBuild($c, $c->stash->{build}); + $c->stash->{mappers} = [$c->model('DB::UriRevMapper')->all]; + + notFound($c, "Build with ID $id doesn't exist.") if !defined $c->stash->{build}; diff --git a/src/root/common.tt b/src/root/common.tt index 4ddf8c16..d4b299a2 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -1,4 +1,5 @@ [% USE date %] +[% USE String %] [% USE HTML %] @@ -277,6 +278,22 @@ [% END %] [% END %] +[% BLOCK renderDiffUri; %] + [% nouri = 1 %] + [% FOREACH m IN mappers %] + [% base = m.baseuri %] + [% url = bi1.uri %] + [% path = url.replace(base, '') %] + [% IF url.match(base) %] + [% contents %] + [% nouri = 0 %] + [% END %] + [% END %] + [% IF nouri %] + [% contents %] + [% END %] +[% END %] + [% BLOCK renderInputDiff; %] [% IF !nestedDiff %] @@ -291,7 +308,7 @@ [% ELSIF bi1.uri == bi2.uri && bi1.revision != bi2.revision %] [% ELSIF bi1.dependency.id != bi2.dependency.id || bi1.path != bi2.path %]
[% bi1.name %][% INCLUDE renderInputValue input=bi1 %] to [% INCLUDE renderInputValue input=bi2 %]
- [% bi1.name %]Revision changed from [% bi1.revision %] to [% bi2.revision %]. + [% bi1.name %][% INCLUDE renderDiffUri contents=('Revision changed from ' _ bi1.revision _ ' to ' _ bi2.revision) %]
diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 5cef92ee..dd096ca9 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -420,6 +420,11 @@ create table JobsetInputHashes ( foreign key (project, jobset) references Jobsets(project, name) on delete cascade on update cascade ); +create table UriRevMapper ( + baseuri text not null, + uri text not null, + primary key (baseuri) +); -- Some indices. create index IndexBuildInputsOnBuild on BuildInputs(build);