Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.PushCommand


    /*
     * Does the Push
     */
    {
      PushCommand cmd = git.//
          push();

      if (! silentUpload)
        cmd.setProgressMonitor(new TextProgressMonitor());

      Iterable<PushResult> pushResults = null;
      try {
        pushResults = cmd.setRefSpecs(new RefSpec("HEAD:refs/heads/master")).//
            setForce(true).//
            setRemote(remote).//
            call();
      } catch (Exception exc) {
        // Ignore
View Full Code Here


  private boolean shownURI;

  @Override
  protected void run() throws Exception {
    Git git = new Git(db);
    PushCommand push = git.push();
    push.setDryRun(dryRun);
    push.setForce(force);
    push.setProgressMonitor(new TextProgressMonitor());
    push.setReceivePack(receivePack);
    push.setRefSpecs(refSpecs);
    if (all)
      push.setPushAll();
    if (tags)
      push.setPushTags();
    push.setRemote(remote);
    push.setThin(thin);
    push.setTimeout(timeout);
    Iterable<PushResult> results = push.call();
    for (PushResult result : results) {
      ObjectReader reader = db.newObjectReader();
      try {
        printPushResult(reader, result.getURI(), result);
      } finally {
View Full Code Here

        session.setUserInfo(userInfo);
      }
    };
    SshSessionFactory.setInstance(sessionFactory);

    PushCommand pushCommand = repo.push().setRemote(remoteUrl).add("master").setProgressMonitor(new TextProgressMonitor()).setForce(true);
       
    pushCommand.call();
  }
View Full Code Here

    /*
     * Does the Push
     */
    {
      PushCommand cmd = git.//
          push();

      cmd.setProgressMonitor(new TextProgressMonitor());

      Iterable<PushResult> pushResults = null;
      try {
        pushResults = cmd.setRefSpecs(new RefSpec("HEAD:refs/heads/master")).//
            setForce(true).//
            setRemote(remote).//
            call();
      } catch (Exception exc) {
        // Ignore
View Full Code Here

  private boolean shownURI;

  @Override
  protected void run() throws Exception {
    Git git = new Git(db);
    PushCommand push = git.push();
    push.setDryRun(dryRun);
    push.setForce(force);
    push.setProgressMonitor(new TextProgressMonitor());
    push.setReceivePack(receivePack);
    push.setRefSpecs(refSpecs);
    if (all)
      push.setPushAll();
    if (tags)
      push.setPushTags();
    push.setRemote(remote);
    push.setThin(thin);
    push.setTimeout(timeout);
    Iterable<PushResult> results = push.call();
    for (PushResult result : results) {
      ObjectReader reader = db.newObjectReader();
      try {
        printPushResult(reader, result.getURI(), result);
      } finally {
View Full Code Here

    JSONObject result = new JSONObject();
    try {
      db = FileRepositoryBuilder.create(gitDir);
      Git git = new Git(db);

      PushCommand pushCommand = git.push();
      pushCommand.setProgressMonitor(gitMonitor);
      pushCommand.setTransportConfigCallback(new TransportConfigCallback() {
        @Override
        public void configure(Transport t) {
          credentials.setUri(t.getURI());
          if (t instanceof TransportHttp && cookie != null) {
            HashMap<String, String> map = new HashMap<String, String>();
            map.put(GitConstants.KEY_COOKIE, cookie.getName() + "=" + cookie.getValue());
            ((TransportHttp) t).setAdditionalHeaders(map);
          }
        }
      });
      RemoteConfig remoteConfig = new RemoteConfig(git.getRepository().getConfig(), remote);
      credentials.setUri(remoteConfig.getURIs().get(0));
      pushCommand.setCredentialsProvider(credentials);

      boolean pushToGerrit = branch.startsWith("for/");
      RefSpec spec = new RefSpec(srcRef + ':' + (pushToGerrit ? "refs/" : Constants.R_HEADS) + branch);
      pushCommand.setRemote(remote).setRefSpecs(spec);
      if (tags)
        pushCommand.setPushTags();
      pushCommand.setForce(force);
      Iterable<PushResult> resultIterable = pushCommand.call();
      if (monitor.isCanceled()) {
        return new Status(IStatus.CANCEL, GitActivator.PI_GIT, "Cancelled");
      }
      PushResult pushResult = resultIterable.iterator().next();
      boolean error = false;
View Full Code Here

      environmentName = curEnv.getEnvironmentName();

    String remote = new RequestSigner(getAWSCredentials(), applicationName,
        region, commitId, environmentName, new Date()).getPushUrl();

    PushCommand cmd = git.//
        push();

    cmd.setProgressMonitor(new TextProgressMonitor());

    try {
      cmd.setRefSpecs(new RefSpec("HEAD:refs/heads/master")).//
          setForce(true).//
          setRemote(remote).//
          call();
    } catch (Exception exc) {
      // Ignore
View Full Code Here

    /*
     * Does the Push
     */
    {
      PushCommand cmd = git.//
          push();

      cmd.setProgressMonitor(new TextProgressMonitor());

      Iterable<PushResult> pushResults = null;
      try {
        pushResults = cmd.setRefSpecs(new RefSpec("HEAD:refs/heads/master")).//
            setForce(true).//
            setRemote(remote).//
            call();
      } catch (Exception exc) {
        // Ignore
View Full Code Here

    /*
     * Does the Push
     */
    {
      PushCommand cmd = git.//
          push();

      cmd.setProgressMonitor(new TextProgressMonitor());

      Iterable<PushResult> pushResults = null;
      try {
        pushResults = cmd.setRefSpecs(new RefSpec("HEAD:refs/heads/master")).//
            setForce(true).//
            setRemote(remote).//
            call();
      } catch (Exception exc) {
        // Ignore
View Full Code Here

      environmentName = curEnv.getEnvironmentName();

    String remote = new RequestSigner(getAWSCredentials(), applicationName,
        region, commitId, environmentName, new Date()).getPushUrl();

    PushCommand cmd = git.//
        push();

    cmd.setProgressMonitor(new TextProgressMonitor());

    try {
      cmd.setRefSpecs(new RefSpec("HEAD:refs/heads/master")).//
          setForce(true).//
          setRemote(remote).//
          call();
    } catch (Exception exc) {
      // Ignore
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.PushCommand

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.