Package com.gitblit.utils.JGitUtils

Examples of com.gitblit.utils.JGitUtils.MergeStatus


    } else {
      // vetos are binding
      allowMerge = ticket.isOpen() && !ticket.isVetoed(patchset);
    }

    MergeStatus mergeStatus = JGitUtils.canMerge(getRepository(), patchset.tip, ticket.mergeTo);
    if (allowMerge) {
      if (MergeStatus.MERGEABLE == mergeStatus) {
        // patchset can be cleanly merged to integration branch OR has already been merged
        Fragment mergePanel = new Fragment("mergePanel", "mergeableFragment", this);
        mergePanel.add(new Label("mergeTitle", MessageFormat.format(getString("gb.patchsetMergeable"), ticket.mergeTo)));
        if (user.canPush(repository)) {
          // user can merge locally
          SimpleAjaxLink<String> mergeButton = new SimpleAjaxLink<String>("mergeButton", Model.of(getString("gb.merge"))) {

            private static final long serialVersionUID = 1L;

            @Override
            public void onClick(AjaxRequestTarget target) {

              // ensure the patchset is still current AND not vetoed
              Patchset patchset = ticket.getCurrentPatchset();
              final TicketModel refreshedTicket = app().tickets().getTicket(getRepositoryModel(), ticket.number);
              if (patchset.equals(refreshedTicket.getCurrentPatchset())) {
                // patchset is current, check for recent veto
                if (!refreshedTicket.isVetoed(patchset)) {
                  // patchset is not vetoed

                  // execute the merge using the ticket service
                  app().tickets().exec(new Runnable() {
                    @Override
                    public void run() {
                      PatchsetReceivePack rp = new PatchsetReceivePack(
                          app().gitblit(),
                          getRepository(),
                          getRepositoryModel(),
                          GitBlitWebSession.get().getUser());
                      MergeStatus result = rp.merge(refreshedTicket);
                      if (MergeStatus.MERGED == result) {
                        // notify participants and watchers
                        rp.sendAll();
                      } else {
                        // merge failure
                        String msg = MessageFormat.format("Failed to merge ticket {0,number,0}: {1}", ticket.number, result.name());
                        logger.error(msg);
                        GitBlitWebSession.get().cacheErrorMessage(msg);
                      }
                    }
                  });
View Full Code Here


      }
      mergeBase = JGitUtils.getCommit(getRepository(), base);
    }

    // ensure that the patchset can be cleanly merged right now
    MergeStatus status = JGitUtils.canMerge(getRepository(), tipCommit.getName(), forBranch);
    switch (status) {
    case ALREADY_MERGED:
      sendError("");
      sendError("You have already merged this patchset.", forBranch);
      sendError("");
View Full Code Here

    } else {
      // vetos are binding
      allowMerge = ticket.isOpen() && !ticket.isVetoed(patchset);
    }

    MergeStatus mergeStatus = JGitUtils.canMerge(getRepository(), patchset.tip, ticket.mergeTo);
    if (allowMerge) {
      if (MergeStatus.MERGEABLE == mergeStatus) {
        // patchset can be cleanly merged to integration branch OR has already been merged
        Fragment mergePanel = new Fragment("mergePanel", "mergeableFragment", this);
        mergePanel.add(new Label("mergeTitle", MessageFormat.format(getString("gb.patchsetMergeable"), ticket.mergeTo)));
        if (user.canPush(repository)) {
          // user can merge locally
          SimpleAjaxLink<String> mergeButton = new SimpleAjaxLink<String>("mergeButton", Model.of(getString("gb.merge"))) {

            private static final long serialVersionUID = 1L;

            @Override
            public void onClick(AjaxRequestTarget target) {

              // ensure the patchset is still current AND not vetoed
              Patchset patchset = ticket.getCurrentPatchset();
              final TicketModel refreshedTicket = app().tickets().getTicket(getRepositoryModel(), ticket.number);
              if (patchset.equals(refreshedTicket.getCurrentPatchset())) {
                // patchset is current, check for recent veto
                if (!refreshedTicket.isVetoed(patchset)) {
                  // patchset is not vetoed

                  // execute the merge using the ticket service
                  app().tickets().exec(new Runnable() {
                    @Override
                    public void run() {
                      PatchsetReceivePack rp = new PatchsetReceivePack(
                          app().gitblit(),
                          getRepository(),
                          getRepositoryModel(),
                          GitBlitWebSession.get().getUser());
                      MergeStatus result = rp.merge(refreshedTicket);
                      if (MergeStatus.MERGED == result) {
                        // notify participants and watchers
                        rp.sendAll();
                      } else {
                        // merge failure
                        String msg = MessageFormat.format("Failed to merge ticket {0,number,0}: {1}", ticket.number, result.name());
                        logger.error(msg);
                        GitBlitWebSession.get().cacheErrorMessage(msg);
                      }
                    }
                  });
View Full Code Here

      }
      mergeBase = JGitUtils.getCommit(getRepository(), base);
    }

    // ensure that the patchset can be cleanly merged right now
    MergeStatus status = JGitUtils.canMerge(getRepository(), tipCommit.getName(), forBranch);
    switch (status) {
    case ALREADY_MERGED:
      sendError("");
      sendError("You have already merged this patchset.", forBranch);
      sendError("");
View Full Code Here

TOP

Related Classes of com.gitblit.utils.JGitUtils.MergeStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.