Example usage for org.eclipse.jgit.api Status getIgnoredNotInIndex

List of usage examples for org.eclipse.jgit.api Status getIgnoredNotInIndex

Introduction

In this page you can find the example usage for org.eclipse.jgit.api Status getIgnoredNotInIndex.

Prototype

public Set<String> getIgnoredNotInIndex() 

Source Link

Document

Get ignored files which are not in the index

Usage

From source file:com.buildautomation.jgit.api.ShowStatus.java

License:Apache License

public static void showStatus() throws IOException, GitAPIException {
    try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
        try (Git git = new Git(repository)) {
            Status status = git.status().call();
            System.out.println("Added: " + status.getAdded());
            System.out.println("Changed: " + status.getChanged());
            System.out.println("Conflicting: " + status.getConflicting());
            System.out.println("ConflictingStageState: " + status.getConflictingStageState());
            System.out.println("IgnoredNotInIndex: " + status.getIgnoredNotInIndex());
            System.out.println("Missing: " + status.getMissing());
            System.out.println("Modified: " + status.getModified());
            System.out.println("Removed: " + status.getRemoved());
            System.out.println("Untracked: " + status.getUntracked());
            System.out.println("UntrackedFolders: " + status.getUntrackedFolders());
        }/*www. j  a  va 2 s  . co m*/
    }
}

From source file:com.chungkwong.jgitgui.GitTreeItem.java

License:Open Source License

@Override
public Node getContentPage() {
    GridPane node = new GridPane();
    try {/*  w  w  w.java2s.c o  m*/
        Status status = ((Git) getValue()).status().call();
        Set<String> untrackedSet = new HashSet<>(status.getUntrackedFolders());
        untrackedSet.addAll(status.getUntracked());
        untrackedSet.removeAll(status.getIgnoredNotInIndex());
        TitledPane untracked = createList(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("UNTRACKED FILE"),
                untrackedSet);
        TitledPane missing = createList(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("MISSING"),
                status.getMissing());
        TitledPane modified = createList(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("MODIFIED"),
                status.getModified());
        TitledPane added = createList(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("ADDED"),
                status.getAdded());
        TitledPane removed = createList(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("REMOVED"),
                status.getRemoved());
        TitledPane changed = createList(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("CHANGED"),
                status.getChanged());
        Button add = new Button(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("ADD"));
        add.setOnAction((e) -> gitAdd(untracked, modified, added, changed));
        Button commit = new Button(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("COMMIT"));
        commit.setOnAction((e) -> gitCommit(added, removed, changed));
        Button clean = new Button(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("CLEAN"));
        clean.setOnAction((e) -> gitClean(untracked));
        node.addColumn(0, untracked, missing, modified, add);
        node.addColumn(1, added, removed, changed, commit, clean);
    } catch (Exception ex) {
        Logger.getLogger(GitTreeItem.class.getName()).log(Level.SEVERE, null, ex);
        Util.informUser(ex);
    }
    return node;
}

From source file:com.docmd.behavior.GitManager.java

