On 2010-09-06 20:24:01 +0200, OBS build-service wrote:
From: Adrian Schröter <adrian@suse.de>
--- src/api/app/controllers/request_controller.rb | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/api/app/controllers/request_controller.rb b/src/api/app/controllers/request_controller.rb index 64f1e7a..49d9f07 100644 --- a/src/api/app/controllers/request_controller.rb +++ b/src/api/app/controllers/request_controller.rb @@ -390,16 +391,20 @@ class RequestController < ApplicationController
<SNIP>
- # for requests accepted with OBS 2.0 and before, this can not work in all cases - path = "/source/%s/%s?oproject=%s&opackage=%s&cmd=diff&expand=1" % - [CGI.escape(action.source.project), CGI.escape(action.source.package), CGI.escape(action.target.project), CGI.escape(action.target.package)] - if action.source.data['rev'] - path += "&rev=#{action.source.rev}" + # for requests not yet accepted or accepted with OBS 2.0 and before + if DbPackage.find_by_project_and_name( action.target.project, action.target.package ) + path = "/source/%s/%s?oproject=%s&opackage=%s&cmd=diff&expand=1" % + [CGI.escape(action.source.project), CGI.escape(action.source.package), CGI.escape(action.target.project), CGI.escape(action.target.package)] + if action.source.data['rev'] + path += "&rev=#{action.source.rev}" + end + else + diff_text = "New package: " + action.target.project + "/" + action.target.package + "\n" + diff_text Hmm there's no need for this check. If we pass the "missingok=1" query parameter to the backend we should be able to diff against a "missing"/non-existent package.
Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org