Exemplo n.º 1
0
    @Override
    public PatchSet updateChangeImpl(ChangeContext ctx)
        throws NoSuchChangeException, ResourceConflictException, OrmException, IOException {
      if (rebaseOp == null) {
        // Took the fast-forward option, nothing to do.
        return null;
      }

      rebaseOp.updateChange(ctx);
      ctx.getChange()
          .setCurrentPatchSet(
              args.patchSetInfoFactory.get(args.rw, newCommit, rebaseOp.getPatchSetId()));
      newCommit.setControl(ctx.getControl());
      return rebaseOp.getPatchSet();
    }
    @Override
    public boolean updateChange(ChangeContext ctx) throws ResourceNotFoundException, OrmException {
      PatchSet ps = psUtil.get(ctx.getDb(), ctx.getNotes(), psId);
      if (ps == null) {
        throw new ResourceNotFoundException("patch set not found: " + psId);
      }
      comment =
          new Comment(
              new Comment.Key(ChangeUtil.messageUUID(ctx.getDb()), in.path, ps.getPatchSetId()),
              ctx.getAccountId(),
              ctx.getWhen(),
              in.side(),
              in.message.trim(),
              serverId);
      comment.parentUuid = Url.decode(in.inReplyTo);
      comment.setLineNbrAndRange(in.line, in.range);
      comment.tag = in.tag;
      setCommentRevId(comment, patchListCache, ctx.getChange(), ps);

      commentsUtil.putComments(
          ctx.getDb(), ctx.getUpdate(psId), Status.DRAFT, Collections.singleton(comment));
      ctx.bumpLastUpdatedOn(false);
      return true;
    }