Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.RepositoryBuilder


     * @return {@code true} if the commit hash was identified and the properties
     *      added to the {@code transformer}; otherwise, {@code false}.
     */
    public static boolean addCommitProperties(Transformer transformer, File baseDir, int abbrevLen, Log log) {
        try {
            RepositoryBuilder builder = new RepositoryBuilder();
            Repository repository = builder.findGitDir(baseDir).readEnvironment().build();
            ObjectId objectId = repository.resolve(Constants.HEAD);
            if (objectId != null) {
                transformer.setParameter("repository.commit", objectId.getName());
                transformer.setParameter("repository.commit.short", objectId.abbreviate(abbrevLen).name());
                return true;
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 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

      return git;
   }

   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 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

      return git(dir);
   }

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

   *             if the repository can't be created
   * @return the newly created {@code Git} object with associated repository
   */
  public Git call() throws JGitInternalException {
    try {
      RepositoryBuilder builder = new RepositoryBuilder();
      if (bare)
        builder.setBare();
      builder.readEnvironment();
      if (directory != null) {
        File d = directory;
        if (!bare)
          d = new File(d, Constants.DOT_GIT);
        builder.setGitDir(d);
      } else if (builder.getGitDir() == null) {
        File d = new File(".");
        if (d.getParentFile() != null)
          d = d.getParentFile();
        if (!bare)
          d = new File(d, Constants.DOT_GIT);
        builder.setGitDir(d);
      }
      Repository repository = builder.build();
      if (!repository.getObjectDatabase().exists())
        repository.create(bare);
      return new Git(repository);
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), 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

   }

   @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

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.