Skip to content

Commit f8dd1a9

Browse files
committed
use template
1 parent ace39bc commit f8dd1a9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialAnnotationParser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ class MercurialAnnotationParser implements Executor.StreamHandler {
5252

5353
/**
5454
* Pattern used to extract author/revision from the {@code hg annotate} command.
55+
* Obviously, this has to be in concordance with the output template used by
56+
* {@link MercurialRepository#annotate(File, String)}.
5557
*/
56-
private static final Pattern ANNOTATION_PATTERN = Pattern.compile("^(\\d+)\\s+([0-9a-f]+):");
58+
private static final Pattern ANNOTATION_PATTERN = Pattern.compile("^(\\d+)\\t([0-9a-f]+):");
5759

5860
MercurialAnnotationParser(File file, @NotNull HashMap<String, HistoryEntry> revs) {
5961
this.file = file;

opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialRepository.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ private HistoryRevResult getHistoryRev(BufferSink sink, String fullpath, String
322322
* of a file in historical revision.
323323
*
324324
* @param fullpath file path
325-
* @param fullRevToFind revision number (in the form of
326-
* {rev}:{node|short})
325+
* @param fullRevToFind revision number (in the form of <code>{rev}:{node|short}</code>)
327326
* @return original filename
328327
*/
329328
private String findOriginalName(String fullpath, String fullRevToFind) throws IOException {
@@ -464,8 +463,11 @@ public Annotation annotate(File file, String revision) throws IOException {
464463
ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
465464
argv.add(RepoCommand);
466465
argv.add("annotate");
467-
argv.add("-n");
468-
argv.add("-c"); // TODO: use --template ?
466+
argv.add("--template");
467+
/*
468+
* This has to be in concordance with TEMPLATE_REVS, in particular the format of the 'node'.
469+
*/
470+
argv.add("{lines % '{rev}\t{node|short}:{line}'}");
469471
if (!this.isHandleRenamedFiles()) {
470472
argv.add("--no-follow");
471473
}

0 commit comments

Comments
 (0)