Examples of BatchRefUpdate


Examples of org.eclipse.jgit.lib.BatchRefUpdate

            ReceiveCommand.Type.UPDATE),
        newCommand(null, A, "refs/heads/masters/x",
            ReceiveCommand.Type.CREATE),
        newCommand(B, null, "refs/heads/masters",
            ReceiveCommand.Type.DELETE));
    BatchRefUpdate batchUpdate = refdir.newBatchUpdate();
    batchUpdate.setAllowNonFastForwards(true);
    batchUpdate.addCommand(commands);
    batchUpdate.execute(new RevWalk(diskRepo), new StrictWorkMonitor());
    Map<String, Ref> refs = refdir.getRefs(RefDatabase.ALL);
    assertEquals(ReceiveCommand.Result.OK, commands.get(0).getResult());
    assertEquals(ReceiveCommand.Result.OK, commands.get(1).getResult());
    assertEquals(ReceiveCommand.Result.OK, commands.get(2).getResult());
    assertEquals("[HEAD, refs/heads/master, refs/heads/masters/x]", refs
View Full Code Here

Examples of org.eclipse.jgit.lib.BatchRefUpdate

      SideBandProgressMonitor pm = new SideBandProgressMonitor(msgOut);
      pm.setDelayStart(250, TimeUnit.MILLISECONDS);
      updating = pm;
    }

    BatchRefUpdate batch = db.getRefDatabase().newBatchUpdate();
    batch.setAllowNonFastForwards(isAllowNonFastForwards());
    batch.setRefLogIdent(getRefLogIdent());
    batch.setRefLogMessage("push", true); //$NON-NLS-1$
    batch.addCommand(toApply);
    try {
      batch.execute(walk, updating);
    } catch (IOException err) {
      for (ReceiveCommand cmd : toApply) {
        if (cmd.getResult() == Result.NOT_ATTEMPTED)
          cmd.reject(err);
      }
View Full Code Here

Examples of org.eclipse.jgit.lib.BatchRefUpdate

      SideBandProgressMonitor pm = new SideBandProgressMonitor(msgOut);
      pm.setDelayStart(250, TimeUnit.MILLISECONDS);
      updating = pm;
    }

    BatchRefUpdate batch = db.getRefDatabase().newBatchUpdate();
    batch.setAllowNonFastForwards(isAllowNonFastForwards());
    batch.setRefLogIdent(getRefLogIdent());
    batch.setRefLogMessage("push", true);
    batch.addCommand(toApply);
    try {
      batch.execute(walk, updating);
    } catch (IOException err) {
      for (ReceiveCommand cmd : toApply) {
        if (cmd.getResult() == Result.NOT_ATTEMPTED)
          cmd.reject(err);
      }
View Full Code Here

Examples of org.eclipse.jgit.lib.BatchRefUpdate

      }
    } finally {
      closeConnection(result);
    }

    BatchRefUpdate batch = transport.local.getRefDatabase()
        .newBatchUpdate()
        .setAllowNonFastForwards(true)
        .setRefLogMessage("fetch", true);
    final RevWalk walk = new RevWalk(transport.local);
    try {
      if (monitor instanceof BatchingProgressMonitor) {
        ((BatchingProgressMonitor) monitor).setDelayStart(
            250, TimeUnit.MILLISECONDS);
      }
      if (transport.isRemoveDeletedRefs())
        deleteStaleTrackingRefs(result, batch);
      for (TrackingRefUpdate u : localUpdates) {
        result.add(u);
        batch.addCommand(u.asReceiveCommand());
      }
      for (ReceiveCommand cmd : batch.getCommands()) {
        cmd.updateType(walk);
        if (cmd.getType() == UPDATE_NONFASTFORWARD
            && cmd instanceof TrackingRefUpdate.Command
            && !((TrackingRefUpdate.Command) cmd).canForceUpdate())
          cmd.setResult(REJECTED_NONFASTFORWARD);
      }
      if (transport.isDryRun()) {
        for (ReceiveCommand cmd : batch.getCommands()) {
          if (cmd.getResult() == NOT_ATTEMPTED)
            cmd.setResult(OK);
        }
      } else
        batch.execute(walk, monitor);
    } catch (IOException err) {
      throw new TransportException(MessageFormat.format(
          JGitText.get().failureUpdatingTrackingRef,
          getFirstFailedRefName(batch), err.getMessage()), err);
    } finally {
View Full Code Here

Examples of org.eclipse.jgit.lib.BatchRefUpdate

      }
    } finally {
      closeConnection(result);
    }

    BatchRefUpdate batch = transport.local.getRefDatabase()
        .newBatchUpdate()
        .setAllowNonFastForwards(true)
        .setRefLogMessage("fetch", true); //$NON-NLS-1$
    final RevWalk walk = new RevWalk(transport.local);
    try {
      if (monitor instanceof BatchingProgressMonitor) {
        ((BatchingProgressMonitor) monitor).setDelayStart(
            250, TimeUnit.MILLISECONDS);
      }
      if (transport.isRemoveDeletedRefs())
        deleteStaleTrackingRefs(result, batch);
      for (TrackingRefUpdate u : localUpdates) {
        result.add(u);
        batch.addCommand(u.asReceiveCommand());
      }
      for (ReceiveCommand cmd : batch.getCommands()) {
        cmd.updateType(walk);
        if (cmd.getType() == UPDATE_NONFASTFORWARD
            && cmd instanceof TrackingRefUpdate.Command
            && !((TrackingRefUpdate.Command) cmd).canForceUpdate())
          cmd.setResult(REJECTED_NONFASTFORWARD);
      }
      if (transport.isDryRun()) {
        for (ReceiveCommand cmd : batch.getCommands()) {
          if (cmd.getResult() == NOT_ATTEMPTED)
            cmd.setResult(OK);
        }
      } else
        batch.execute(walk, monitor);
    } catch (IOException err) {
      throw new TransportException(MessageFormat.format(
          JGitText.get().failureUpdatingTrackingRef,
          getFirstFailedRefName(batch), err.getMessage()), err);
    } finally {
View Full Code Here

Examples of org.eclipse.jgit.lib.BatchRefUpdate

      SideBandProgressMonitor pm = new SideBandProgressMonitor(msgOut);
      pm.setDelayStart(250, TimeUnit.MILLISECONDS);
      updating = pm;
    }

    BatchRefUpdate batch = db.getRefDatabase().newBatchUpdate();
    batch.setAllowNonFastForwards(isAllowNonFastForwards());
    batch.setRefLogIdent(getRefLogIdent());
    batch.setRefLogMessage("push", true); //$NON-NLS-1$
    batch.addCommand(toApply);
    try {
      batch.execute(walk, updating);
    } catch (IOException err) {
      for (ReceiveCommand cmd : toApply) {
        if (cmd.getResult() == Result.NOT_ATTEMPTED)
          cmd.reject(err);
      }
View Full Code Here

Examples of org.eclipse.jgit.lib.BatchRefUpdate

      SideBandProgressMonitor pm = new SideBandProgressMonitor(msgOut);
      pm.setDelayStart(250, TimeUnit.MILLISECONDS);
      updating = pm;
    }

    BatchRefUpdate batch = db.getRefDatabase().newBatchUpdate();
    batch.setAllowNonFastForwards(isAllowNonFastForwards());
    batch.setRefLogIdent(getRefLogIdent());
    batch.setRefLogMessage("push", true); //$NON-NLS-1$
    batch.addCommand(toApply);
    try {
      batch.execute(walk, updating);
    } catch (IOException err) {
      for (ReceiveCommand cmd : toApply) {
        if (cmd.getResult() == Result.NOT_ATTEMPTED)
          cmd.reject(err);
      }
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.