Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Status


  @Override
  protected Object executeInternal() throws Exception {
    Git git = getGitRepo();

    Status status = git.status().call();

    if (status.isClean()) {
      getLog().info("No Changes");

      return null;
    }

    // Asks for Existing Files to get added
    git.add().setUpdate(true).addFilepattern(".").call();

    // Now as for any new files (untracked)

    AddCommand addCommand = git.add();

    if (!status.getUntracked().isEmpty()) {
      for (String s : status.getUntracked()) {
        getLog().info("Adding file " + s);
        addCommand.addFilepattern(s);
      }

      addCommand.call();
View Full Code Here


   * @throws GitAPIException
   *             if there was an error checking the repository
   */
  public static boolean handleUncommittedFiles(Repository repo, Shell shell)
      throws GitAPIException {
    Status status = new Git(repo).status().call();
    if (status.hasUncommittedChanges()) {
      List<String> files = new ArrayList<String>(status.getModified());
      Collections.sort(files);
      String repoName = Activator.getDefault().getRepositoryUtil()
          .getRepositoryName(repo);
      CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog(
          shell,
View Full Code Here

  @Test
  public void testCleanStateAfterInit() throws NoWorkTreeException,
      GitAPIException {
    Git parentGit = Git.wrap(parentRepository.getRepository());

    Status status = parentGit.status().setWorkingTreeIt(treeIt).call();
    assertTrue(status.isClean());
  }
View Full Code Here

    RepositoryTestCase.fsTick(null);
    parentRepository.trackAllFiles(parentProject);
    parentRepository.commit("modified parent.txt");
    Git parentGit = Git.wrap(parentRepository.getRepository());

    Status status = parentGit.status().setWorkingTreeIt(treeIt).call();
    assertTrue(status.isClean());
  }
View Full Code Here

    testRepo.commit("project files");

    IFile workspaceFile = testRepo.getIFile(iProject, file);

    testRepo.appendFileContent(file, "some changes");
    Status status = new Git(repo).status().call();
    assertEquals(0, status.getAdded().size());
    assertEquals(1, status.getModified().size());
    String repoRelativePath = testRepo.getRepoRelativePath(workspaceFile
        .getLocation().toPortableString());
    assertTrue(status.getModified().contains(repoRelativePath));

    iProject.refreshLocal(IResource.DEPTH_INFINITE,
        new NullProgressMonitor());

    IMergeContext mergeContext = prepareContext(workspaceFile, HEAD, HEAD);
    IDiff node = mergeContext.getDiffTree().getDiff(workspaceFile);
    assertNotNull(node);
    // First of all, "markAsMerged" is not supposed to have any effect on a
    // folder.
    // Second, it should only be used on IDiff obtained from the context,
    // not created for the occasion.
    mergeContext.markAsMerged(node, true, null);

    status = new Git(repo).status().call();
    assertEquals(1, status.getChanged().size());
    assertEquals(0, status.getModified().size());
    assertTrue(status.getChanged().contains(repoRelativePath));
  }
View Full Code Here

        new NullProgressMonitor());
    assertEquals(IStatus.OK, mergeStatus.getSeverity());
    assertContentEquals(workspaceFile, branchChanges + initialContent
        + masterChanges);

    Status status = new Git(repo).status().call();
    assertEquals(1, status.getChanged().size());
    assertEquals(0, status.getModified().size());
    assertTrue(status.getChanged().contains(repoRelativePath));
  }
View Full Code Here

    assertContentEquals(iFile1, branchChanges + initialContent1
        + masterChanges);
    assertContentEquals(iFile2, branchChanges + initialContent2
        + masterChanges);

    Status status = new Git(repo).status().call();
    assertEquals(2, status.getChanged().size());
    assertEquals(0, status.getModified().size());
    assertTrue(status.getChanged().contains(repoRelativePath1));
    assertTrue(status.getChanged().contains(repoRelativePath2));
  }
View Full Code Here

    IStatus mergeStatus = mergeContext.merge(node, false,
        new NullProgressMonitor());
    assertEquals(IStatus.ERROR, mergeStatus.getSeverity());
    assertContentEquals(workspaceFile, initialContent + masterChanges);

    Status status = new Git(repo).status().call();
    assertEquals(0, status.getChanged().size());
    assertEquals(0, status.getModified().size());
    assertFalse(status.getChanged().contains(repoRelativePath));
  }
View Full Code Here

    assertTrue(conflictingFiles.contains(iFile2));

    assertContentEquals(iFile1, initialContent1 + masterChanges);
    assertContentEquals(iFile2, initialContent2 + masterChanges);

    Status status = new Git(repo).status().call();
    assertEquals(0, status.getChanged().size());
    assertEquals(0, status.getModified().size());
  }
View Full Code Here

    assertEquals(IStatus.OK, mergeStatus.getSeverity());
    assertContentEquals(iFile1, branchChanges + initialContent1
        + masterChanges);
    assertFalse(iFile2.exists());

    Status status = new Git(repo).status().call();
    assertEquals(1, status.getChanged().size());
    assertEquals(1, status.getRemoved().size());
    assertEquals(0, status.getModified().size());
    assertTrue(status.getChanged().contains(repoRelativePath1));
    assertTrue(status.getRemoved().contains(repoRelativePath2));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.Status

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.