Package org.eclipse.jgit.internal.storage.file

Examples of org.eclipse.jgit.internal.storage.file.FileRepository


    private static void updateRepository(String localPath, String remotePath) throws Exception
  {       
    Repository localRepo;
    try
    {
      localRepo = new FileRepository(localPath + "/.git");

      Git git = new Git(localRepo);
      {AsposeConstants.println("Cloning Repository [" + remotePath + "]....");}

      // First try to clone the repository
View Full Code Here


   *             the repository could not be accessed to configure the rest of
   *             the builder's parameters.
   */
  @SuppressWarnings("unchecked")
  public R build() throws IOException {
    R repo = (R) new FileRepository(setup());
    if (isMustExist() && !repo.getObjectDatabase().exists())
      throw new RepositoryNotFoundException(getGitDir());
    return repo;
  }
View Full Code Here

      throw new MoxieException("Can not find .git folder for " + folder);
    }

    String hashid = "";
    try {
      Repository repository = new FileRepository(gitDir);
      ObjectId objectId = repository
          .resolve(org.eclipse.jgit.lib.Constants.HEAD);
      hashid = objectId.getName().toString();
      repository.close();
    } catch (IOException io) {
      io.printStackTrace();
      throw new MoxieException("IOException accessing "
          + gitDir.getAbsolutePath(), io);
    }
View Full Code Here

  public static void updateGhPages(File repositoryFolder, File sourceFolder,
      boolean obliterate) {
    String ghpages = "refs/heads/gh-pages";
    try {
      File gitDir = FileKey.resolve(repositoryFolder, FS.DETECTED);
      Repository repository = new FileRepository(gitDir);

      ObjectId objectId = repository.resolve(ghpages);
      if (objectId == null) {
        JGitUtils.createOrphanBranch(repository, "gh-pages", null);
      }

      System.out.println("Updating gh-pages branch...");
      ObjectId headId = repository.resolve(ghpages + "^{commit}");
      ObjectInserter odi = repository.newObjectInserter();
      try {
        // Create the in-memory index of the new/updated issue.
        DirCache index = createIndex(repository, headId, sourceFolder,
            obliterate);
        ObjectId indexTreeId = index.writeTree(odi);

        // Create a commit object
        PersonIdent author = new PersonIdent("Moxie",
            "moxie@localhost");
        CommitBuilder commit = new CommitBuilder();
        commit.setAuthor(author);
        commit.setCommitter(author);
        commit.setEncoding(Constants.CHARACTER_ENCODING);
        commit.setMessage("updated pages");
        commit.setParentId(headId);
        commit.setTreeId(indexTreeId);

        // Insert the commit into the repository
        ObjectId commitId = odi.insert(commit);
        odi.flush();

        RevWalk revWalk = new RevWalk(repository);
        try {
          RevCommit revCommit = revWalk.parseCommit(commitId);
          RefUpdate ru = repository.updateRef(ghpages);
          ru.setNewObjectId(commitId);
          ru.setExpectedOldObjectId(headId);
          ru.setRefLogMessage(
              "commit: " + revCommit.getShortMessage(), false);
          Result rc = ru.forceUpdate();
View Full Code Here

        try {
            final File gitDir = RepositoryCache.FileKey.resolve( repoFolder, DETECTED );
            final Repository repository;
            final Git git;
            if ( gitDir != null && gitDir.exists() ) {
                repository = new FileRepository( gitDir );
                git = new Git( repository );
            } else {
                git = Git.cloneRepository()
                        .setBare( bare )
                        .setCloneAllBranches( true )
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.internal.storage.file.FileRepository

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.