Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.RepositoryBuilder


    @BeforeClass
    public static void beforeAll() throws Exception {
        File gitDir = new File("../../.git");

        RepositoryBuilder builder = new RepositoryBuilder();
        repository = builder.setGitDir(gitDir).readEnvironment().findGitDir().build();

        git = new Git(repository);

        context = new ExecutionContext();
        values = new Values(context.getValueFactories(), context.getBinaryStore());
View Full Code Here


    return tasks;
  }

  private Repository buildRepository(File basedir) {
    try {
      return new RepositoryBuilder()
        .findGitDir(basedir)
        .setMustExist(true)
        .build();
    } catch (IOException e) {
      throw new IllegalStateException("Unable to open Git repository", e);
View Full Code Here

   */
  public static Git open(File dir, FS fs) throws IOException {
    RepositoryCache.FileKey key;

    key = RepositoryCache.FileKey.lenient(dir, fs);
    return wrap(new RepositoryBuilder()
        .setFS(fs)
        .setGitDir(key.getFile())
        .setMustExist(true).build());
  }
View Full Code Here

    if (!submoduleGitDir.isDirectory())
      return zeroid;
    final Repository submoduleRepo;
    try {
      FS fs = repository != null ? repository.getFS() : FS.DETECTED;
      submoduleRepo = new RepositoryBuilder().setGitDir(submoduleGitDir)
          .setMustExist(true).setFS(fs).build();
    } catch (IOException exception) {
      return zeroid;
    }
    final ObjectId head;
View Full Code Here

   */
  public static Git open(File dir, FS fs) throws IOException {
    RepositoryCache.FileKey key;

    key = RepositoryCache.FileKey.lenient(dir, fs);
    return wrap(new RepositoryBuilder().setFS(fs).setGitDir(key.getFile())
        .setMustExist(true).build());
  }
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

      return git(dir);
   }

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

   public static Git init(final DirectoryResource dir) throws IllegalArgumentException, 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

      }
    } else {
      File gitRepo = stagingDirectory;
      Repository r = null;
     
      RepositoryBuilder b = new RepositoryBuilder().setGitDir(stagingDirectory).setWorkTree(sourceDirectory);

      if (!gitRepo.exists()) {
        gitRepo.getParentFile().mkdirs();
       
        r = b.build();
       
        r.create();
      } else {
        r = b.build();
      }
     
      git = Git.wrap(r);
    }
   
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.