/** {@inheritDoc} */ @Override public Map<String, SubmoduleStatus> call() throws GitAPIException { checkCallable(); try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) { if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); Map<String, SubmoduleStatus> statuses = new HashMap<>(); while (generator.next()) { SubmoduleStatus status = getStatus(generator); statuses.put(status.getPath(), status); } return statuses; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e); } }
/** * Create a collection of path filters. * <p> * Paths may appear in any order within the collection. Sorting may be done * internally when the group is constructed if doing so will improve path * matching performance. * * @param paths * the paths to test against. Must have at least one entry. * @return a new filter for the list of paths supplied. */ public static TreeFilter create(Collection<PathFilter> paths) { if (paths.isEmpty()) throw new IllegalArgumentException( JGitText.get().atLeastOnePathIsRequired); final PathFilter[] p = new PathFilter[paths.size()]; paths.toArray(p); return create(p); }
/** * {@inheritDoc} * <p> * Executes the {@code Status} command with all the options and parameters * collected by the setter methods of this class. Each instance of this * class should only be used for one invocation of the command. Don't call * this method twice on an instance. */ @Override public Status call() throws GitAPIException, NoWorkTreeException { if (workingTreeIt == null) workingTreeIt = new FileTreeIterator(repo); try { IndexDiff diff = new IndexDiff(repo, Constants.HEAD, workingTreeIt); if (ignoreSubmoduleMode != null) diff.setIgnoreSubmoduleMode(ignoreSubmoduleMode); if (paths != null) diff.setFilter(PathFilterGroup.createFromStrings(paths)); if (progressMonitor == null) diff.diff(); else diff.diff(progressMonitor, ProgressMonitor.UNKNOWN, ProgressMonitor.UNKNOWN, ""); //$NON-NLS-1$ return new Status(diff); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }
/** * Create a collection of path filters from Java strings. * <p> * Path strings are relative to the root of the repository. If the user's * input should be assumed relative to a subdirectory of the repository the * caller must prepend the subdirectory's path prior to creating the filter. * <p> * Path strings use '/' to delimit directories on all platforms. * <p> * Paths may appear in any order within the collection. Sorting may be done * internally when the group is constructed if doing so will improve path * matching performance. * * @param paths * the paths to test against. Must have at least one entry. * @return a new filter for the list of paths supplied. */ public static TreeFilter createFromStrings(Collection<String> paths) { if (paths.isEmpty()) throw new IllegalArgumentException( JGitText.get().atLeastOnePathIsRequired); final PathFilter[] p = new PathFilter[paths.size()]; int i = 0; for (String s : paths) p[i++] = PathFilter.create(s); return create(p); }
generator.setFilter(PathFilterGroup.createFromStrings(paths)); StoredConfig config = repo.getConfig(); List<String> initialized = new ArrayList<>();
/** * Create a collection of path filters from Java strings. * <p> * Path strings are relative to the root of the repository. If the user's * input should be assumed relative to a subdirectory of the repository the * caller must prepend the subdirectory's path prior to creating the filter. * <p> * Path strings use '/' to delimit directories on all platforms. * <p> * Paths may appear in any order. Sorting may be done internally when the * group is constructed if doing so will improve path matching performance. * * @param paths * the paths to test against. Must have at least one entry. * @return a new filter for the paths supplied. */ public static TreeFilter createFromStrings(String... paths) { if (paths.length == 0) throw new IllegalArgumentException( JGitText.get().atLeastOnePathIsRequired); final int length = paths.length; final PathFilter[] p = new PathFilter[length]; for (int i = 0; i < length; i++) p[i] = PathFilter.create(paths[i]); return create(p); }
try (RevWalk revWalk = new RevWalk(repo); SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) { generator.setFilter(PathFilterGroup.createFromStrings(paths)); StoredConfig config = repo.getConfig(); while (generator.next()) {
private static TreeFilter group(final String... paths) { final int length = paths.length; final List<PathFilter> filters = new ArrayList<PathFilter>(length); for (int i = 0; i < length; i++) filters.add(PathFilter.create(paths[i])); return PathFilterGroup.create(filters); }
/** * Set the paths which are interesting and should be highlighted in the view. * @param interestingPaths */ void setInterestingPaths(Set<String> interestingPaths) { if (interestingPaths != null) this.markTreeFilter = PathFilterGroup.createFromStrings(interestingPaths); else this.markTreeFilter = TreeFilter.ALL; // FileDiffs need to be updated this.diff = null; }
if (pathFilters.size() > 0) walk.setTreeFilter(AndTreeFilter.create( PathFilterGroup.create(pathFilters), TreeFilter.ANY_DIFF)); if (skip > -1 && maxCount > -1) walk.setRevFilter(AndRevFilter.create(SkipRevFilter.create(skip),
generator.setFilter(PathFilterGroup.createFromStrings(paths)); Map<String, String> synced = new HashMap<>(); StoredConfig config = repo.getConfig();
/** * Create a collection of path filters. * <p> * Paths may appear in any order within the collection. Sorting may be done * internally when the group is constructed if doing so will improve path * matching performance. * * @param paths * the paths to test against. Must have at least one entry. * @return a new filter for the list of paths supplied. */ public static TreeFilter create(final Collection<PathFilter> paths) { if (paths.isEmpty()) throw new IllegalArgumentException( JGitText.get().atLeastOnePathIsRequired); final PathFilter[] p = new PathFilter[paths.size()]; paths.toArray(p); return create(p); }
walk.setFilter(PathFilterGroup.createFromStrings(paths));
/** * Create a collection of path filters. * <p> * Paths may appear in any order within the collection. Sorting may be done * internally when the group is constructed if doing so will improve path * matching performance. * * @param paths * the paths to test against. Must have at least one entry. * @return a new filter for the list of paths supplied. */ public static TreeFilter create(Collection<PathFilter> paths) { if (paths.isEmpty()) throw new IllegalArgumentException( JGitText.get().atLeastOnePathIsRequired); final PathFilter[] p = new PathFilter[paths.size()]; paths.toArray(p); return create(p); }
if (paths.isEmpty()) return; walk.setFilter(PathFilterGroup.createFromStrings(paths));
private TreeFilter createPathFilter(final Collection<? extends IResource> rs) { if (rs == null || rs.isEmpty()) return null; final List<PathFilter> filters = new ArrayList<PathFilter>(); for (IResource r : rs) { RepositoryMapping rm = RepositoryMapping.getMapping(r); String repoRelativePath = rm.getRepoRelativePath(r); if (repoRelativePath != null) if (repoRelativePath.equals("")) //$NON-NLS-1$ // repository selected return TreeFilter.ALL; else filters.add(PathFilter.create(repoRelativePath)); } if (filters.size() == 0) return null; if (filters.size() == 1) return filters.get(0); return PathFilterGroup.create(filters); }
tw.setFilter(PathFilterGroup.createFromStrings(filepatterns)); tw.addTree(new DirCacheBuildIterator(builder));
/** * Create a collection of path filters from Java strings. * <p> * Path strings are relative to the root of the repository. If the user's * input should be assumed relative to a subdirectory of the repository the * caller must prepend the subdirectory's path prior to creating the filter. * <p> * Path strings use '/' to delimit directories on all platforms. * <p> * Paths may appear in any order within the collection. Sorting may be done * internally when the group is constructed if doing so will improve path * matching performance. * * @param paths * the paths to test against. Must have at least one entry. * @return a new filter for the list of paths supplied. */ public static TreeFilter createFromStrings(final Collection<String> paths) { if (paths.isEmpty()) throw new IllegalArgumentException( JGitText.get().atLeastOnePathIsRequired); final PathFilter[] p = new PathFilter[paths.size()]; int i = 0; for (final String s : paths) p[i++] = PathFilter.create(s); return create(p); }
treeWalk.setRecursive(true); if (!checkoutAllPaths) treeWalk.setFilter(PathFilterGroup.createFromStrings(paths)); if (isCheckoutIndex()) checkoutPathsFromIndex(treeWalk, dc);
/** * Create a collection of path filters from Java strings. * <p> * Path strings are relative to the root of the repository. If the user's * input should be assumed relative to a subdirectory of the repository the * caller must prepend the subdirectory's path prior to creating the filter. * <p> * Path strings use '/' to delimit directories on all platforms. * <p> * Paths may appear in any order within the collection. Sorting may be done * internally when the group is constructed if doing so will improve path * matching performance. * * @param paths * the paths to test against. Must have at least one entry. * @return a new filter for the list of paths supplied. */ public static TreeFilter createFromStrings(Collection<String> paths) { if (paths.isEmpty()) throw new IllegalArgumentException( JGitText.get().atLeastOnePathIsRequired); final PathFilter[] p = new PathFilter[paths.size()]; int i = 0; for (String s : paths) p[i++] = PathFilter.create(s); return create(p); }