comparison src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 689:5050ee565bd1

Issue 44: Renames/copies other than for the very first revision of a file are not recognized
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 27 Jul 2013 22:06:14 +0200
parents 12a4f60ea972
children b286222158be
comparison
equal deleted inserted replaced
688:1499139a600a 689:5050ee565bd1
418 // not known at the time of baseRevision: 418 // not known at the time of baseRevision:
419 // normal, added, merged: either added or copied since base revision. 419 // normal, added, merged: either added or copied since base revision.
420 // removed: nothing to report, 420 // removed: nothing to report,
421 if (ds.checkNormal(fname) != null || ds.checkMerged(fname) != null) { 421 if (ds.checkNormal(fname) != null || ds.checkMerged(fname) != null) {
422 try { 422 try {
423 Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, baseRevNames, baseRevision); 423 // FIXME refactor, done numerous time e.g. in TestStatus#testStatusCommand with base = 3
424 if (origin != null) { 424 ArrayList<Nodeid> parents = new ArrayList<Nodeid>(2);
425 inspector.copied(getPathPool().mangle(origin), fname); 425 parents.add(ds.parents().first());
426 return; 426 parents.add(ds.parents().second());
427 parents.remove(Nodeid.NULL);
428 // try either parent if file came through one of them, or both
429 for (Nodeid parent : parents) {
430 int csetIndex = repo.getChangelog().getRevisionIndex(parent);
431 Nodeid fileRev = repo.getManifest().getFileRevision(csetIndex, fname);
432 if (fileRev == null) {
433 continue;
434 }
435 // see if file revision known in this parent got copied from one of baseRevNames
436 Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, fileRev, baseRevNames, baseRevision);
437 if (origin != null) {
438 inspector.copied(getPathPool().mangle(origin), fname);
439 return;
440 }
427 } 441 }
428 // fall-through, report as added 442 // fall-through, report as added
429 } catch (HgInvalidFileException ex) { 443 } catch (HgInvalidFileException ex) {
430 // report failure and continue status collection 444 // report failure and continue status collection
431 inspector.invalid(fname, ex); 445 inspector.invalid(fname, ex);