| | |
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.models.RegistrantAccessPermission;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.RepositoryUrl;
|
| | | import com.gitblit.models.SubmoduleModel;
|
| | | import com.gitblit.models.TicketModel;
|
| | | import com.gitblit.models.TicketModel.Change;
|
| | |
| | | import com.gitblit.tickets.TicketLabel;
|
| | | import com.gitblit.tickets.TicketMilestone;
|
| | | import com.gitblit.tickets.TicketResponsible;
|
| | | import com.gitblit.utils.ArrayUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JGitUtils.MergeStatus;
|
| | | import com.gitblit.utils.MarkdownUtils;
|
| | |
| | | */
|
| | | if (currentPatchset == null) {
|
| | | // no patchset available
|
| | | if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository)) {
|
| | | String repoUrl = getRepositoryUrl(user, repository);
|
| | | if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository) && !StringUtils.isEmpty(repoUrl)) {
|
| | | // ticket & repo will accept a proposal patchset
|
| | | // show the instructions for proposing a patchset
|
| | | String repoUrl = getRepositoryUrl(user, repository);
|
| | | Fragment changeIdFrag = new Fragment("patchset", "proposeFragment", this);
|
| | | changeIdFrag.add(new Label("proposeInstructions", MarkdownUtils.transformMarkdown(getString("gb.proposeInstructions"))).setEscapeModelStrings(false));
|
| | | changeIdFrag.add(new Label("ptWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Barnum")));
|
| | |
| | | String displayPath = entry.path;
|
| | | String path = entry.path;
|
| | | if (entry.isSymlink()) {
|
| | | RevCommit commit = JGitUtils.getCommit(getRepository(), Constants.R_TICKETS_PATCHSETS + ticket.number);
|
| | | RevCommit commit = JGitUtils.getCommit(getRepository(), PatchsetCommand.getTicketBranch(ticket.number));
|
| | | path = JGitUtils.getStringContent(getRepository(), commit.getTree(), path);
|
| | | displayPath = entry.path + " -> " + path;
|
| | | }
|
| | |
| | | };
|
| | | panel.add(pathsView);
|
| | |
|
| | | addPtReviewInstructions(user, repository, panel);
|
| | | addGitReviewInstructions(user, repository, panel);
|
| | | addPtCheckoutInstructions(user, repository, panel);
|
| | | addGitCheckoutInstructions(user, repository, panel);
|
| | | panel.add(createMergePanel(user, repository));
|
| | |
|
| | | return panel;
|
| | |
| | | return x;
|
| | | }
|
| | |
|
| | | protected void addGitReviewInstructions(UserModel user, RepositoryModel repository, MarkupContainer panel) {
|
| | | protected void addGitCheckoutInstructions(UserModel user, RepositoryModel repository, MarkupContainer panel) {
|
| | | panel.add(new Label("gitStep1", MessageFormat.format(getString("gb.stepN"), 1)));
|
| | | panel.add(new Label("gitStep2", MessageFormat.format(getString("gb.stepN"), 2)));
|
| | |
|
| | | String ticketBranch = Repository.shortenRefName(PatchsetCommand.getTicketBranch(ticket.number));
|
| | |
|
| | | String step1 = "git fetch";
|
| | | String step1 = "git fetch origin";
|
| | | String step2 = MessageFormat.format("git checkout {0} && git pull --ff-only\nOR\ngit checkout {0} && git reset --hard origin/{0}", ticketBranch);
|
| | |
|
| | | panel.add(new Label("gitPreStep1", step1));
|
| | |
| | | panel.add(createCopyFragment("gitCopyStep2", step2.replace("\n", " && ")));
|
| | | }
|
| | |
|
| | | protected void addPtReviewInstructions(UserModel user, RepositoryModel repository, MarkupContainer panel) {
|
| | | protected void addPtCheckoutInstructions(UserModel user, RepositoryModel repository, MarkupContainer panel) {
|
| | | String step1 = MessageFormat.format("pt checkout {0,number,0}", ticket.number);
|
| | | panel.add(new Label("ptPreStep", step1));
|
| | | panel.add(createCopyFragment("ptCopyStep", step1));
|
| | |
| | | */
|
| | | protected String getRepositoryUrl(UserModel user, RepositoryModel repository) {
|
| | | HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();
|
| | | String primaryurl = app().gitblit().getRepositoryUrls(req, user, repository).get(0).url;
|
| | | List<RepositoryUrl> urls = app().gitblit().getRepositoryUrls(req, user, repository);
|
| | | if (ArrayUtils.isEmpty(urls)) {
|
| | | return null;
|
| | | }
|
| | | String primaryurl = urls.get(0).url;
|
| | | String url = primaryurl;
|
| | | try {
|
| | | url = new URIish(primaryurl).setUser(null).toString();
|