comparison src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 248:3fbfce107f94

Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 12 Aug 2011 18:48:57 +0200
parents ff4fdbab4e2d
children 6d1804fe0ed7
comparison
equal deleted inserted replaced
247:f052f40839ec 248:3fbfce107f94
35 import org.tmatesoft.hg.core.HgException; 35 import org.tmatesoft.hg.core.HgException;
36 import org.tmatesoft.hg.core.Nodeid; 36 import org.tmatesoft.hg.core.Nodeid;
37 import org.tmatesoft.hg.internal.ByteArrayChannel; 37 import org.tmatesoft.hg.internal.ByteArrayChannel;
38 import org.tmatesoft.hg.internal.Experimental; 38 import org.tmatesoft.hg.internal.Experimental;
39 import org.tmatesoft.hg.internal.FilterByteChannel; 39 import org.tmatesoft.hg.internal.FilterByteChannel;
40 import org.tmatesoft.hg.internal.ManifestRevision;
40 import org.tmatesoft.hg.internal.PathScope; 41 import org.tmatesoft.hg.internal.PathScope;
41 import org.tmatesoft.hg.repo.HgStatusCollector.ManifestRevisionInspector;
42 import org.tmatesoft.hg.util.ByteChannel; 42 import org.tmatesoft.hg.util.ByteChannel;
43 import org.tmatesoft.hg.util.CancelledException; 43 import org.tmatesoft.hg.util.CancelledException;
44 import org.tmatesoft.hg.util.FileIterator; 44 import org.tmatesoft.hg.util.FileIterator;
45 import org.tmatesoft.hg.util.FileWalker; 45 import org.tmatesoft.hg.util.FileWalker;
46 import org.tmatesoft.hg.util.Path; 46 import org.tmatesoft.hg.util.Path;
113 baseRevision = repo.getChangelog().getLastRevision(); 113 baseRevision = repo.getChangelog().getLastRevision();
114 isTipBase = true; 114 isTipBase = true;
115 } else { 115 } else {
116 isTipBase = baseRevision == repo.getChangelog().getLastRevision(); 116 isTipBase = baseRevision == repo.getChangelog().getLastRevision();
117 } 117 }
118 HgStatusCollector.ManifestRevisionInspector collect = null; 118 ManifestRevision collect = null;
119 Set<String> baseRevFiles = Collections.emptySet(); // files from base revision not affected by status calculation 119 Set<String> baseRevFiles = Collections.emptySet(); // files from base revision not affected by status calculation
120 if (!isTipBase) { 120 if (!isTipBase) {
121 if (baseRevisionCollector != null) { 121 if (baseRevisionCollector != null) {
122 collect = baseRevisionCollector.raw(baseRevision); 122 collect = baseRevisionCollector.raw(baseRevision);
123 } else { 123 } else {
124 collect = new HgStatusCollector.ManifestRevisionInspector(null, null); 124 collect = new ManifestRevision(null, null);
125 repo.getManifest().walk(baseRevision, baseRevision, collect); 125 repo.getManifest().walk(baseRevision, baseRevision, collect);
126 } 126 }
127 baseRevFiles = new TreeSet<String>(collect.files()); 127 baseRevFiles = new TreeSet<String>(collect.files());
128 } 128 }
129 if (inspector instanceof HgStatusCollector.Record) { 129 if (inspector instanceof HgStatusCollector.Record) {
249 inspector.modified(getPathPool().path(fname)); 249 inspector.modified(getPathPool().path(fname));
250 } 250 }
251 } 251 }
252 252
253 // XXX refactor checkLocalStatus methods in more OO way 253 // XXX refactor checkLocalStatus methods in more OO way
254 private void checkLocalStatusAgainstBaseRevision(Set<String> baseRevNames, ManifestRevisionInspector collect, int baseRevision, Path fname, File f, HgStatusInspector inspector) { 254 private void checkLocalStatusAgainstBaseRevision(Set<String> baseRevNames, ManifestRevision collect, int baseRevision, Path fname, File f, HgStatusInspector inspector) {
255 // fname is in the dirstate, either Normal, Added, Removed or Merged 255 // fname is in the dirstate, either Normal, Added, Removed or Merged
256 Nodeid nid1 = collect.nodeid(fname.toString()); 256 Nodeid nid1 = collect.nodeid(fname.toString());
257 String flags = collect.flags(fname.toString()); 257 String flags = collect.flags(fname.toString());
258 HgDirstate.Record r; 258 HgDirstate.Record r;
259 if (nid1 == null) { 259 if (nid1 == null) {