Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/WorkingCopyStatusCollector.java @ 90:a95c700408a9
Correctly report copy/rename events for rev..working copy case
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 26 Jan 2011 06:31:40 +0100 |
parents | 42bcb4bffd17 |
children | c2ce1cfaeb9e |
comparison
equal
deleted
inserted
replaced
89:42bcb4bffd17 | 90:a95c700408a9 |
---|---|
101 if (hgIgnore.isIgnored(fname)) { | 101 if (hgIgnore.isIgnored(fname)) { |
102 inspector.ignored(fname); | 102 inspector.ignored(fname); |
103 } else if (knownEntries.remove(fname)) { | 103 } else if (knownEntries.remove(fname)) { |
104 // modified, added, removed, clean | 104 // modified, added, removed, clean |
105 if (collect != null) { // need to check against base revision, not FS file | 105 if (collect != null) { // need to check against base revision, not FS file |
106 checkLocalStatusAgainstBaseRevision(baseRevFiles, collect, fname, f, inspector); | 106 checkLocalStatusAgainstBaseRevision(baseRevFiles, collect, baseRevision, fname, f, inspector); |
107 baseRevFiles.remove(fname); | 107 baseRevFiles.remove(fname); |
108 } else { | 108 } else { |
109 checkLocalStatusAgainstFile(fname, f, inspector); | 109 checkLocalStatusAgainstFile(fname, f, inspector); |
110 } | 110 } |
111 } else { | 111 } else { |
163 inspector.modified(fname); | 163 inspector.modified(fname); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 // XXX refactor checkLocalStatus methods in more OO way | 167 // XXX refactor checkLocalStatus methods in more OO way |
168 private void checkLocalStatusAgainstBaseRevision(Set<String> baseRevNames, ManifestRevisionInspector collect, String fname, File f, StatusCollector.Inspector inspector) { | 168 private void checkLocalStatusAgainstBaseRevision(Set<String> baseRevNames, ManifestRevisionInspector collect, int baseRevision, String fname, File f, StatusCollector.Inspector inspector) { |
169 // fname is in the dirstate, either Normal, Added, Removed or Merged | 169 // fname is in the dirstate, either Normal, Added, Removed or Merged |
170 Nodeid nid1 = collect.nodeid(fname); | 170 Nodeid nid1 = collect.nodeid(fname); |
171 String flags = collect.flags(fname); | 171 String flags = collect.flags(fname); |
172 HgDirstate.Record r; | 172 HgDirstate.Record r; |
173 if (nid1 == null) { | 173 if (nid1 == null) { |
174 // normal: added? | 174 // normal: added? |
175 // added: not known at the time of baseRevision, shall report | 175 // added: not known at the time of baseRevision, shall report |
176 // merged: was not known, report as added? | 176 // merged: was not known, report as added? |
177 if ((r = getDirstate().checkAdded(fname)) != null) { | 177 if ((r = getDirstate().checkNormal(fname)) != null) { |
178 String origin = StatusCollector.getOriginIfCopy(repo, fname, baseRevNames, baseRevision); | |
179 if (origin != null) { | |
180 inspector.copied(origin, fname); | |
181 return; | |
182 } | |
183 } else if ((r = getDirstate().checkAdded(fname)) != null) { | |
178 if (r.name2 != null && baseRevNames.contains(r.name2)) { | 184 if (r.name2 != null && baseRevNames.contains(r.name2)) { |
179 baseRevNames.remove(r.name2); | 185 baseRevNames.remove(r.name2); // XXX surely I shall not report rename source as Removed? |
180 inspector.copied(r.name2, fname); | 186 inspector.copied(r.name2, fname); |
181 return; | 187 return; |
182 } | 188 } |
183 // fall-through, report as added | 189 // fall-through, report as added |
184 } else if (getDirstate().checkRemoved(fname) != null) { | 190 } else if (getDirstate().checkRemoved(fname) != null) { |