public void gitStatus(JTextArea console) throws GitAPIException {
    Status status = git.status().call();
    console.append("\n\n$git status");
    boolean flag = false;
    if ((!(status.getAdded().isEmpty())) || (!(status.getChanged().isEmpty()))
            || (!(status.getRemoved().isEmpty()))) {
        console.append("\n\n>>> STAGED CHANGES:");
        if (!(status.getAdded().isEmpty())) {
            console.append("\n\n> Added:");
            for (String s : status.getAdded()) {
                console.append("\n" + s);
                flag = true;/*from   www.j  ava  2 s.  c  o  m*/
            }
        }
        if (!(status.getChanged().isEmpty())) {
            console.append("\n\n> Changed:");
            for (String s : status.getChanged()) {
                console.append("\n" + s);
                flag = true;
            }
        }
        if (!(status.getRemoved().isEmpty())) {
            console.append("\n\n> Removed:");
            for (String s : status.getRemoved()) {
                console.append("\n" + s);
                flag = true;
            }
        }
    }
    if (!(status.getConflicting().isEmpty())) {
        console.append("\n\n> Conflicting:");
        for (String s : status.getConflicting()) {
            console.append("\n" + s);
            flag = true;
        }
    }
    if (!(status.getIgnoredNotInIndex().isEmpty())) {
        console.append("\n\n> IgnoredNotInIndex:");
        for (String s : status.getIgnoredNotInIndex()) {
            console.append("\n" + s);
            flag = true;
        }
    }
    if ((!(status.getModified().isEmpty())) || (!(status.getMissing().isEmpty()))
            || (!(status.getUntracked().isEmpty())) || (!(status.getUntrackedFolders().isEmpty()))) {
        console.append("\n\n>>> UNSTAGED CHANGES:");
        if (!(status.getModified().isEmpty())) {
            console.append("\n\n> Modified:");
            for (String s : status.getModified()) {
                console.append("\n" + s);
                flag = true;
            }
        }
        if (!(status.getMissing().isEmpty())) {
            console.append("\n\n> Deleted:");
            for (String s : status.getMissing()) {
                console.append("\n" + s);
                flag = true;
            }
        }
        if (!(status.getUntracked().isEmpty())) {
            console.append("\n\n> Untracked:");
            for (String s : status.getUntracked()) {
                console.append("\n" + s);
                flag = true;
            }
        }
        if (!(status.getUntrackedFolders().isEmpty())) {
            console.append("\n\n> UntrackedFolders:");
            for (String s : status.getUntrackedFolders()) {
                console.append("\n" + s);
                flag = true;
            }
        }
    }
    if (!flag) {
        console.append("\nNo changes.");
    }
}

From source file:com.nlbhub.nlb.vcs.GitAdapter.java

License:Open Source License

private void initStatuses(boolean processExistentFiles) throws NLBVCSException {
    m_statuses.clear();/*from   w  w  w . j  ava  2 s. c  o  m*/
    try {
        if (processExistentFiles) {
            List<String> filePaths = listRepositoryContents();
            for (final String filePath : filePaths) {
                // Initially mark all repository files as clean
                // (i.e. under version control & without changes)
                m_statuses.put(filePath, Status.Clean);
            }
        }
        org.eclipse.jgit.api.Status status = m_git.status().call();
        putItemsStatus(status.getAdded(), Status.Added);
        putItemsStatus(status.getChanged(), Status.Modified); // ???
        putItemsStatus(status.getModified(), Status.Modified);
        putItemsStatus(status.getConflicting(), Status.Conflict);
        //System.out.println("ConflictingStageState: " + status.getConflictingStageState());
        putItemsStatus(status.getIgnoredNotInIndex(), Status.Ignored);
        putItemsStatus(status.getMissing(), Status.Missing);
        putItemsStatus(status.getRemoved(), Status.Removed);
        putItemsStatus(status.getUntracked(), Status.Unknown);
        putItemsStatus(status.getUntrackedFolders(), Status.Unknown);
    } catch (IOException | GitAPIException e) {
        throw new NLBVCSException("Error while obtaining Git repository status", e);
    }
}

From source file:edu.nju.cs.inform.jgit.porcelain.ShowStatus.java

License:Apache License

public static void main(String[] args) throws IOException, GitAPIException {
    try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
        try (Git git = new Git(repository)) {
            Status status = git.status().call();
            System.out.println("Added: " + status.getAdded());
            System.out.println("Changed: " + status.getChanged());
            System.out.println("Conflicting: " + status.getConflicting());
            System.out.println("ConflictingStageState: " + status.getConflictingStageState());
            System.out.println("IgnoredNotInIndex: " + status.getIgnoredNotInIndex());
            System.out.println("Missing: " + status.getMissing());
            System.out.println("Modified: " + status.getModified());
            System.out.println("Removed: " + status.getRemoved());
            System.out.println("Untracked: " + status.getUntracked());
            System.out.println("UntrackedFolders: " + status.getUntrackedFolders());
        }// w  w w .  j  av a2  s.co m
    }
}

