Package org.eclipse.jgit.storage.file

Examples of org.eclipse.jgit.storage.file.FileRepositoryBuilder


                config.setString(ConfigConstants.CONFIG_REMOTE_SECTION, "origin", "pushurl", gitPushUrl);
            }
            config.save();
        }

        FileRepositoryBuilder builder = new FileRepositoryBuilder();
        repository = builder.setGitDir(dotGit).readEnvironment().findGitDir().build();
        localRepos.put(dotGit, repository);
        try {
            repository.incrementOpen();
            Git git = Git.wrap(repository);
View Full Code Here


          + ") is not a git repository.");
    }

    AddCommand gitAdd;
    try {
      Repository repo = new FileRepositoryBuilder().readEnvironment()
          .findGitDir(src).build();
      gitAdd = new Git(repo).add();
    } catch (IOException e) {
      throw new BuildException("Could not access repository " + src, e);
    }
View Full Code Here

  @Override
  public void execute() throws BuildException {
    CheckoutCommand checkout;
    try {
      Repository repo = new FileRepositoryBuilder().readEnvironment()
          .findGitDir(src).build();
      checkout = new Git(repo).checkout();
    } catch (IOException e) {
      throw new BuildException("Could not access repository " + src, e);
    }
View Full Code Here

    {
        Repository repo = repositories.get(id);
        if (repo == null)
        {
            final File repoDir = new File(repositoriesDir, id);
            FileRepositoryBuilder builder = new FileRepositoryBuilder();
            repo = builder.setWorkTree(repoDir).
                    setGitDir(new File(repoDir, ".git")).
                    setMustExist(false).
                    build();
            Bundle bundle = findBundleForPlugin(bundleContext, id);
            if (bundle != null)
View Full Code Here

    private static ESLogger logger = Loggers.getLogger(FetchOrCloneRepositoryPredicate.class);

    @Override
    public boolean apply(Context context) {
        try {
            final Repository repository = new FileRepositoryBuilder()
                .setGitDir(context.getProjectPath())
                .readEnvironment()
                .findGitDir()
                .setMustExist(false)
                .build();
View Full Code Here

    private static ESLogger logger = Loggers.getLogger(FetchRepositoryFunction.class);

    @Override
    public Context apply(Context context) {
        try {
            final Repository repository = new FileRepositoryBuilder()
                .setGitDir(context.getProjectPath())
                .readEnvironment() // scan environment GIT_* variables
                .findGitDir()
                .setMustExist(true)
                .build();
View Full Code Here

      }
    }
    if (gitdir == null)
      gitdir = new File(localName, Constants.DOT_GIT).getAbsolutePath();

    dst = new FileRepositoryBuilder().setGitDir(new File(gitdir)).build();
    dst.create();
    final StoredConfig dstcfg = dst.getConfig();
    dstcfg.setBoolean("core", null, "bare", false); //$NON-NLS-1$ //$NON-NLS-2$
    dstcfg.save();
    db = dst;
View Full Code Here

        launcher = new LocalLauncher(GitSCM.VERBOSE ? listener : TaskListener.NULL);

        if (hasGitRepo()) {//Wrap file repository if exists in order to perform operations and initialize jGitDelegate
            try {
                File gitDir = RepositoryCache.FileKey.resolve(new File(workspace.getRemote()), FS.DETECTED);
                jGitDelegate = Git.wrap(new FileRepositoryBuilder().setGitDir(gitDir).build());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
View Full Code Here

    public static BuildNumber extract(File repoDirectory) throws IOException {
        if(!(repoDirectory.exists() && repoDirectory.isDirectory())) throw new IOException(
                "Invalid repository directory provided: " + repoDirectory.getAbsolutePath());
        // open repo, jgit has some problems with not canonical paths
        File canonicalRepo = repoDirectory.getCanonicalFile();
        FileRepository repo = new FileRepositoryBuilder().findGitDir(canonicalRepo).build();
        // extract HEAD revision
        ObjectId revisionObject = repo.resolve(Constants.HEAD);
        if (null == revisionObject) throw new IOException("Cannot read current revision from repository: " + repo);
        String revision = revisionObject.name();
        // extract current branch
View Full Code Here

    result.name = name;

    File folder = new File(repositoriesFolder, name);
    if (folder.exists()) {
      File gitDir = FileKey.resolve(new File(repositoriesFolder, name), FS.DETECTED);
      Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
      result.fetchResult = fetchRepository(credentialsProvider, repository);
      repository.close();
    } else {
      CloneCommand clone = new CloneCommand();
      clone.setBare(bare);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.storage.file.FileRepositoryBuilder

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.