Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 293:9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 14 Sep 2011 04:11:37 +0200 |
parents | 8faad08c709b |
children | 32890bab7209 |
comparison
equal
deleted
inserted
replaced
292:a415fe296a50 | 293:9774f47d904d |
---|---|
159 rev1 = baseRevision; | 159 rev1 = baseRevision; |
160 } | 160 } |
161 ((HgStatusCollector.Record) inspector).init(rev1, rev2, sc); | 161 ((HgStatusCollector.Record) inspector).init(rev1, rev2, sc); |
162 } | 162 } |
163 final HgIgnore hgIgnore = repo.getIgnore(); | 163 final HgIgnore hgIgnore = repo.getIgnore(); |
164 TreeSet<Path> knownEntries = getDirstate().all(); | |
165 repoWalker.reset(); | 164 repoWalker.reset(); |
165 TreeSet<Path> processed = new TreeSet<Path>(); // names of files we handled as they known to Dirstate (not FileIterator) | |
166 final HgDirstate ds = getDirstate(); | |
167 TreeSet<Path> knownEntries = ds.all(); // here just to get dirstate initialized | |
166 while (repoWalker.hasNext()) { | 168 while (repoWalker.hasNext()) { |
167 repoWalker.next(); | 169 repoWalker.next(); |
168 final Path fname = getPathPool().path(repoWalker.name()); | 170 final Path fname = getPathPool().path(repoWalker.name()); |
169 FileInfo f = repoWalker.file(); | 171 FileInfo f = repoWalker.file(); |
172 Path knownInDirstate; | |
170 if (!f.exists()) { | 173 if (!f.exists()) { |
171 // file coming from iterator doesn't exist. | 174 // file coming from iterator doesn't exist. |
172 if (knownEntries.remove(fname)) { | 175 if ((knownInDirstate = ds.known(fname)) != null) { |
173 if (getDirstate().checkRemoved(fname) == null) { | 176 // found in dirstate |
177 processed.add(knownInDirstate); | |
178 if (ds.checkRemoved(fname) == null) { | |
174 inspector.missing(fname); | 179 inspector.missing(fname); |
175 } else { | 180 } else { |
176 inspector.removed(fname); | 181 inspector.removed(fname); |
177 } | 182 } |
178 // do not report it as removed later | 183 // do not report it as removed later |
195 inspector.unknown(fname); | 200 inspector.unknown(fname); |
196 } | 201 } |
197 } | 202 } |
198 continue; | 203 continue; |
199 } | 204 } |
200 if (knownEntries.remove(fname)) { | 205 if ((knownInDirstate = ds.known(fname)) != null) { |
201 // tracked file. | 206 // tracked file. |
202 // modified, added, removed, clean | 207 // modified, added, removed, clean |
208 processed.add(knownInDirstate); | |
203 if (collect != null) { // need to check against base revision, not FS file | 209 if (collect != null) { // need to check against base revision, not FS file |
204 checkLocalStatusAgainstBaseRevision(baseRevFiles, collect, baseRevision, fname, f, inspector); | 210 checkLocalStatusAgainstBaseRevision(baseRevFiles, collect, baseRevision, fname, f, inspector); |
205 } else { | 211 } else { |
206 checkLocalStatusAgainstFile(fname, f, inspector); | 212 checkLocalStatusAgainstFile(fname, f, inspector); |
207 } | 213 } |
221 if (repoWalker.inScope(fromBase)) { | 227 if (repoWalker.inScope(fromBase)) { |
222 inspector.removed(fromBase); | 228 inspector.removed(fromBase); |
223 } | 229 } |
224 } | 230 } |
225 } | 231 } |
232 knownEntries.removeAll(processed); | |
226 for (Path m : knownEntries) { | 233 for (Path m : knownEntries) { |
227 if (!repoWalker.inScope(m)) { | 234 if (!repoWalker.inScope(m)) { |
228 // do not report as missing/removed those FileIterator doesn't care about. | 235 // do not report as missing/removed those FileIterator doesn't care about. |
229 continue; | 236 continue; |
230 } | 237 } |
231 // missing known file from a working dir | 238 // missing known file from a working dir |
232 if (getDirstate().checkRemoved(m) == null) { | 239 if (ds.checkRemoved(m) == null) { |
233 // not removed from the repository = 'deleted' | 240 // not removed from the repository = 'deleted' |
234 inspector.missing(m); | 241 inspector.missing(m); |
235 } else { | 242 } else { |
236 // removed from the repo | 243 // removed from the repo |
237 // if we check against non-tip revision, do not report files that were added past that revision and now removed. | 244 // if we check against non-tip revision, do not report files that were added past that revision and now removed. |