Mercurial > jhg
diff src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 229:1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 31 May 2011 05:23:07 +0200 |
parents | 26ad7827a62d |
children | 3fbfce107f94 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgStatusCollector.java Fri May 27 03:01:26 2011 +0200 +++ b/src/org/tmatesoft/hg/repo/HgStatusCollector.java Tue May 31 05:23:07 2011 +0200 @@ -56,7 +56,7 @@ private final Pool<Nodeid> cacheNodes; private final Pool<String> cacheFilenames; // XXX in fact, need to think if use of PathPool directly instead is better solution private final ManifestRevisionInspector emptyFakeState; - private Path.Matcher scope; + private Path.Matcher scope = new Path.Matcher.Any(); public HgStatusCollector(HgRepository hgRepo) { @@ -152,7 +152,15 @@ public void setPathPool(PathPool pathPool) { this.pathPool = pathPool; } - + + /** + * Limit activity of the collector to certain sub-tree of the repository. + * @param scopeMatcher tells whether collector shall report specific path, can be <code>null</code> + */ + public void setScope(Path.Matcher scopeMatcher) { + // do not assign null, ever + scope = scopeMatcher == null ? new Path.Matcher.Any() : scopeMatcher; + } // hg status --change <rev> public void change(int rev, HgStatusInspector inspector) { @@ -217,16 +225,7 @@ r2 = get(rev2); PathPool pp = getPathPool(); - TreeSet<String> r1Files = new TreeSet<String>(r1.files()); - class MatchAny implements Path.Matcher { - public boolean accept(Path path) { - return true; - } - }; - if (scope == null) { - scope = new MatchAny(); // FIXME configure from outside - } for (String fname : r2.files()) { final Path r2filePath = pp.path(fname); if (!scope.accept(r2filePath)) {