Skip to content

Commit 0d46541

Browse files
committed
fix author parsing
1 parent b6621ae commit 0d46541

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ public Set<String> getRevisions() {
9191
return ret;
9292
}
9393

94+
Set<String> getAuthors() {
95+
Set<String> ret = new HashSet<>();
96+
for (Line ln : this.lines) {
97+
ret.add(ln.author);
98+
}
99+
return ret;
100+
}
101+
94102
/**
95103
* Gets the author who last modified the specified line.
96104
*

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ private Map<String, String> getAuthors(File file) throws IOException {
100100
argv.add(RepoCommand);
101101
argv.add("prs");
102102
argv.add("-e");
103-
argv.add("-d");
104-
argv.add(":I: :P:");
103+
argv.add("-d:I: :P:");
105104
argv.add(file.getCanonicalPath());
106105

107106
Executor executor = new Executor(argv, file.getCanonicalFile().getParentFile(),

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.indexer.history;
2424

@@ -46,8 +46,7 @@ public class SCCSRepositoryAuthorParser implements Executor.StreamHandler {
4646
/**
4747
* Pattern used to extract revision from the {@code sccs get} command.
4848
*/
49-
private static final Pattern AUTHOR_PATTERN
50-
= Pattern.compile("^([\\d.]+)\\s+(\\S+)");
49+
private static final Pattern AUTHOR_PATTERN = Pattern.compile("^([\\d.]+)\\s+(\\S+)");
5150

5251
@Override
5352
public void processStream(InputStream input) throws IOException {

opengrok-indexer/src/test/java/org/opengrok/indexer/history/SCCSRepositoryTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ void testAnnotation() throws Exception {
127127
assertNotNull(annotation);
128128
Set<String> revSet = Set.of("1.2", "1.1");
129129
assertEquals(revSet, annotation.getRevisions());
130+
assertEquals(Set.of("trond"), annotation.getAuthors());
130131
}
131132

132133
@Test

0 commit comments

Comments
 (0)