Examples of Git


Examples of org.eclipse.jgit.api.Git

    }

    private Git getOrInitGit(File folder) throws IOException, GitAPIException
    {
        reporter.debugMethod(SHORT_NAME,"getOrInitGit");
        Git gitRepo;
        try
        {
            reporter.debugText(SHORT_NAME,"looking for git folder in " + folder.getAbsolutePath());
            RepositoryBuilder rb = new RepositoryBuilder()
                    .readEnvironment()
View Full Code Here

Examples of org.eclipse.jgit.api.Git

    @Override
    public Context apply(Context context) {
        try {
            logger.info("Cloning the '{}' repository at path: '{}'", context.getName(), context.getProjectPath());
            Git git = Git.cloneRepository()
                .setBare(true)
                .setNoCheckout(true)
                .setCloneAllBranches(true)
                .setDirectory(context.getProjectPath())
                .setURI(context.getUri())
                .setProgressMonitor(new LoggingProgressMonitor(logger))
                .call();
            Repository repository = git.getRepository();
            context.setRepository(repository);

            Collection<Ref> refs = repository.getRefDatabase().getRefs(R_HEADS).values();
            context.setRefs(refs);
            logger.info("Found {} refs to process.", refs.size());
View Full Code Here

Examples of org.eclipse.jgit.api.Git

                .build();
            context.setRepository(repository);

            logger.info("Fetching '{}' repository at path: '{}'", context.getName(), context.getProjectPath());

            Git git = new Git(repository);

            FetchResult fetchResult = git.fetch()
                .setProgressMonitor(new LoggingProgressMonitor(logger))
                .call();


            Collection<Ref> refs = FluentIterable
View Full Code Here

Examples of org.eclipse.jgit.api.Git

      final ObjectId head = db.resolve(Constants.HEAD);
      if (head == null)
        throw die(CLIText.get().onBranchToBeBorn);
    }

    CheckoutCommand command = new Git(db).checkout();
    command.setCreateBranch(createBranch);
    command.setName(name);
    command.setForce(force);
    try {
      String oldBranch = db.getBranch();
View Full Code Here

Examples of org.eclipse.jgit.api.Git

  @Argument(index = 1, metaVar = "metaVar_refspec")
  private List<RefSpec> toget;

  @Override
  protected void run() throws Exception {
    Git git = new Git(db);
    FetchCommand fetch = git.fetch();
    if (fsck != null)
      fetch.setCheckFetchedObjects(fsck.booleanValue());
    if (prune != null)
      fetch.setRemoveDeletedRefs(prune.booleanValue());
    if (toget != null)
View Full Code Here

Examples of org.eclipse.jgit.api.Git

  @Parameter(property = "heroku.sourceStackRepository", defaultValue = "https://bitbucket.org/ingenieux/cedarhero-jetty.git")
  String sourceStackRepository;

  @Override
  protected void executeInternal() throws Exception {
    Git gitRepo = getGitRepo(stagingDirectory);

    File webappStagingDirectory = new File(stagingDirectory, "webapp");

    if (!webappStagingDirectory.exists()) {
      webappStagingDirectory.mkdirs();
View Full Code Here

Examples of org.eclipse.jgit.api.Git

      getLog().info("Error", exc);
    }
  }

  protected Git getGitRepo(File stagingDirectory) throws Exception {
    Git git = null;

    if (!stagingDirectory.exists()) {
      log("Need to create git repository in %s", stagingDirectory);

      log("Cloning from %s", sourceStackRepository);

      Git.cloneRepository().setNoCheckout(false).setDirectory(stagingDirectory).setURI(sourceStackRepository).setProgressMonitor(new TextProgressMonitor()).call();

      git = Git.open(stagingDirectory);

      StoredConfig config = git.getRepository().getConfig();
      config.unsetSection("remote", "origin");
      try {
        config.save();
      } catch (IOException e) {
        log(e, "Error while removing remote");
View Full Code Here

Examples of org.eclipse.jgit.api.Git

    region = defaultIfBlank(region, "us-east-1");
  }

  @Override
  protected Object executeInternal() throws Exception {
    Git git = getGitRepo();
    String versionLabel = null;

    String commitId = null;

    Ref masterRef = git.getRepository()
        .getRef("master");
    if (null != masterRef)
      commitId = ObjectId.toString(masterRef.getObjectId());

    Status status = git.status().call();

    boolean pushAhead = false;

    if (null != commitId && status.isClean()) {
      versionLabel = lookupVersionLabelForCommitId(commitId);

      if (null == versionLabel) {
        getLog().info("No Changes. However, we've didn't get something close in AWS Elastic Beanstalk and we're pushing ahead");
        pushAhead = true;
      } else {
        getLog().info("No Changes. However, we've got something close in AWS Elastic Beanstalk and we're continuing");

        project.getProperties().put("beanstalk.versionLabel", versionLabel);

        return null;
      }
    }

    if (!pushAhead) {
      // Asks for Existing Files to get added
      git.add().setUpdate(true).addFilepattern(".").call();

      // Now as for any new files (untracked)

      AddCommand addCommand = git.add();

      if (!status.getUntracked().isEmpty()) {
        for (String s : status.getUntracked()) {
          getLog().info("Adding file " + s);
          addCommand.addFilepattern(s);
        }

        addCommand.call();
      }

      git.commit().setAll(true).setMessage(versionDescription).call();

      masterRef = git.getRepository()
          .getRef("master");

      commitId = ObjectId.toString(masterRef.getObjectId());
    }

    String environmentName = null;

    /*
     * Builds the remote push URL
     */
    if (null != curEnv && !skipEnvironmentUpdate)
      environmentName = curEnv.getEnvironmentName();

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

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

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

View Full Code Here

Examples of org.eclipse.jgit.api.Git

    if (src == null)
      throw die(MessageFormat.format(
          CLIText.get().refDoesNotExistOrNoCommit, ref));

    Ref oldHead = db.getRef(Constants.HEAD);
    Git git = new Git(db);
    MergeCommand mergeCmd = git.merge().setStrategy(mergeStrategy)
        .setSquash(squash).setFastForward(ff).setCommit(!noCommit);
    if (srcRef != null)
      mergeCmd.include(srcRef);
    else
      mergeCmd.include(src);
View Full Code Here

Examples of org.eclipse.jgit.api.Git

    return versionLabel;
  }

  private Git getGitRepo() throws Exception {
    Git git = null;

    if (!useStagingDirectory) {
      File gitRepo = new File(sourceDirectory, ".git");

      if (!gitRepo.exists()) {
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.