Branch { Iterable<Path> getModifiedPathsUntil(@NotNull final Revision r) { checkArgument(checkNotNull(r).isBranch(), "Not a branch revision: %s", r); if (!commits.containsKey(r)) { return Collections.emptyList(); } Iterable<Iterable<Path>> paths = transform(filter(commits.entrySet(), new Predicate<Map.Entry<Revision, BranchCommit>>() { @Override public boolean apply(Map.Entry<Revision, BranchCommit> input) { return !input.getValue().isRebase() && input.getKey().compareRevisionTime(r) <= 0; } }), new Function<Map.Entry<Revision, BranchCommit>, Iterable<Path>>() { @Override public Iterable<Path> apply(Map.Entry<Revision, BranchCommit> input) { return input.getValue().getModifiedPaths(); } }); return Iterables.concat(paths); } Branch(@NotNull SortedSet<Revision> commits,
           @NotNull RevisionVector base,
           @NotNull ReferenceQueue<Object> queue,
           @Nullable Object guard); void removeCommit(@NotNull Revision r); void applyTo(@NotNull UnsavedModifications trunk,
                        @NotNull Revision mergeCommit); @Nullable Revision getUnsavedLastRevision(Path path,
                                           Revision readRevision); boolean isHead(@NotNull Revision rev); @Override String toString();  }
@Test public void getModifiedPathsUntil() { UnmergedBranches branches = new UnmergedBranches(); RevisionVector base = new RevisionVector(Revision.newRevision(1)); Revision c1 = Revision.newRevision(1).asBranchRevision(); Branch b = branches.create(base, c1, null); BranchCommit bc1 = b.getCommit(c1); bc1.track(Path.fromString("/foo")); Revision c2 = Revision.newRevision(1).asBranchRevision(); b.addCommit(c2); BranchCommit bc2 = b.getCommit(c2); bc2.track(Path.fromString("/bar")); Revision c3 = Revision.newRevision(1).asBranchRevision(); b.rebase(c3, new RevisionVector(Revision.newRevision(1))); Revision c4 = Revision.newRevision(1).asBranchRevision(); b.addCommit(c4); BranchCommit bc4 = b.getCommit(c4); bc4.track(Path.fromString("/baz")); Revision c5 = Revision.newRevision(1).asBranchRevision(); try { b.getModifiedPathsUntil(Revision.newRevision(1)); fail("Must fail with IllegalArgumentException"); } catch (IllegalArgumentException e) { } assertModifiedPaths(b.getModifiedPathsUntil(c1), "/foo"); assertModifiedPaths(b.getModifiedPathsUntil(c2), "/foo", "/bar"); assertModifiedPaths(b.getModifiedPathsUntil(c3), "/foo", "/bar"); assertModifiedPaths(b.getModifiedPathsUntil(c4), "/foo", "/bar", "/baz"); assertModifiedPaths(b.getModifiedPathsUntil(c5)); }