Package org.nbgit

Examples of org.nbgit.StatusCache


        return;
    }

    @Override
    public boolean isEnabled() {
        StatusCache cache = Git.getInstance().getStatusCache();

        if (cache.listFiles(context, StatusInfo.STATUS_VERSIONED_CONFLICT).length != 0) {
            return true;
        }
        return false;
    }
View Full Code Here


    private static void perform(File file) {
        if (file == null) {
            return;
        }
        StatusCache cache = Git.getInstance().getStatusCache();

        deleteConflictFile(file.getAbsolutePath());
        cache.refresh(file, StatusCache.REPOSITORY_STATUS_UNKNOWN);
    }
View Full Code Here

            return false;
        }
        if (showDirty) {
            return true;
        }
        StatusCache cache = Git.getInstance().getStatusCache();
        return !cache.containsFileOfStatus(context, StatusInfo.STATUS_LOCAL_CHANGE);
    }
View Full Code Here

        Mnemonics.setLocalizedText(item, item.getText());
         */
        menu.add(new JSeparator());

        boolean allLocallyDeleted = true;
        StatusCache cache = Git.getInstance().getStatusCache();
        Set<File> files = GitUtils.getCurrentContext(null).getRootFiles();

        for (File file : files) {
            StatusInfo info = cache.getStatus(file);
            if (info.getStatus() != StatusInfo.STATUS_VERSIONED_DELETEDLOCALLY && info.getStatus() != StatusInfo.STATUS_VERSIONED_REMOVEDLOCALLY) {
                allLocallyDeleted = false;
            }
        }
        if (allLocallyDeleted) {
View Full Code Here

        super(name, context);
    }

    @Override
    public boolean isEnabled() {
        StatusCache cache = Git.getInstance().getStatusCache();
        return cache.containsFileOfStatus(context, StatusInfo.STATUS_LOCAL_CHANGE);
    }
View Full Code Here

        commit(contentTitle, context);
    }

    public static void commit(String contentTitle, final VCSContext ctx) {
        StatusCache cache = Git.getInstance().getStatusCache();
        File[] roots = ctx.getRootFiles().toArray(new File[ctx.getRootFiles().size()]);
        if (roots == null || roots.length == 0) {
            return;
        }
        final File repository = GitUtils.getRootFile(ctx);
        if (repository == null) {
            return;
        }
        String projName = GitProjectUtils.getProjectName(repository);
        if (projName == null) {
            File projFile = GitUtils.getProjectFile(ctx);
            projName = GitProjectUtils.getProjectName(projFile);
        }
        final String prjName = projName;

        File[][] split = Utils.splitFlatOthers(roots);
        List<File> fileList = new ArrayList<File>();
        for (int c = 0; c < split.length; c++) {
            roots = split[c];
            boolean recursive = c == 1;
            if (recursive) {
                File[] files = cache.listFiles(ctx, StatusInfo.STATUS_LOCAL_CHANGE);
                for (int i = 0; i < files.length; i++) {
                    for (int r = 0; r < roots.length; r++) {
                        if (GitUtils.isParentOrEqual(roots[r], files[i])) {
                            if (!fileList.contains(files[i])) {
                                fileList.add(files[i]);
View Full Code Here

        commit.setEnabled(enabled && containsCommitable(table));
    }

    private static void performCommit(String message, Map<GitFileNode, CommitOptions> commitFiles,
            VCSContext ctx, GitProgressSupport support, String prjName, OutputLogger logger) {
        StatusCache cache = Git.getInstance().getStatusCache();
        final File repository = GitUtils.getRootFile(ctx);
        List<File> addCandidates = new ArrayList<File>();
        List<File> deleteCandidates = new ArrayList<File>();
        int commitCandidates = 0;

        List<String> excPaths = new ArrayList<String>();
        List<String> incPaths = new ArrayList<String>();
        for (GitFileNode node : commitFiles.keySet()) {
            if (support.isCanceled()) {
                return;
            }
            CommitOptions option = commitFiles.get(node);
            if (option != CommitOptions.EXCLUDE) {
                int status = cache.getStatus(node.getFile()).getStatus();
                if ((status & StatusInfo.STATUS_NOTVERSIONED_NEWLOCALLY) != 0) {
                    addCandidates.add(node.getFile());
                } else if ((status & StatusInfo.STATUS_VERSIONED_DELETEDLOCALLY) != 0) {
                    deleteCandidates.add(node.getFile());
                } else {
                    addCandidates.add(node.getFile());
                }
                commitCandidates++;
                incPaths.add(node.getFile().getAbsolutePath());
            } else {
                excPaths.add(node.getFile().getAbsolutePath());
            }
        }
        if (support.isCanceled()) {
            return;
        }
        if (!excPaths.isEmpty()) {
            GitModuleConfig.getDefault().addExclusionPaths(excPaths);
        }
        if (!incPaths.isEmpty()) {
            GitModuleConfig.getDefault().removeExclusionPaths(incPaths);
        }
        try {
            logger.outputInRed(
                    NbBundle.getMessage(CommitAction.class,
                    "MSG_COMMIT_TITLE")); // NOI18N
            logger.outputInRed(
                    NbBundle.getMessage(CommitAction.class,
                    "MSG_COMMIT_TITLE_SEP")); // NOI18N
            logger.output(message); // NOI18N

            CommitBuilder.create(repository).
                    log(logger).
                    addAll(addCandidates).
                    deleteAll(deleteCandidates).
                    message(message).
                    write();

            if (commitCandidates == 1) {
                logger.output(
                        NbBundle.getMessage(CommitAction.class,
                        "MSG_COMMIT_INIT_SEP_ONE", commitCandidates, prjName));
            } else {
                logger.output(
                        NbBundle.getMessage(CommitAction.class,
                        "MSG_COMMIT_INIT_SEP", commitCandidates, prjName));
            }
        } catch (Exception ex) {
            notifyLater(ex);
        } finally {
            cache.refreshCached(ctx);
            logger.outputInRed(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_DONE")); // NOI18N
            logger.output(""); // NOI18N
        }
    }
View Full Code Here

        diff(context, Setup.DIFFTYPE_LOCAL, contextName);
    }

    @Override
    public boolean isEnabled() {
        StatusCache cache = Git.getInstance().getStatusCache();
        return cache.containsFileOfStatus(context, StatusInfo.STATUS_LOCAL_CHANGE);
    }
View Full Code Here

TOP

Related Classes of org.nbgit.StatusCache

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.