Mercurial > hg4j
comparison 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 |
comparison
equal
deleted
inserted
replaced
693:32b0d19e8aba | 694:7efabe0cddcf |
---|---|
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 // FIXME refactor, done numerous time e.g. in TestStatus#testStatusCommand with base = 3 | 423 // XXX perhaps, shall take second parent into account if not null, too? |
424 ArrayList<Nodeid> parents = new ArrayList<Nodeid>(2); | 424 Nodeid nidFromDirstate = getDirstateParentManifest().nodeid(fname); |
425 parents.add(ds.parents().first()); | 425 if (nidFromDirstate != null) { |
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 | 426 // see if file revision known in this parent got copied from one of baseRevNames |
436 Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, fileRev, collect.files(), baseRevision); | 427 Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, nidFromDirstate, collect.files(), baseRevision); |
437 if (origin != null) { | 428 if (origin != null) { |
438 inspector.copied(getPathPool().mangle(origin), fname); | 429 inspector.copied(getPathPool().mangle(origin), fname); |
439 return; | 430 return; |
440 } | 431 } |
441 } | 432 } |