fix wrong line number

This commit is contained in:
Sebastian Sdorra
2011-09-16 15:38:40 +02:00
parent 004a6ab74d
commit 9514f0397e

View File

@@ -118,8 +118,7 @@ public class HgBlameViewer implements BlameViewer
* @throws IOException * @throws IOException
*/ */
@Override @Override
public BlameResult getBlame(String revision, String path) public BlameResult getBlame(String revision, String path) throws IOException
throws IOException
{ {
AssertUtil.assertIsNotEmpty(path); AssertUtil.assertIsNotEmpty(path);
@@ -173,15 +172,15 @@ public class HgBlameViewer implements BlameViewer
* *
* @throws IOException * @throws IOException
*/ */
private BlameResult parseBlameInput(BufferedReader reader) private BlameResult parseBlameInput(BufferedReader reader) throws IOException
throws IOException
{ {
List<BlameLine> blameLines = new ArrayList<BlameLine>(); List<BlameLine> blameLines = new ArrayList<BlameLine>();
String line = reader.readLine(); String line = reader.readLine();
int i = 1;
while (line != null) while (line != null)
{ {
BlameLine blameLine = parseBlameLine(line); BlameLine blameLine = parseBlameLine(i, line);
if (blameLine != null) if (blameLine != null)
{ {
@@ -189,6 +188,7 @@ public class HgBlameViewer implements BlameViewer
} }
line = reader.readLine(); line = reader.readLine();
i++;
} }
return new BlameResult(blameLines.size(), blameLines); return new BlameResult(blameLines.size(), blameLines);
@@ -198,11 +198,13 @@ public class HgBlameViewer implements BlameViewer
* Method description * Method description
* *
* *
*
* @param nr
* @param line * @param line
* *
* @return * @return
*/ */
private BlameLine parseBlameLine(String line) private BlameLine parseBlameLine(int nr, String line)
{ {
BlameLine blameLine = null; BlameLine blameLine = null;
Matcher m = REGEX_FIRSTPART.matcher(line); Matcher m = REGEX_FIRSTPART.matcher(line);
@@ -214,8 +216,7 @@ public class HgBlameViewer implements BlameViewer
// todo parse date // todo parse date
Long when = getDate(m.group(3)); Long when = getDate(m.group(3));
blameLine = new BlameLine(authorPerson, when, m.group(2), m.group(5), blameLine = new BlameLine(authorPerson, when, m.group(2), m.group(5), nr);
Integer.parseInt(m.group(4)));
} }
else if (logger.isWarnEnabled()) else if (logger.isWarnEnabled())
{ {