Mercurial > hg4j
changeset 152:7a908ba66ff3
Correctly parse comments with newlines inside
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 24 Feb 2011 21:36:52 +0100 |
parents | 305ee74c0aa6 |
children | ab7ea2ac21cb |
files | test/org/tmatesoft/hg/test/LogOutputParser.java |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/LogOutputParser.java Thu Feb 24 20:14:11 2011 +0100 +++ b/test/org/tmatesoft/hg/test/LogOutputParser.java Thu Feb 24 21:36:52 2011 +0100 @@ -35,13 +35,15 @@ private Pattern pattern2; private Pattern pattern3; private Pattern pattern4; + private Pattern pattern5; public LogOutputParser(boolean outputWithDebug) { if (outputWithDebug) { pattern1 = Pattern.compile("^changeset:\\s+(\\d+):([a-f0-9]{40})\n(^tag:(.+)$)?", Pattern.MULTILINE); pattern2 = Pattern.compile("^parent:\\s+(-?\\d+):([a-f0-9]{40})\n", Pattern.MULTILINE); pattern3 = Pattern.compile("^manifest:\\s+(\\d+):([a-f0-9]{40})\nuser:\\s+(\\S.+)\ndate:\\s+(\\S.+)\n", Pattern.MULTILINE); - pattern4 = Pattern.compile("^description:\n^(.+)\n\n", Pattern.MULTILINE); + pattern4 = Pattern.compile("^description:\\n", Pattern.MULTILINE); + pattern5 = Pattern.compile("\\n\\n"); //p = "^manifest:\\s+(\\d+):([a-f0-9]{40})\nuser:(.+)$"; } else { throw HgRepository.notImplemented(); @@ -79,7 +81,11 @@ } m.usePattern(pattern4); if (m.find()) { - r.description = m.group(1); + int commentStart = m.end(); + m.usePattern(pattern5); + if (m.find()) { + r.description = seq.subSequence(commentStart, m.start()).toString(); + } } result.add(r); m.usePattern(pattern1);