}
// XXX refactor checkLocalStatus methods in more OO way
private void checkLocalStatusAgainstBaseRevision(Set<Path> baseRevNames, ManifestRevision collect, int baseRevision, Path fname, FileInfo f, HgStatusInspector inspector) throws HgRuntimeException {
// fname is in the dirstate, either Normal, Added, Removed or Merged
Nodeid nid1 = collect.nodeid(fname);
HgManifest.Flags flags = collect.flags(fname);
HgDirstate.Record r;
final HgDirstate ds = getDirstateImpl();
if (nid1 == null) {
// not known at the time of baseRevision:
// normal, added, merged: either added or copied since base revision.
// removed: nothing to report,
if (ds.checkNormal(fname) != null || ds.checkMerged(fname) != null) {
try {
// XXX perhaps, shall take second parent into account if not null, too?
Nodeid nidFromDirstate = getDirstateParentManifest().nodeid(fname);
if (nidFromDirstate != null) {
// see if file revision known in this parent got copied from one of baseRevNames
Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, nidFromDirstate, collect.files(), baseRevision);
if (origin != null) {
inspector.copied(getPathPool().mangle(origin), fname);
return;
}
}
// fall-through, report as added
} catch (HgInvalidFileException ex) {
// report failure and continue status collection
inspector.invalid(fname, ex);
}
} else if ((r = ds.checkAdded(fname)) != null) {
if (r.copySource() != null && baseRevNames.contains(r.copySource())) {
// shall not remove rename source from baseRevNames, as the source
// likely needs to be reported as Removed as well
inspector.copied(r.copySource(), fname);
return;
}
// fall-through, report as added
} else if (ds.checkRemoved(fname) != null) {
// removed: removed file was not known at the time of baseRevision, and we should not report it as removed
return;
}
inspector.added(fname);
} else {
// was known; check whether clean or modified
Nodeid nidFromDirstate = getDirstateParentManifest().nodeid(fname);
if ((r = ds.checkNormal(fname)) != null && nid1.equals(nidFromDirstate)) {
// regular file, was the same up to WC initialization. Check if was modified since, and, if not, report right away
// same code as in #checkLocalStatusAgainstFile
final boolean timestampEqual = f.lastModified() == r.modificationTime(), sizeEqual = r.size() == f.length();
boolean handled = false;