Mercurial > hg4j
diff 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 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/WorkingCopyStatusCollector.java Wed Jan 26 06:18:31 2011 +0100 +++ b/src/org/tmatesoft/hg/repo/WorkingCopyStatusCollector.java Wed Jan 26 06:31:40 2011 +0100 @@ -103,7 +103,7 @@ } else if (knownEntries.remove(fname)) { // modified, added, removed, clean if (collect != null) { // need to check against base revision, not FS file - checkLocalStatusAgainstBaseRevision(baseRevFiles, collect, fname, f, inspector); + checkLocalStatusAgainstBaseRevision(baseRevFiles, collect, baseRevision, fname, f, inspector); baseRevFiles.remove(fname); } else { checkLocalStatusAgainstFile(fname, f, inspector); @@ -165,7 +165,7 @@ } // XXX refactor checkLocalStatus methods in more OO way - private void checkLocalStatusAgainstBaseRevision(Set<String> baseRevNames, ManifestRevisionInspector collect, String fname, File f, StatusCollector.Inspector inspector) { + private void checkLocalStatusAgainstBaseRevision(Set<String> baseRevNames, ManifestRevisionInspector collect, int baseRevision, String fname, File f, StatusCollector.Inspector inspector) { // fname is in the dirstate, either Normal, Added, Removed or Merged Nodeid nid1 = collect.nodeid(fname); String flags = collect.flags(fname); @@ -174,9 +174,15 @@ // normal: added? // added: not known at the time of baseRevision, shall report // merged: was not known, report as added? - if ((r = getDirstate().checkAdded(fname)) != null) { + if ((r = getDirstate().checkNormal(fname)) != null) { + String origin = StatusCollector.getOriginIfCopy(repo, fname, baseRevNames, baseRevision); + if (origin != null) { + inspector.copied(origin, fname); + return; + } + } else if ((r = getDirstate().checkAdded(fname)) != null) { if (r.name2 != null && baseRevNames.contains(r.name2)) { - baseRevNames.remove(r.name2); + baseRevNames.remove(r.name2); // XXX surely I shall not report rename source as Removed? inspector.copied(r.name2, fname); return; }