Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.RepositoryBuilder


      System.exit(1);
    }

    final TextBuiltin cmd = subcommand;
    if (cmd.requiresRepository()) {
      RepositoryBuilder rb = new RepositoryBuilder() //
          .setGitDir(gitdir) //
          .readEnvironment() //
          .findGitDir();
      if (rb.getGitDir() == null) {
        writer.println(CLIText.get().cantFindGitDirectory);
        writer.flush();
        System.exit(1);
      }

      cmd.init(rb.build(), null);
    } else {
      cmd.init(null, gitdir);
    }
    try {
      cmd.execute(arguments.toArray(new String[arguments.size()]));
View Full Code Here


   }

   @Override
   public Git git(final DirectoryResource dir) throws IOException
   {
      RepositoryBuilder db = new RepositoryBuilder().findGitDir(dir.getUnderlyingResourceObject());
      return new Git(db.build());
   }
View Full Code Here

   public Git init(final DirectoryResource dir) throws IOException
   {
      FileResource<?> gitDir = dir.getChildDirectory(GIT_DIRECTORY).reify(FileResource.class);
      gitDir.mkdirs();

      RepositoryBuilder db = new RepositoryBuilder().setGitDir(gitDir.getUnderlyingResourceObject()).setup();
      Git git = new Git(db.build());
      git.getRepository().create();
      return git;
   }
View Full Code Here

    File subWorkTree = new File(parent, path);
    if (!subWorkTree.isDirectory())
      return null;
    File workTree = new File(parent, path);
    try {
      return new RepositoryBuilder() //
          .setMustExist(true) //
          .setFS(FS.DETECTED) //
          .setWorkTree(workTree) //
          .build();
    } catch (RepositoryNotFoundException e) {
View Full Code Here

    public GitRepository(final File sourceDirectory) {
        this.sourceDirectory = sourceDirectory;
    }
   
    public Git load() throws IOException {
        Repository repository = new RepositoryBuilder().findGitDir(this.sourceDirectory).build();
        try {
            Git.Head head = getHead(repository);
            String branch = getBranch(repository);
            List<Git.Remote> remotes = getRemotes(repository);
            return new Git(repository.getWorkTree(), head, branch, remotes);
View Full Code Here

   }

   @Override
   public Git git(final DirectoryResource dir) throws IOException
   {
      RepositoryBuilder db = new RepositoryBuilder().findGitDir(dir.getUnderlyingResourceObject());
      return new Git(db.build());
   }
View Full Code Here

   public Git init(final DirectoryResource dir) throws IOException
   {
      FileResource<?> gitDir = dir.getChildDirectory(".git").reify(FileResource.class);
      gitDir.mkdirs();

      RepositoryBuilder db = new RepositoryBuilder().setGitDir(gitDir.getUnderlyingResourceObject()).setup();
      Git git = new Git(db.build());
      git.getRepository().create();
      return git;
   }
View Full Code Here

     */
    public static JGitFlow get(File projectDir) throws JGitFlowIOException
    {
        try
        {
            RepositoryBuilder rb = new RepositoryBuilder()
                    .readEnvironment()
                    .findGitDir(projectDir);

            File gitDir = rb.getGitDir();
            Git gitRepo = Git.open(gitDir);
            GitFlowConfiguration gfConfig = new GitFlowConfiguration(gitRepo);

            return new JGitFlow(gitRepo, gfConfig, new JGitFlowReporter());
        }
View Full Code Here

    public static boolean isInitialized(File dir)
    {
        boolean inited = false;
        try
        {
            RepositoryBuilder rb = new RepositoryBuilder()
                    .readEnvironment()
                    .findGitDir(dir);
           
            File gitDir = rb.getGitDir();
            if (gitDir != null)
            {
                Git gitRepo = Git.open(gitDir);
                GitFlowConfiguration gfConfig = new GitFlowConfiguration(gitRepo);
                inited = gfConfig.gitFlowIsInitialized();
View Full Code Here

    public Repository getMergedRepository() throws IOException {
        if (mergedRepo == null) {
            File dir = new File(
                    GitRepository.getDirectoryForMerging(toProject.owner, toProject.name) + "/.git");
            mergedRepo = new RepositoryBuilder().setGitDir(dir).build();
        }

        return mergedRepo;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.RepositoryBuilder

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.