Skip to content

Commit 99f1758

Browse files
committed
make parent/branch logging less aggressive
fixes #1103
1 parent 33a468d commit 99f1758

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

src/org/opensolaris/opengrok/history/BazaarRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ String determineParent() throws IOException {
358358
cmd.add("config");
359359
cmd.add("parent_location");
360360
Executor executor = new Executor(cmd, directory);
361-
if (executor.exec() != 0) {
361+
if (executor.exec(false) != 0) {
362362
throw new IOException(executor.getErrorString());
363363
}
364364

src/org/opensolaris/opengrok/history/MercurialRepository.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,18 @@ public MercurialRepository() {
122122
* Return name of the branch or "default"
123123
*/
124124
@Override
125-
String determineBranch() {
125+
String determineBranch() throws IOException {
126126
List<String> cmd = new ArrayList<>();
127127
ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
128128
cmd.add(RepoCommand);
129129
cmd.add("branch");
130130

131-
Executor e = new Executor(cmd, new File(directoryName));
132-
e.exec();
131+
Executor executor = new Executor(cmd, new File(directoryName));
132+
if (executor.exec(false) != 0) {
133+
throw new IOException(executor.getErrorString());
134+
}
133135

134-
return e.getOutputString().trim();
136+
return executor.getOutputString().trim();
135137
}
136138

137139
/**
@@ -673,7 +675,7 @@ String determineParent() throws IOException {
673675
cmd.add("paths");
674676
cmd.add("default");
675677
Executor executor = new Executor(cmd, directory);
676-
if (executor.exec() != 0) {
678+
if (executor.exec(false) != 0) {
677679
throw new IOException(executor.getErrorString());
678680
}
679681

src/org/opensolaris/opengrok/history/RepositoryFactory.java

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

2020
/*
21-
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323

2424
package org.opensolaris.opengrok.history;
@@ -92,7 +92,8 @@ public static Repository getRepository(File file) throws InstantiationException,
9292
res.setDirectoryName(file.getCanonicalPath());
9393
} catch (IOException e) {
9494
LOGGER.log(Level.SEVERE,
95-
"Failed to get canonical path name for " + file.getAbsolutePath(), e);
95+
"Failed to get canonical path name for " +
96+
file.getAbsolutePath(), e);
9697
}
9798

9899
if (!res.isWorking()) {
@@ -113,9 +114,9 @@ public static Repository getRepository(File file) throws InstantiationException,
113114
try {
114115
res.setParent(res.determineParent());
115116
} catch (IOException ex) {
116-
LOGGER.log(Level.SEVERE, null, ex);
117117
LOGGER.log(Level.WARNING,
118-
"Failed to get parent for " + file.getAbsolutePath());
118+
"Failed to get parent for {0}: {1}",
119+
new Object[]{file.getAbsolutePath(), ex});
119120
}
120121
}
121122

@@ -124,7 +125,8 @@ public static Repository getRepository(File file) throws InstantiationException,
124125
res.setBranch(res.determineBranch());
125126
} catch (IOException ex) {
126127
LOGGER.log(Level.WARNING,
127-
"Failed to get branch for " + file.getAbsolutePath());
128+
"Failed to get branch for {0}: {1}",
129+
new Object[]{file.getAbsolutePath(), ex});
128130
}
129131
}
130132

0 commit comments

Comments
 (0)