import org.apache.wicket.markup.html.panel.Fragment;\r
import org.apache.wicket.model.IModel;\r
import org.apache.wicket.model.Model;\r
+import org.eclipse.jgit.lib.Repository;\r
\r
+import com.gitblit.Constants;\r
import com.gitblit.Constants.AccessPermission;\r
import com.gitblit.models.RegistrantAccessPermission;\r
import com.gitblit.models.TicketModel;\r
\r
private IModel<String> topicModel;\r
\r
+ private IModel<String> mergeToModel;\r
+\r
private IModel<TicketResponsible> responsibleModel;\r
\r
private IModel<TicketMilestone> milestoneModel;\r
topicModel = Model.of(ticket.topic == null ? "" : ticket.topic);\r
responsibleModel = Model.of();\r
milestoneModel = Model.of();\r
+ mergeToModel = Model.of(ticket.mergeTo == null ? "" : ticket.mergeTo);\r
\r
setStatelessHint(false);\r
setOutputMarkupId(true);\r
}\r
}\r
\r
+ String mergeTo = mergeToModel.getObject();\r
+ if ((StringUtils.isEmpty(ticket.mergeTo) && !StringUtils.isEmpty(mergeTo))\r
+ || (!StringUtils.isEmpty(mergeTo) && !mergeTo.equals(ticket.mergeTo))) {\r
+ // integration branch change\r
+ change.setField(Field.mergeTo, mergeTo);\r
+ }\r
+\r
if (change.hasFieldChanges()) {\r
if (!ticket.isWatching(createdBy)) {\r
change.watch(createdBy);\r
\r
milestone.add(new DropDownChoice<TicketMilestone>("milestone", milestoneModel, milestones));\r
form.add(milestone.setVisible(!milestones.isEmpty()));\r
+\r
+ // mergeTo (integration branch)\r
+ List<String> branches = new ArrayList<String>();\r
+ for (String branch : getRepositoryModel().getLocalBranches()) {\r
+ // exclude ticket branches\r
+ if (!branch.startsWith(Constants.R_TICKET)) {\r
+ branches.add(Repository.shortenRefName(branch));\r
+ }\r
+ }\r
+ branches.remove(Repository.shortenRefName(getRepositoryModel().HEAD));\r
+ branches.add(0, Repository.shortenRefName(getRepositoryModel().HEAD));\r
+\r
+ Fragment mergeto = new Fragment("mergeto", "mergeToFragment", this);\r
+ mergeto.add(new DropDownChoice<String>("mergeto", mergeToModel, branches));\r
+ form.add(mergeto.setVisible(!branches.isEmpty()));\r
+\r
} else {\r
// user does not have permission to assign milestone or responsible\r
form.add(new Label("responsible").setVisible(false));\r
form.add(new Label("milestone").setVisible(false));\r
+ form.add(new Label("mergeto").setVisible(false));\r
}\r
\r
form.add(new Button("update"));\r
};\r
cancel.setDefaultFormProcessing(false);\r
form.add(cancel);\r
-\r
}\r
\r
@Override\r