Mercurial > jhg
annotate src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 236:883300108179
Speed up branches calculation when cached branch information is available
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> | 
|---|---|
| date | Thu, 09 Jun 2011 06:13:43 +0200 | 
| parents | 1ec6b327a6ac | 
| children | 3fbfce107f94 | 
| rev | line source | 
|---|---|
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
1 /* | 
| 
74
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
2 * Copyright (c) 2011 TMate Software Ltd | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
3 * | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
4 * This program is free software; you can redistribute it and/or modify | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
5 * it under the terms of the GNU General Public License as published by | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
6 * the Free Software Foundation; version 2 of the License. | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
7 * | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
8 * This program is distributed in the hope that it will be useful, | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
11 * GNU General Public License for more details. | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
12 * | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
13 * For information on how to redistribute this software under | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
14 * the terms of a license other than GNU General Public License | 
| 
102
 
a3a2e5deb320
Updated contact address to support@hg4j.com
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
94 
diff
changeset
 | 
15 * contact TMate Software at support@hg4j.com | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
16 */ | 
| 
74
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
17 package org.tmatesoft.hg.repo; | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
18 | 
| 
74
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
19 import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION; | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
20 import static org.tmatesoft.hg.repo.HgRepository.TIP; | 
| 
68
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
21 | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
22 import java.util.Collection; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
23 import java.util.Collections; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
24 import java.util.LinkedHashMap; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
25 import java.util.LinkedList; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
26 import java.util.List; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
27 import java.util.Map; | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
28 import java.util.SortedMap; | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
29 import java.util.TreeMap; | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
30 import java.util.TreeSet; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
31 | 
| 
157
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
32 import org.tmatesoft.hg.core.HgDataStreamException; | 
| 
74
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
33 import org.tmatesoft.hg.core.Nodeid; | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
34 import org.tmatesoft.hg.internal.Pool; | 
| 
133
 
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
102 
diff
changeset
 | 
35 import org.tmatesoft.hg.util.Path; | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
36 import org.tmatesoft.hg.util.PathPool; | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
37 import org.tmatesoft.hg.util.PathRewrite; | 
| 
74
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
38 | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
39 | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
40 /** | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
41 * RevisionWalker? | 
| 
74
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
42 * | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
43 * @author Artem Tikhomirov | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
44 * @author TMate Software Ltd. | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
45 */ | 
| 
94
 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
93 
diff
changeset
 | 
