diff src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 694:7efabe0cddcf

Speed up (a) file rename history to minimize file reads; (b) file.isCopy(int) to read metadata for few revisions at once (use pattern assumes earlier revisions are likely to be queried, too); (c) HgIgnore.isIgnored by caching matched initial fragments (to substitute more expensive Matcher.matches with cheaper HashMap.contains)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 05 Aug 2013 17:42:10 +0200
parents b286222158be
children cf200271439a
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Mon Aug 05 12:45:36 2013 +0200
+++ b/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Mon Aug 05 17:42:10 2013 +0200
@@ -420,20 +420,11 @@
 			// removed: nothing to report, 
 			if (ds.checkNormal(fname) != null || ds.checkMerged(fname) != null) {
 				try {
-					// FIXME refactor, done numerous time e.g. in TestStatus#testStatusCommand with base = 3
-					ArrayList<Nodeid> parents = new ArrayList<Nodeid>(2);
-					parents.add(ds.parents().first());
-					parents.add(ds.parents().second());
-					parents.remove(Nodeid.NULL);
-					// try either parent if file came through one of them, or both
-					for (Nodeid parent : parents) {
-						int csetIndex = repo.getChangelog().getRevisionIndex(parent);
-						Nodeid fileRev = repo.getManifest().getFileRevision(csetIndex, fname);
-						if (fileRev == null) {
-							continue;
-						}
+					// 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, fileRev, collect.files(), baseRevision);
+						Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, nidFromDirstate, collect.files(), baseRevision);
 						if (origin != null) {
 							inspector.copied(getPathPool().mangle(origin), fname);
 							return;