Examples of PatchSet


Examples of com.gitblit.models.TicketModel.Patchset

   * @param patchset
   * @return true, if successful
   */
  public MergeStatus merge(TicketModel ticket) {
    PersonIdent committer = new PersonIdent(user.getDisplayName(), StringUtils.isEmpty(user.emailAddress) ? (user.username + "@gitblit") : user.emailAddress);
    Patchset patchset = ticket.getCurrentPatchset();
    String message = MessageFormat.format("Merged #{0,number,0} \"{1}\"", ticket.number, ticket.title);
    Ref oldRef = null;
    try {
      oldRef = getRepository().getRef(ticket.mergeTo);
    } catch (IOException e) {
View Full Code Here

Examples of com.gitblit.models.TicketModel.Patchset

    DiffStat diffstat = null;

    String pattern;
    if (lastChange.hasPatchset()) {
      // patchset uploaded
      Patchset patchset = lastChange.patchset;
      String base = "";
      // determine the changed paths
      Repository repo = null;
      try {
        repo = repositoryManager.getRepository(ticket.repository);
        if (patchset.isFF() && (patchset.rev > 1)) {
          // fast-forward update, just show the new data
          isFastForward = true;
          Patchset prev = ticket.getPatchset(patchset.number, patchset.rev - 1);
          base = prev.tip;
        } else {
          // proposal OR non-fast-forward update
          isFastForward = false;
          base = patchset.base;
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.PatchSet

      CreateCodeReviewNotes notes = codeReviewNotesFactory.create(db, git);
      try {
        notes.loadBase();
        for (Change change : changes) {
          monitor.update(1);
          PatchSet ps = db.patchSets().get(change.currentPatchSetId());
          if (ps == null) {
            continue;
          }
          notes.add(change, ObjectId.fromString(ps.getRevision().get()));
        }
        notes.commit("Exported prior reviews from Gerrit Code Review\n");
        notes.updateRef();
      } finally {
        notes.release();
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.PatchSet

      git = gitManager.openRepository(project);
    } catch (IOException e) {
      return;
    }
    try {
      PatchSet ps = db.patchSets().get(change.currentPatchSetId());
      if (ps == null || ps.getRevision() == null
          || ps.getRevision().get() == null) {
        return;
      }
      ChangeUtil.updateTrackingIds(db, change, footers, parse(git, ps)
          .getFooterLines());
    } catch (OrmException error) {
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.PatchSet

    if (commit.patchsetId == null) {
      try {
        List<PatchSet> matches =
            db.patchSets().byRevision(new RevId(commit.name())).toList();
        if (matches.size() == 1) {
          final PatchSet ps = matches.get(0);
          commit.patchsetId = ps.getId();
          commit.change = db.changes().get(ps.getId().getParentKey());
        }
      } catch (OrmException e) {
      }
    }
  }
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.PatchSet

    final PatchSetApproval from = submitter;
    workQueue.getDefaultQueue()
        .submit(requestScopePropagator.wrap(new Runnable() {
      @Override
      public void run() {
        PatchSet patchSet;
        try {
          ReviewDb reviewDb = schemaFactory.open();
          try {
            patchSet = reviewDb.patchSets().get(c.currentPatchSetId());
          } finally {
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.PatchSet

    workQueue.getDefaultQueue()
        .submit(requestScopePropagator.wrap(new Runnable() {
      @Override
      public void run() {
        PatchSet patchSet;
        PatchSetApproval submitter;
        try {
          ReviewDb reviewDb = schemaFactory.open();
          try {
            patchSet = reviewDb.patchSets().get(c.currentPatchSetId());
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.PatchSet

        commits.put(changeId, CodeReviewCommit
            .error(CommitMergeStatus.NO_PATCH_SET));
        continue;
      }

      final PatchSet ps;
      try {
        ps = db.patchSets().get(chg.currentPatchSetId());
      } catch (OrmException e) {
        throw new MergeException("Cannot query the database", e);
      }
      if (ps == null || ps.getRevision() == null
          || ps.getRevision().get() == null) {
        commits.put(changeId, CodeReviewCommit
            .error(CommitMergeStatus.NO_PATCH_SET));
        continue;
      }

      final String idstr = ps.getRevision().get();
      final ObjectId id;
      try {
        id = ObjectId.fromString(idstr);
      } catch (IllegalArgumentException iae) {
        commits.put(changeId, CodeReviewCommit
            .error(CommitMergeStatus.NO_PATCH_SET));
        continue;
      }

      if (!tips.contains(id)) {
        // TODO Technically the proper way to do this test is to use a
        // RevWalk on "$id --not --all" and test for an empty set. But
        // that is way slower than looking for a ref directly pointing
        // at the desired tip. We should always have a ref available.
        //
        // TODO this is actually an error, the branch is gone but we
        // want to merge the issue. We can't safely do that if the
        // tip is not reachable.
        //
        commits.put(changeId, CodeReviewCommit
            .error(CommitMergeStatus.REVISION_GONE));
        continue;
      }

      final CodeReviewCommit commit;
      try {
        commit = (CodeReviewCommit) rw.parseCommit(id);
      } catch (IOException e) {
        log.error("Invalid commit " + id.name() + " on " + chg.getKey(), e);
        commits.put(changeId, CodeReviewCommit
            .error(CommitMergeStatus.REVISION_GONE));
        continue;
      }

      commit.change = chg;
      commit.patchsetId = ps.getId();
      commit.originalOrder = commitOrder++;
      commits.put(changeId, commit);

      if (branchTip != null) {
        // If this commit is already merged its a bug in the queuing code
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.PatchSet

                change.nextPatchSetId();
                return change;
              }
            });

    final PatchSet ps = new PatchSet(n.change.currPatchSetId());
    ps.setCreatedOn(new Timestamp(System.currentTimeMillis()));
    ps.setUploader(submitAudit.getAccountId());
    ps.setRevision(new RevId(id.getName()));
    insertAncestors(ps.getId(), newCommit);
    db.patchSets().insert(Collections.singleton(ps));

    n.change =
        db.changes().atomicUpdate(n.change.getId(),
            new AtomicUpdate<Change>() {
              @Override
              public Change update(Change change) {
                change.setCurrentPatchSet(patchSetInfoFactory.get(newCommit,
                    ps.getId()));
                return change;
              }
            });

    this.submitted.remove(oldChange);
    this.submitted.add(n.change);

    if (approvalList != null) {
      for (PatchSetApproval a : approvalList) {
        db.patchSetApprovals().insert(
            Collections.singleton(new PatchSetApproval(ps.getId(), a)));
      }
    }

    newCommit.copyFrom(n);
    newCommit.statusCode = CommitMergeStatus.CLEAN_PICK;
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.PatchSet

                  includeApprovals ? d.approvalsMap(db) : null);
            }
          }

          if (includeCurrentPatchSet) {
            PatchSet current = d.currentPatchSet(db);
            if (current != null) {
              c.currentPatchSet = eventFactory.asPatchSetAttribute(current);
              eventFactory.addApprovals(c.currentPatchSet, //
                  d.currentApprovals(db));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.