mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
fix conflict with guava 16
This commit is contained in:
@@ -50,7 +50,6 @@ import sonia.scm.web.HgUtil;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -126,7 +125,6 @@ public class AbstractHgHandler
|
||||
* @param handler
|
||||
* @param context
|
||||
* @param repository
|
||||
* @param repositoryDirectory
|
||||
*/
|
||||
protected AbstractHgHandler(HgRepositoryHandler handler, HgContext context,
|
||||
Repository repository)
|
||||
@@ -304,7 +302,6 @@ public class AbstractHgHandler
|
||||
Process p = createScriptProcess(script, extraEnv);
|
||||
T result = null;
|
||||
InputStream input = null;
|
||||
OutputStream output = null;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -322,8 +319,7 @@ public class AbstractHgHandler
|
||||
}
|
||||
finally
|
||||
{
|
||||
Closeables.closeQuietly(input);
|
||||
Closeables.closeQuietly(output);
|
||||
Closeables.close(input, true);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -37,13 +37,13 @@ package sonia.scm.repository;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.io.Closeables;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.SCMContextProvider;
|
||||
import sonia.scm.util.IOUtil;
|
||||
import sonia.scm.web.HgUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -59,16 +59,10 @@ import java.io.IOException;
|
||||
*/
|
||||
public final class HgWindowsPackageFix
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final String PYTHONPATH_WRONG = "set PYTHONPATH=%~dp0..\\lib;%PYTHONHOME%\\Lib";
|
||||
|
||||
/** Field description */
|
||||
private static final String PYTHONPATH_FIXED = "set PYTHONPATH=%~dp0..\\lib;%PYTHONHOME%\\Lib;%PYTHONPATH%";
|
||||
|
||||
/** Field description */
|
||||
static final String MODIFY_MARK_01 = ".setbinary";
|
||||
|
||||
|
||||
/** Field description */
|
||||
static final String MODIFY_MARK_02 = ".setpythonpath";
|
||||
|
||||
@@ -78,6 +72,14 @@ public final class HgWindowsPackageFix
|
||||
/** Field description */
|
||||
private static final String HG_PY = "hg.py";
|
||||
|
||||
/** Field description */
|
||||
private static final String PYTHONPATH_FIXED =
|
||||
"set PYTHONPATH=%~dp0..\\lib;%PYTHONHOME%\\Lib;%PYTHONPATH%";
|
||||
|
||||
/** Field description */
|
||||
private static final String PYTHONPATH_WRONG =
|
||||
"set PYTHONPATH=%~dp0..\\lib;%PYTHONHOME%\\Lib";
|
||||
|
||||
/**
|
||||
* the logger for HgUtil
|
||||
*/
|
||||
@@ -111,6 +113,7 @@ public final class HgWindowsPackageFix
|
||||
if (hg.startsWith(basePath) && hg.endsWith(HG_BAT))
|
||||
{
|
||||
File file = new File(hg);
|
||||
|
||||
fixHgBat(file);
|
||||
|
||||
file = new File(file.getParentFile(), HG_PY);
|
||||
@@ -123,48 +126,50 @@ public final class HgWindowsPackageFix
|
||||
"could not fix hg.py, because the configuration is not valid");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Visible for testing
|
||||
*
|
||||
* @param hgBat
|
||||
*/
|
||||
static void fixHgBat(File hgBat){
|
||||
static void fixHgBat(File hgBat)
|
||||
{
|
||||
if (hgBat.exists())
|
||||
{
|
||||
File binDirectory = hgBat.getParentFile();
|
||||
File modifyMark = new File(binDirectory, MODIFY_MARK_02);
|
||||
|
||||
if (!modifyMark.exists())
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
String content = Files.toString(hgBat, Charsets.UTF_8);
|
||||
|
||||
if (!content.contains(PYTHONPATH_FIXED))
|
||||
{
|
||||
content = content.replace(PYTHONPATH_WRONG, PYTHONPATH_FIXED);
|
||||
Files.write(content, hgBat, Charsets.UTF_8);
|
||||
}
|
||||
|
||||
createModifyMark(modifyMark);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.error("could not read content of {}", hgBat);
|
||||
|
||||
throw Throwables.propagate(ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.debug("hg.bat allready fixed");
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("could not find hg.bat at {}", hgBat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Visible for testing
|
||||
@@ -252,7 +257,7 @@ public final class HgWindowsPackageFix
|
||||
}
|
||||
finally
|
||||
{
|
||||
Closeables.closeQuietly(reader);
|
||||
IOUtil.close(reader);
|
||||
}
|
||||
|
||||
return setBinaryAvailable;
|
||||
@@ -327,8 +332,8 @@ public final class HgWindowsPackageFix
|
||||
}
|
||||
finally
|
||||
{
|
||||
Closeables.closeQuietly(reader);
|
||||
Closeables.closeQuietly(writer);
|
||||
IOUtil.close(reader);
|
||||
IOUtil.close(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class HgCatCommand extends AbstractCommand implements CatCommand
|
||||
}
|
||||
finally
|
||||
{
|
||||
Closeables.closeQuietly(input);
|
||||
Closeables.close(input, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class HgDiffCommand extends AbstractCommand implements DiffCommand
|
||||
}
|
||||
finally
|
||||
{
|
||||
Closeables.closeQuietly(inputStream);
|
||||
Closeables.close(inputStream, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
Closeables.closeQuietly(context);
|
||||
Closeables.close(context, true);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository.spi.javahg;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -37,10 +38,9 @@ package sonia.scm.repository.spi.javahg;
|
||||
import com.aragost.javahg.Repository;
|
||||
import com.aragost.javahg.internals.HgInputStream;
|
||||
|
||||
import com.google.common.io.Closeables;
|
||||
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.HgConfig;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -91,7 +91,7 @@ public abstract class HgIncomingOutgoingChangesetCommand
|
||||
}
|
||||
finally
|
||||
{
|
||||
Closeables.closeQuietly(stream);
|
||||
IOUtil.close(stream);
|
||||
}
|
||||
|
||||
return changesets;
|
||||
|
||||
@@ -491,7 +491,7 @@ public class HgHookCallbackServlet extends HttpServlet
|
||||
}
|
||||
finally
|
||||
{
|
||||
Closeables.closeQuietly(writer);
|
||||
Closeables.close(writer, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -538,14 +538,14 @@ public class HgHookCallbackServlet extends HttpServlet
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Provider<HgContext> contextProvider;
|
||||
private final Provider<HgContext> contextProvider;
|
||||
|
||||
/** Field description */
|
||||
private HgRepositoryHandler handler;
|
||||
private final HgRepositoryHandler handler;
|
||||
|
||||
/** Field description */
|
||||
private HookEventFacade hookEventFacade;
|
||||
private final HookEventFacade hookEventFacade;
|
||||
|
||||
/** Field description */
|
||||
private HgHookManager hookManager;
|
||||
private final HgHookManager hookManager;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class HgWindowsPackageFixTest
|
||||
}
|
||||
finally
|
||||
{
|
||||
Closeables.closeQuietly(fos);
|
||||
Closeables.close(fos, true);
|
||||
}
|
||||
|
||||
return file;
|
||||
|
||||
Reference in New Issue
Block a user