Skip to content

Commit 5e37957

Browse files
idodeclareVladimir Kotal
authored andcommitted
Revise after review
1 parent 730303d commit 5e37957

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ History parseChanges(Reader fileHistory) throws IOException {
165165
while ((line = reader.readLine()) != null) {
166166
Matcher matcher = CHANGE_PATTERN.matcher(line);
167167
if (matcher.find()) {
168-
entry = parseLedeLine(entries, entry, messageBuilder, matcher);
168+
entry = parseEntryLine(entries, entry, messageBuilder, matcher);
169169
} else if (line.startsWith("\t")) {
170170
messageBuilder.append(line.substring(1));
171171
messageBuilder.append("\n");
@@ -207,7 +207,7 @@ History parseFileLog(Reader fileLog) throws IOException {
207207

208208
matcher = REVISION_PATTERN.matcher(line);
209209
if (matcher.find()) {
210-
entry = parseLedeLine(entries, entry, messageBuilder, matcher);
210+
entry = parseEntryLine(entries, entry, messageBuilder, matcher);
211211
if (fileName != null) {
212212
entry.addFile(fileName);
213213
/*
@@ -305,7 +305,7 @@ private static Date newDate(int year, int month, int day, int hour, int minute,
305305
return cal.getTime();
306306
}
307307

308-
private static HistoryEntry parseLedeLine(List<HistoryEntry> entries, HistoryEntry entry,
308+
private static HistoryEntry parseEntryLine(List<HistoryEntry> entries, HistoryEntry entry,
309309
StringBuilder messageBuilder, Matcher matcher) {
310310
if (entry != null) {
311311
/* An entry finishes when a new entry starts ... */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static String protectPerforceFilename(String name) {
7070
t = t.replace("#", "%23");
7171
t = t.replace("*", "%2A");
7272
t = t.replace("@", "%40");
73-
if (!name.equals(t)) {
73+
if (LOGGER.isLoggable(Level.FINEST) && !name.equals(t)) {
7474
LOGGER.log(Level.FINEST,
7575
"protectPerforceFilename: replaced ''{0}'' with ''{1}''",
7676
new Object[]{name, t});
@@ -83,7 +83,7 @@ static String unprotectPerforceFilename(String name) {
8383
t = t.replace("%23", "#");
8484
t = t.replace("%2A", "*");
8585
t = t.replace("%25", "%");
86-
if (!name.equals(t)) {
86+
if (LOGGER.isLoggable(Level.FINEST) && !name.equals(t)) {
8787
LOGGER.log(Level.FINEST,
8888
"unprotectPerforceFilename: replaced ''{0}'' with ''{1}''",
8989
new Object[]{name, t});

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,45 @@ public static void setUpClass() {
7171
}
7272
}
7373

74+
/**
75+
* Following are steps to set up for testing:
76+
* <p><ul>
77+
* <li>Install a Perforce server instance. I elected to install the
78+
* helix-p4d package on Ubuntu by following the instructions at
79+
* <a href="https://www.perforce.com/manuals/p4sag/Content/P4SAG/install.linux.packages.install.html">
80+
* Helix Core Server Administrator Guide > Installing the server > Linux
81+
* package-based installation > Installation</a>.
82+
* <li>Configure the Perforce server. Follow the instructions at
83+
* <a href="https://www.perforce.com/manuals/p4sag/Content/P4SAG/install.linux.packages.configure.html">
84+
* Helix Core Server Administrator Guide > Installing the server > Linux
85+
* package-based installation > Post-installation configuration</a>.
86+
* <li>Secure the Perforce server transport layer. I deployed a private key
87+
* and certificate following the instructions at
88+
* <a href="https://www.perforce.com/manuals/p4sag/Content/P4SAG/DB5-16618.html">
89+
* Helix Core Server Administrator Guide > Securing the server > Using SSL
90+
* to encrypt connections to a Helix server > Key and certificate
91+
* management</a>.
92+
* <li>Define an authentication method for the Perforce server. I elected to
93+
* authenticate against my home Active Directory following the instructions
94+
* at <a href="https://www.perforce.com/manuals/p4sag/Content/P4SAG/security.ldap.auth.html">
95+
* Helix Core Server Administrator Guide > Securing the server > LDAP
96+
* authentication > Authenticating against Active Directory and LDAP
97+
* servers</a> and then testing the LDAP configuration per
98+
* <a href="https://www.perforce.com/manuals/p4sag/Content/P4SAG/security.ldap.testing.html">
99+
* Helix Core Server Administrator Guide > Securing the server > LDAP
100+
* authentication > Testing and enabling LDAP configurations</a>.
101+
* <li>Install Perforce on the development workstation. I used Homebrew to
102+
* install: {@code admin$ brew cask install perforce}
103+
* <li>Set environment to connect to the Perforce server. My server is named
104+
* p4: {@code export P4PORT=ssl:p4.localdomain:1666}
105+
* <li>Define a Perforce client view on the workstation. For a workstation
106+
* named workstation1: {@code cd /var/opengrok/src && p4 client workstation1}
107+
* <li>Add sample code and submit: {@code p4 add *.h && p4 submit}
108+
* <li>Add more sample code and submit: {@code p4 add *.c && p4 submit}
109+
* <li>Add more sample code and submit: {@code p4 add *.txt && p4 submit}
110+
* <li>Code, Index, Test, and Debug.
111+
* </ul><p>
112+
*/
74113
@Test
75114
@ConditionalRun(RepositoryInstalled.PerforceInstalled.class)
76115
public void testHistoryAndAnnotations() throws Exception {

0 commit comments

Comments
 (0)