cpack_repository/commit

ADDED: branch parameter to /api/cpack/resubmit

authorJan Wielemaker
Thu May 26 11:14:07 2011 +0200
committerJan Wielemaker
Thu May 26 11:14:07 2011 +0200
commit4c6500c3414385be7a0e0a718d56f90c5d47d1ec
tree6347e6ce16d75fcabcb913a4cede716a0a0f8141
parentd9d2ea6ade0e71a103e2a4fc4a9b7de2bb6e14f9
Diff style: patch stat
diff --git a/applications/cpack_submit.pl b/applications/cpack_submit.pl
index 4d265cb..53df695 100644
--- a/applications/cpack_submit.pl
+++ b/applications/cpack_submit.pl
@@ -124,6 +124,9 @@ cpack_resubmit(Request) :-
 			[ pack(Pack,
 			       [ description('URI of the CPACK to update')
 			       ]),
+			  branch(Branch,
+				 [ description('Branch to update from')
+				 ]),
 			  return_to(ReturnTo,
 				    [ optional(true),
 				      description('Return link')
@@ -137,14 +140,17 @@ cpack_resubmit(Request) :-
 	->  MsgOptions = []
 	;   MsgOptions = [return_to(ReturnTo)]
 	),
-	findall(O, submit_option(User, Pack, O), RepoOptions),
+	findall(O, submit_option(User, Pack, Branch, O), RepoOptions),
 	call_showing_messages(cpack_add_repository(UserURL, GitURL, RepoOptions),
 			      MsgOptions).
 
-submit_option(_User, Pack, branch(Branch)) :-
-	rdf_has(Pack, cpack:clonedRepository, GitRepo),
-	rdf_has(GitRepo, cpack:branch, literal(Branch)).
-submit_option(User, _Pack, allowed(true)) :-
+submit_option(_User, Pack, Branch, branch(Branch)) :-
+	(   var(Branch)
+	->  rdf_has(Pack, cpack:clonedRepository, GitRepo),
+	    rdf_has(GitRepo, cpack:branch, literal(Branch))
+	;   true
+	).
+submit_option(User, _Pack, _Branch, allowed(true)) :-
 	catch(check_permission(User, admin(cpack)), _, fail).