Mercurial > jhg
diff src/org/tmatesoft/hg/internal/ReverseAnnotateInspector.java @ 677:1c49c0cee540
Report line number at the first appearance, like 'hg annotate -l' does
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 18 Jul 2013 18:47:45 +0200 |
parents | 3219cfadda49 |
children |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/ReverseAnnotateInspector.java Thu Jul 18 18:03:51 2013 +0200 +++ b/src/org/tmatesoft/hg/internal/ReverseAnnotateInspector.java Thu Jul 18 18:47:45 2013 +0200 @@ -59,6 +59,7 @@ private boolean activeEqualsComesFromMerge = false; private int[] lineRevisions; + private int[] lineNumbers; /** * @return desired order of iteration for diff @@ -72,7 +73,7 @@ progress.start(lineRevisions.length); for (int i = 0; i < lineRevisions.length; i++) { byte[] c = lineContent.elementAt(i).asArray(); - li.init(i+1, lineRevisions[i], c); + li.init(i+1, lineNumbers[i] + 1, lineRevisions[i], c); insp.next(li); progress.worked(1); cancel.checkCancelled(); @@ -85,8 +86,9 @@ if (knownLines == null) { lineContent = rd.target(); knownLines = new boolean[lineContent.elementCount()]; - lineRevisions = new int [lineContent.elementCount()]; + lineRevisions = new int [knownLines.length]; Arrays.fill(lineRevisions, NO_REVISION); + lineNumbers = new int[knownLines.length]; activeEquals = new RangePairSeq(); activeEquals.add(0, 0, knownLines.length); equalRanges.put(rd.targetChangesetIndex(), activeEquals); @@ -144,7 +146,7 @@ if (rs != null) { rs.add(block.insertedAt() + i, lnInFinal, 1); } else { - line(lnInFinal, block.targetChangesetIndex()); + line(lnInFinal, ln, block.targetChangesetIndex()); } knownLines[lnInFinal] = true; } @@ -158,7 +160,8 @@ public void deleted(DeleteBlock block) { } - private void line(int lineNumber, int changesetRevIndex) { + private void line(int lineNumber, int firstAppearance, int changesetRevIndex) { lineRevisions[lineNumber] = changesetRevIndex; + lineNumbers[lineNumber] = firstAppearance; } } \ No newline at end of file