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