cpack_repository/commit
ADDED: Update from different repository or branch
author | Jan Wielemaker |
---|---|
Thu May 26 12:08:30 2011 +0200 | |
committer | Jan Wielemaker |
Thu May 26 12:08:30 2011 +0200 | |
commit | e166b3e8b7bfd8ca1e485b56ca758968d9686a2c |
tree | 2942492cf9cd9d1eb7539ba4f3511a1ce69ba955 |
parent | 4c6500c3414385be7a0e0a718d56f90c5d47d1ec |
Diff style: patch stat
diff --git a/applications/cpack_submit.pl b/applications/cpack_submit.pl index 53df695..0c1de14 100644 --- a/applications/cpack_submit.pl +++ b/applications/cpack_submit.pl @@ -124,25 +124,43 @@ cpack_resubmit(Request) :- [ pack(Pack, [ description('URI of the CPACK to update') ]), + giturl(GitURL, + [ optional(true), + description('GIT URL to pull from') + ]), branch(Branch, - [ description('Branch to update from') + [ optional(true), + description('Branch to update from') ]), + confirm(Confirm, + [ boolean, + default(true), + description('Present confirmation screen') + ]), return_to(ReturnTo, [ optional(true), description('Return link') ]) ]), - rdf_has(Pack, cpack:clonedRepository, GitRepo), - rdf_has(GitRepo, cpack:gitURL, GitURL), - authorized(write(cpack, GitURL)), + authorized(write(cpack, Pack)), + ( var(GitURL) + -> rdf_has(Pack, cpack:clonedRepository, GitRepo), + rdf_has(GitRepo, cpack:gitURL, GitURL) + ; true + ), user_property(User, url(UserURL)), ( var(ReturnTo) -> MsgOptions = [] ; MsgOptions = [return_to(ReturnTo)] ), findall(O, submit_option(User, Pack, Branch, O), RepoOptions), - call_showing_messages(cpack_add_repository(UserURL, GitURL, RepoOptions), - MsgOptions). + ( Confirm == true + -> reply_html_page(cliopatria(cpack), + title('Pull new version'), + \pull_version_form(Pack, GitURL, RepoOptions, MsgOptions)) + ; call_showing_messages(cpack_add_repository(UserURL, GitURL, RepoOptions), + MsgOptions) + ). submit_option(_User, Pack, Branch, branch(Branch)) :- ( var(Branch) @@ -154,6 +172,50 @@ submit_option(User, _Pack, _Branch, allowed(true)) :- catch(check_permission(User, admin(cpack)), _, fail). +%% pull_version_form(+Pack, +GitURL, +RepoOptions, +MsgOptions)// is det. +% +% Present a form to confirm for pulling a new version. + +pull_version_form(Pack, GitURL, RepoOptions, MsgOptions) --> + { git_remote_branches(GitURL, Branches), + option(branch(Branch), RepoOptions, master) + }, + html([ h1('Pull new version'), + form(action(location_by_id(cpack_resubmit)), + [ \hidden(confirm, false), + \hidden(pack, Pack), + \pull_options(MsgOptions), + table(class(form), + [ \form_input('GIT repository:', + input([ name(giturl), + size(50), + value(GitURL) + ])), + \form_input('Branch:', + \select_branch(Branches, Branch)), + \form_submit('Pull new version') + ]) + ]) + ]). + +pull_options(MsgOptions) --> + { option(return_to(Return), MsgOptions) + }, !, + hidden(return_to, Return). +pull_options(_) --> []. + +select_branch(Branches, Default) --> + html(select(name(branch), \list_branches(Branches, Default))). + +list_branches([], _) --> []. +list_branches([H|T], H) --> !, + html(option([value(H),selected], H)), + list_branches(T, H). +list_branches([H|T], D) --> !, + html(option(value(H), H)), + list_branches(T, D). + + %% cpack_list_packages(+Request) is det. %% cpack_my_packages(+Request) is det. %