46 public class HgStatusCollector { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
47 | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
48 private final HgRepository repo; | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
49 private final SortedMap<Integer, ManifestRevisionInspector> cache; // sparse array, in fact | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
50 // with cpython repository, ~70 000 changes, complete Log (direct out, no reverse) output | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
51 // no cache limit, no nodeids and fname caching - OOME on changeset 1035 | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
52 // no cache limit, but with cached nodeids and filenames - 1730+ | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
53 // cache limit 100 - 19+ minutes to process 10000, and still working (too long, stopped) | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
54 private final int cacheMaxSize = 50; // do not keep too much manifest revisions | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
55 private PathPool pathPool; | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
56 private final Pool<Nodeid> cacheNodes; | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
57 private final Pool<String> cacheFilenames; // XXX in fact, need to think if use of PathPool directly instead is better solution | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
58 private final ManifestRevisionInspector emptyFakeState; | 
| 
229
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
59 private Path.Matcher scope = new Path.Matcher.Any(); | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
60 | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
61 | 
| 
94
 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
93 
diff
changeset
 | 
62 public HgStatusCollector(HgRepository hgRepo) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
63 this.repo = hgRepo; | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
64 cache = new TreeMap<Integer, ManifestRevisionInspector>(); | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
65 cacheNodes = new Pool<Nodeid>(); | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
66 cacheFilenames = new Pool<String>(); | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
67 | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
68 emptyFakeState = new ManifestRevisionInspector(null, null); | 
| 
222
 
373e07cd3991
Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
221 
diff
changeset
 | 
69 emptyFakeState.begin(-1, null, -1); | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
70 emptyFakeState.end(-1); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
71 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
72 | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
73 public HgRepository getRepo() { | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
74 return repo; | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
75 } | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
76 | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
77 private ManifestRevisionInspector get(int rev) { | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
78 ManifestRevisionInspector i = cache.get(rev); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
79 if (i == null) { | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
80 if (rev == -1) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
81 return emptyFakeState; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
82 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
83 while (cache.size() > cacheMaxSize) { | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
84 // assume usually we go from oldest to newest, hence remove oldest as most likely to be no longer necessary | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
85 cache.remove(cache.firstKey()); | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
86 } | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
87 i = new ManifestRevisionInspector(cacheNodes, cacheFilenames); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
88 cache.put(rev, i); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
89 repo.getManifest().walk(rev, rev, i); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
90 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
91 return i; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
92 } | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
93 | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
94 private boolean cached(int revision) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
95 return cache.containsKey(revision) || revision == -1; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
96 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
97 | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
98 private void initCacheRange(int minRev, int maxRev) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
99 while (cache.size() > cacheMaxSize) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
100 // assume usually we go from oldest to newest, hence remove oldest as most likely to be no longer necessary | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
101 cache.remove(cache.firstKey()); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
102 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
103 repo.getManifest().walk(minRev, maxRev, new HgManifest.Inspector() { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
104 private ManifestRevisionInspector delegate; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
105 private boolean cacheHit; // range may include revisions we already know about, do not re-create them | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
106 | 
| 
222
 
373e07cd3991
Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
221 
diff
changeset
 | 
107 public boolean begin(int manifestRevision, Nodeid nid, int changelogRevision) { | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
108 assert delegate == null; | 
| 
222
 
373e07cd3991
Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
221 
diff
changeset
 | 
109 if (cache.containsKey(changelogRevision)) { // don't need to check emptyFakeState hit as revision never -1 here | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
110 cacheHit = true; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
111 } else { | 
| 
222
 
373e07cd3991
Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
221 
diff
changeset
 | 
112 cache.put(changelogRevision, delegate = new ManifestRevisionInspector(cacheNodes, cacheFilenames)); | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
113 // cache may grow bigger than max size here, but it's ok as present simplistic cache clearing mechanism may | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
114 // otherwise remove entries we just added | 
| 
222
 
373e07cd3991
Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
221 
diff
changeset
 | 
115 delegate.begin(manifestRevision, nid, changelogRevision); | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
116 cacheHit = false; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
117 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
118 return true; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
119 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
120 | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
121 public boolean next(Nodeid nid, String fname, String flags) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
122 if (!cacheHit) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
123 delegate.next(nid, fname, flags); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
124 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
125 return true; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
126 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
127 | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
128 public boolean end(int revision) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
129 if (!cacheHit) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
130 delegate.end(revision); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
131 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
132 cacheHit = false; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
133 delegate = null; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
134 return true; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
135 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
136 }); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
137 } | 
| 
56
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
138 | 
| 
59
 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
56 
diff
changeset
 | 
139 /*package-local*/ ManifestRevisionInspector raw(int rev) { | 
| 
 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
56 
diff
changeset
 | 
140 return get(rev); | 
| 
 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
56 
diff
changeset
 | 
141 } | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
142 /*package-local*/ PathPool getPathPool() { | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
143 if (pathPool == null) { | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
144 pathPool = new PathPool(new PathRewrite.Empty()); | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
145 } | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
146 return pathPool; | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
147 } | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
148 | 
| 
142
 
37a34044e6bd
More reasonable use of path normalizer and path.source
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
141 
diff
changeset
 | 
149 /** | 
| 
 
37a34044e6bd
More reasonable use of path normalizer and path.source
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
141 
diff
changeset
 | 
150 * Allows sharing of a common path cache | 
| 
 
37a34044e6bd
More reasonable use of path normalizer and path.source
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
141 
diff
changeset
 | 
151 */ | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
152 public void setPathPool(PathPool pathPool) { | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
153 this.pathPool = pathPool; | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
154 } | 
| 
229
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
155 | 
| 
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
156 /** | 
| 
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
157 * Limit activity of the collector to certain sub-tree of the repository. | 
| 
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
158 * @param scopeMatcher tells whether collector shall report specific path, can be <code>null</code> | 
| 
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
159 */ | 
| 
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
160 public void setScope(Path.Matcher scopeMatcher) { | 
| 
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
161 // do not assign null, ever | 
| 
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
162 scope = scopeMatcher == null ? new Path.Matcher.Any() : scopeMatcher; | 
| 
 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
226 
diff
changeset
 | 
163 } | 
| 
59
 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
56 
diff
changeset
 | 
164 | 
| 
56
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
165 // hg status --change <rev> | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
166 public void change(int rev, HgStatusInspector inspector) { | 
| 
56
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
167 int[] parents = new int[2]; | 
| 
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
168 repo.getChangelog().parents(rev, parents, null, null); | 
| 
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
169 walk(parents[0], rev, inspector); | 
| 
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
170 } | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
171 | 
| 
56
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
172 // I assume revision numbers are the same for changelog and manifest - here | 
| 
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
173 // user would like to pass changelog revision numbers, and I use them directly to walk manifest. | 
| 
 
576d6e8a09f6
Analog of 'hg status --change' command
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
55 
diff
changeset
 | 
174 // if this assumption is wrong, fix this (lookup manifest revisions from changeset). | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
175 // rev1 and rev2 may be -1 to indicate comparison to empty repository | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
176 // argument order matters | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
177 public void walk(int rev1, int rev2, HgStatusInspector inspector) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
178 if (rev1 == rev2) { | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
179 throw new IllegalArgumentException(); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
180 } | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
181 if (inspector == null) { | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
182 throw new IllegalArgumentException(); | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
183 } | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
184 if (inspector instanceof Record) { | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
185 ((Record) inspector).init(rev1, rev2, this); | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
186 } | 
| 
218
 
047b1dec7a04
Issue 7: Correctly handle manifest and changelog with different number of (or non-matching) revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
197 
diff
changeset
 | 
187 final int lastManifestRevision = repo.getChangelog().getLastRevision(); | 
| 
68
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
188 if (rev1 == TIP) { | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
189 rev1 = lastManifestRevision; | 
| 
68
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
190 } | 
| 
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
191 if (rev2 == TIP) { | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
192 rev2 = lastManifestRevision; | 
| 
68
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
193 } | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
194 // in fact, rev1 and rev2 are often next (or close) to each other, | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
195 // thus, we can optimize Manifest reads here (manifest.walk(rev1, rev2)) | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
196 ManifestRevisionInspector r1, r2 ; | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
197 boolean need1 = !cached(rev1), need2 = !cached(rev2); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
198 if (need1 || need2) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
199 int minRev, maxRev; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
200 if (need1 && need2 && Math.abs(rev1 - rev2) < 5 /*subjective equivalent of 'close enough'*/) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
201 minRev = rev1 < rev2 ? rev1 : rev2; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
202 maxRev = minRev == rev1 ? rev2 : rev1; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
203 if (minRev > 0) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
204 minRev--; // expand range a bit | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
205 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
206 initCacheRange(minRev, maxRev); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
207 need1 = need2 = false; | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
208 } | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
209 // either both unknown and far from each other, or just one of them. | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
210 // read with neighbors to save potential subsequent calls for neighboring elements | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
211 // XXX perhaps, if revlog.baseRevision is cheap, shall expand minRev up to baseRevision | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
212 // which going to be read anyway | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
213 if (need1) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
214 minRev = rev1; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
215 maxRev = rev1 < lastManifestRevision-5 ? rev1+5 : lastManifestRevision; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
216 initCacheRange(minRev, maxRev); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
217 } | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
218 if (need2) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
219 minRev = rev2; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
220 maxRev = rev2 < lastManifestRevision-5 ? rev2+5 : lastManifestRevision; | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
221 initCacheRange(minRev, maxRev); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
222 } | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
223 } | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
224 r1 = get(rev1); | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
225 r2 = get(rev2); | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
226 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
227 PathPool pp = getPathPool(); | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
228 TreeSet<String> r1Files = new TreeSet<String>(r1.files()); | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
229 for (String fname : r2.files()) { | 
| 
226
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
230 final Path r2filePath = pp.path(fname); | 
| 
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
231 if (!scope.accept(r2filePath)) { | 
| 
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
232 continue; | 
| 
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
233 } | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
234 if (r1Files.remove(fname)) { | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
235 Nodeid nidR1 = r1.nodeid(fname); | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
236 Nodeid nidR2 = r2.nodeid(fname); | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
237 String flagsR1 = r1.flags(fname); | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
238 String flagsR2 = r2.flags(fname); | 
| 
221
 
04735ce6bed2
NPE when one of the flags is non-null
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
218 
diff
changeset
 | 
239 if (nidR1.equals(nidR2) && ((flagsR2 == null && flagsR1 == null) || (flagsR2 != null && flagsR2.equals(flagsR1)))) { | 
| 
226
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
240 inspector.clean(r2filePath); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
241 } else { | 
| 
226
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
242 inspector.modified(r2filePath); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
243 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
244 } else { | 
| 
157
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
245 try { | 
| 
226
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
246 Path copyTarget = r2filePath; | 
| 
157
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
247 Path copyOrigin = getOriginIfCopy(repo, copyTarget, r1Files, rev1); | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
248 if (copyOrigin != null) { | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
249 inspector.copied(pp.path(copyOrigin) /*pipe through pool, just in case*/, copyTarget); | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
250 } else { | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
251 inspector.added(copyTarget); | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
252 } | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
253 } catch (HgDataStreamException ex) { | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
254 ex.printStackTrace(); | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
255 // FIXME perhaps, shall record this exception to dedicated mediator and continue | 
| 
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
256 // for a single file not to be irresolvable obstacle for a status operation | 
| 
88
 
61eedab3eb3e
Status between two revisions to recognize copy/rename
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
74 
diff
changeset
 | 
257 } | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
258 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
259 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
260 for (String left : r1Files) { | 
| 
226
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
261 final Path r2filePath = pp.path(left); | 
| 
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
262 if (scope.accept(r2filePath)) { | 
| 
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
263 inspector.removed(r2filePath); | 
| 
 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
222 
diff
changeset
 | 
264 } | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
265 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
266 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
267 | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
268 public Record status(int rev1, int rev2) { | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
269 Record rv = new Record(); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
270 walk(rev1, rev2, rv); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
271 return rv; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
272 } | 
| 
90
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
273 | 
| 
157
 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
142 
diff
changeset
 | 
274 /*package-local*/static Path getOriginIfCopy(HgRepository hgRepo, Path fname, Collection<String> originals, int originalChangelogRevision) throws HgDataStreamException { | 
| 
90
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
275 HgDataFile df = hgRepo.getFileNode(fname); | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
276 while (df.isCopy()) { | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
277 Path original = df.getCopySourceName(); | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
278 if (originals.contains(original.toString())) { | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
279 df = hgRepo.getFileNode(original); | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
280 int changelogRevision = df.getChangesetLocalRevision(0); | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
281 if (changelogRevision <= originalChangelogRevision) { | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
282 // copy/rename source was known prior to rev1 | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
283 // (both r1Files.contains is true and original was created earlier than rev1) | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
284 // without r1Files.contains changelogRevision <= rev1 won't suffice as the file | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
285 // might get removed somewhere in between (changelogRevision < R < rev1) | 
| 
141
 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
135 
diff
changeset
 | 
286 return original; | 
| 
90
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
287 } | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
288 break; // copy/rename done later | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
289 } | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
290 df = hgRepo.getFileNode(original); // try more steps away | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
291 } | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
292 return null; | 
| 
 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
89 
diff
changeset
 | 
293 } | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
294 | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
295 // XXX for r1..r2 status, only modified, added, removed (and perhaps, clean) make sense | 
| 
74
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
296 // XXX Need to specify whether copy targets are in added or not (@see Inspector#copied above) | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
297 public static class Record implements HgStatusInspector { | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
298 private List<Path> modified, added, removed, clean, missing, unknown, ignored; | 
| 
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
299 private Map<Path, Path> copied; | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
300 | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
301 private int startRev, endRev; | 
| 
94
 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
93 
diff
changeset
 | 
302 private HgStatusCollector statusHelper; | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
303 | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
304 // XXX StatusCollector may additionally initialize Record instance to speed lookup of changed file revisions | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
305 // here I need access to ManifestRevisionInspector via #raw(). Perhaps, non-static class (to get | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
306 // implicit reference to StatusCollector) may be better? | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
307 // Since users may want to reuse Record instance we've once created (and initialized), we need to | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
308 // ensure functionality is correct for each/any call (#walk checks instanceof Record and fixes it up) | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
309 // Perhaps, distinct helper (sc.getRevisionHelper().nodeid(fname)) would be better, just not clear | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
310 // how to supply [start..end] values there easily | 
| 
94
 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
93 
diff
changeset
 | 
311 /*package-local*/void init(int startRevision, int endRevision, HgStatusCollector self) { | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
312 startRev = startRevision; | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
313 endRev = endRevision; | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
314 statusHelper = self; | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
315 } | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
316 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
317 public Nodeid nodeidBeforeChange(Path fname) { | 
| 
68
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
318 if (statusHelper == null || startRev == BAD_REVISION) { | 
| 
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
319 return null; | 
| 
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
320 } | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
321 if ((modified == null || !modified.contains(fname)) && (removed == null || !removed.contains(fname))) { | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
322 return null; | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
323 } | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
324 return statusHelper.raw(startRev).nodeid(fname.toString()); | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
325 } | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
326 public Nodeid nodeidAfterChange(Path fname) { | 
| 
68
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
327 if (statusHelper == null || endRev == BAD_REVISION) { | 
| 
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
328 return null; | 
| 
 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
64 
diff
changeset
 | 
329 } | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
330 if ((modified == null || !modified.contains(fname)) && (added == null || !added.contains(fname))) { | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
331 return null; | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
332 } | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
333 return statusHelper.raw(endRev).nodeid(fname.toString()); | 
| 
64
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
334 } | 
| 
 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
59 
diff
changeset
 | 
335 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
336 public List<Path> getModified() { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
337 return proper(modified); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
338 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
339 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
340 public List<Path> getAdded() { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
341 return proper(added); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
342 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
343 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
344 public List<Path> getRemoved() { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
345 return proper(removed); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
346 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
347 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
348 public Map<Path,Path> getCopied() { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
349 if (copied == null) { | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
350 return Collections.emptyMap(); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
351 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
352 return Collections.unmodifiableMap(copied); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
353 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
354 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
355 public List<Path> getClean() { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
356 return proper(clean); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
357 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
358 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
359 public List<Path> getMissing() { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
360 return proper(missing); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
361 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
362 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
363 public List<Path> getUnknown() { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
364 return proper(unknown); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
365 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
366 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
367 public List<Path> getIgnored() { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
368 return proper(ignored); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
369 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
370 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
371 private List<Path> proper(List<Path> l) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
372 if (l == null) { | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
373 return Collections.emptyList(); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
374 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
375 return Collections.unmodifiableList(l); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
376 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
377 | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
378 // | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
379 // | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
380 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
381 public void modified(Path fname) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
382 modified = doAdd(modified, fname); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
383 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
384 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
385 public void added(Path fname) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
386 added = doAdd(added, fname); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
387 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
388 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
389 public void copied(Path fnameOrigin, Path fnameAdded) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
390 if (copied == null) { | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
391 copied = new LinkedHashMap<Path, Path>(); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
392 } | 
| 
74
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
393 added(fnameAdded); | 
| 
 
6f1b88693d48
Complete refactoring to org.tmatesoft
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
68 
diff
changeset
 | 
394 copied.put(fnameAdded, fnameOrigin); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
395 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
396 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
397 public void removed(Path fname) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
398 removed = doAdd(removed, fname); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
399 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
400 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
401 public void clean(Path fname) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
402 clean = doAdd(clean, fname); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
403 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
404 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
405 public void missing(Path fname) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
406 missing = doAdd(missing, fname); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
407 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
408 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
409 public void unknown(Path fname) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
410 unknown = doAdd(unknown, fname); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
411 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
412 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
413 public void ignored(Path fname) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
414 ignored = doAdd(ignored, fname); | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
415 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
416 | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
417 private static List<Path> doAdd(List<Path> l, Path p) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
418 if (l == null) { | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
419 l = new LinkedList<Path>(); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
420 } | 
| 
93
 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
90 
diff
changeset
 | 
421 l.add(p); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
422 return l; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
423 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
424 } | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
425 | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
426 /*package-local*/ static final class ManifestRevisionInspector implements HgManifest.Inspector { | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
427 private final TreeMap<String, Nodeid> idsMap; | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
428 private final TreeMap<String, String> flagsMap; | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
429 private final Pool<Nodeid> idsPool; | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
430 private final Pool<String> namesPool; | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
431 | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
432 // optional pools for effective management of nodeids and filenames (they are likely | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
433 // to be duplicated among different manifest revisions | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
434 public ManifestRevisionInspector(Pool<Nodeid> nodeidPool, Pool<String> filenamePool) { | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
435 idsPool = nodeidPool; | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
436 namesPool = filenamePool; | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
437 idsMap = new TreeMap<String, Nodeid>(); | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
438 flagsMap = new TreeMap<String, String>(); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
439 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
440 | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
441 public Collection<String> files() { | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
442 return idsMap.keySet(); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
443 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
444 | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
445 public Nodeid nodeid(String fname) { | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
446 return idsMap.get(fname); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
447 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
448 | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
449 public String flags(String fname) { | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
450 return flagsMap.get(fname); | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
451 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
452 | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
453 // | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
454 | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
455 public boolean next(Nodeid nid, String fname, String flags) { | 
| 
195
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
456 if (namesPool != null) { | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
457 fname = namesPool.unify(fname); | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
458 } | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
459 if (idsPool != null) { | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
460 nid = idsPool.unify(nid); | 
| 
 
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
157 
diff
changeset
 | 
461 } | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
462 idsMap.put(fname, nid); | 
| 
197
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
463 if (flags != null) { | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
464 // TreeMap$Entry takes 32 bytes. No reason to keep null for such price | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
465 // Perhaps, Map<String, Pair<Nodeid, String>> might be better solution | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
466 flagsMap.put(fname, flags); | 
| 
 
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
195 
diff
changeset
 | 
467 } | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
468 return true; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
469 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
470 | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
471 public boolean end(int revision) { | 
| 
89
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
472 // in fact, this class cares about single revision | 
| 
 
42bcb4bffd17
Refactored to simplify manifest collector
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
88 
diff
changeset
 | 
473 return false; | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
474 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
475 | 
| 
222
 
373e07cd3991
Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents: 
221 
diff
changeset
 | 
476 public boolean begin(int revision, Nodeid nid, int changelogRevision) { | 
| 
55
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
477 return true; | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
478 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
479 } | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
480 | 
| 
 
05829a70b30b
Status operation extracted into separate, cache-friendly class
 
Artem Tikhomirov <tikhomirov.artem@gmail.com> 
parents:  
diff
changeset
 | 
481 } | 