From source file:gov.va.isaac.sync.git.SyncServiceGIT.java

License:Apache License

private String statusToString(Status status) {
    StringBuilder sb = new StringBuilder();
    sb.append("Is clean: " + status.isClean() + eol);
    sb.append("Changed: " + status.getChanged() + eol);
    sb.append("Added: " + status.getAdded() + eol);
    sb.append("Conflicting: " + status.getConflicting() + eol);
    sb.append("Ignored, unindexed: " + status.getIgnoredNotInIndex() + eol);
    sb.append("Missing: " + status.getMissing() + eol);
    sb.append("Modified: " + status.getModified() + eol);
    sb.append("Removed: " + status.getRemoved() + eol);
    sb.append("UncomittedChanges: " + status.getUncommittedChanges() + eol);
    sb.append("Untracked: " + status.getUntracked() + eol);
    sb.append("UntrackedFolders: " + status.getUntrackedFolders() + eol);
    return sb.toString();
}

From source file:org.debian.dependency.sources.TestJGitSource.java

License:Apache License

/**
 * We should be able to create a git repo over top of other version control systems, public void testInitOtherVcs() throws
 * Exception { }/*from   w  w  w . j  av  a  2s.co m*/
 *
 * /** When cleaning the source, we must take into account all types of dirty file states.
 */
@Test
public void testClean() throws Exception {
    Git git = Git.open(directory);

    File.createTempFile("unchanged", "file", directory);

    File subChanged = new File(new File(directory, "directory"), "changed");
    subChanged.getParentFile().mkdirs();
    subChanged.createNewFile();
    File changed = File.createTempFile("changed", "file", directory);

    git.add().addFilepattern(".").call();
    git.commit().setMessage("Prepare for test").call();

    source.initialize(directory, ORIGIN);

    Files.write("some data", subChanged, Charset.defaultCharset());
    Files.write("more data", changed, Charset.defaultCharset());
    File.createTempFile("new", "file", directory);

    File untrackedDir = new File(directory, "untracked");
    untrackedDir.mkdirs();
    File.createTempFile("another", "file", untrackedDir);

    source.clean();

    Status status = git.status().call();
    assertThat(status.getUntracked(), hasSize(0));
    assertThat(status.getUntrackedFolders(), hasSize(0));
    assertThat(status.getIgnoredNotInIndex(), hasSize(0));
    assertTrue("No changes", status.isClean());
}

From source file:sh.isaac.provider.sync.git.SyncServiceGIT.java

License:Apache License

/**
 * Status to string./*from   w  w w  .j  a  va2 s.  co m*/
 *
 * @param status the status
 * @return the string
 */
private String statusToString(Status status) {
    final StringBuilder sb = new StringBuilder();

    sb.append(" Is clean: ").append(status.isClean()).append(String.format("%n"));
    sb.append(" Changed: ").append(status.getChanged()).append(String.format("%n"));
    sb.append(" Added: ").append(status.getAdded()).append(String.format("%n"));
    sb.append(" Conflicting: ").append(status.getConflicting()).append(String.format("%n"));
    sb.append(" Ignored, unindexed: ").append(status.getIgnoredNotInIndex()).append(String.format("%n"));
    sb.append(" Missing: ").append(status.getMissing()).append(String.format("%n"));
    sb.append(" Modified: ").append(status.getModified()).append(String.format("%n"));
    sb.append(" Removed: ").append(status.getRemoved()).append(String.format("%n"));
    sb.append(" UncomittedChanges: ").append(status.getUncommittedChanges()).append(String.format("%n"));
    sb.append(" Untracked: ").append(status.getUntracked()).append(String.format("%n"));
    sb.append(" UntrackedFolders: ").append(status.getUntrackedFolders()).append(String.format("%n"));
    return sb.toString();
}