mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
fix hg.py instead of hg.bat
This commit is contained in:
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import sonia.scm.SCMContext;
|
import sonia.scm.SCMContext;
|
||||||
import sonia.scm.io.ZipUnArchiver;
|
import sonia.scm.io.ZipUnArchiver;
|
||||||
import sonia.scm.net.HttpClient;
|
import sonia.scm.net.HttpClient;
|
||||||
import sonia.scm.repository.HgBatFix;
|
import sonia.scm.repository.HgPyFix;
|
||||||
import sonia.scm.repository.HgConfig;
|
import sonia.scm.repository.HgConfig;
|
||||||
import sonia.scm.repository.HgRepositoryHandler;
|
import sonia.scm.repository.HgRepositoryHandler;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
@@ -231,7 +231,7 @@ public class HgPackageInstaller implements Runnable
|
|||||||
config.setUseOptimizedBytecode(template.isUseOptimizedBytecode());
|
config.setUseOptimizedBytecode(template.isUseOptimizedBytecode());
|
||||||
|
|
||||||
// fix wrong hg.bat
|
// fix wrong hg.bat
|
||||||
HgBatFix.fixHgBat(SCMContext.getContext(), config);
|
HgPyFix.fixHgPy(SCMContext.getContext(), config);
|
||||||
|
|
||||||
handler.storeConfig();
|
handler.storeConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ import java.io.IOException;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
public class HgBatFix
|
public class HgPyFix
|
||||||
{
|
{
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
@@ -63,6 +63,9 @@ public class HgBatFix
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
private static final String HG_BAT = "hg.bat";
|
private static final String HG_BAT = "hg.bat";
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private static final String HG_PY = "hg.py";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the logger for HgUtil
|
* the logger for HgUtil
|
||||||
*/
|
*/
|
||||||
@@ -77,7 +80,7 @@ public class HgBatFix
|
|||||||
* @param context
|
* @param context
|
||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
public static void fixHgBat(SCMContextProvider context, HgConfig config)
|
public static void fixHgPy(SCMContextProvider context, HgConfig config)
|
||||||
{
|
{
|
||||||
String basePath = context.getBaseDirectory().getAbsolutePath();
|
String basePath = context.getBaseDirectory().getAbsolutePath();
|
||||||
|
|
||||||
@@ -85,8 +88,10 @@ public class HgBatFix
|
|||||||
|
|
||||||
if (hg.startsWith(basePath) && hg.endsWith(HG_BAT))
|
if (hg.startsWith(basePath) && hg.endsWith(HG_BAT))
|
||||||
{
|
{
|
||||||
|
File file = new File(hg);
|
||||||
|
|
||||||
fixHgBat(hg);
|
file = new File(file.getParentFile(), HG_PY);
|
||||||
|
fixHgPy(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,10 +100,11 @@ public class HgBatFix
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param hg
|
* @param hg
|
||||||
|
*
|
||||||
|
* @param hgBat
|
||||||
*/
|
*/
|
||||||
static void fixHgBat(String hg)
|
static void fixHgPy(File hgBat)
|
||||||
{
|
{
|
||||||
File hgBat = new File(hg);
|
|
||||||
|
|
||||||
if (hgBat.exists())
|
if (hgBat.exists())
|
||||||
{
|
{
|
||||||
@@ -110,7 +116,7 @@ public class HgBatFix
|
|||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("check hg.bat for setbinary at {}", hg);
|
logger.debug("check hg.bat for setbinary at {}", hgBat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSetBinaryAvailable(hgBat))
|
if (!isSetBinaryAvailable(hgBat))
|
||||||
@@ -130,7 +136,7 @@ public class HgBatFix
|
|||||||
}
|
}
|
||||||
else if (logger.isWarnEnabled())
|
else if (logger.isWarnEnabled())
|
||||||
{
|
{
|
||||||
logger.warn("could not find hg.bat at {}", hg);
|
logger.warn("could not find hg.bat at {}", hgBat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ public class HgRepositoryHandler
|
|||||||
// fix wrong hg.bat from package installation
|
// fix wrong hg.bat from package installation
|
||||||
if (SystemUtil.isWindows())
|
if (SystemUtil.isWindows())
|
||||||
{
|
{
|
||||||
HgBatFix.fixHgBat(context, getConfig());
|
HgPyFix.fixHgPy(context, getConfig());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ import java.net.URL;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
public class HgBatFixTest
|
public class HgPyFixTest
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,10 +136,10 @@ public class HgBatFixTest
|
|||||||
*/
|
*/
|
||||||
private File testModify(File file)
|
private File testModify(File file)
|
||||||
{
|
{
|
||||||
HgBatFix.fixHgBat(file.getAbsolutePath());
|
HgPyFix.fixHgPy(file);
|
||||||
assertTrue(HgBatFix.isSetBinaryAvailable(file));
|
assertTrue(HgPyFix.isSetBinaryAvailable(file));
|
||||||
|
|
||||||
File mod = new File(file.getParentFile(), HgBatFix.MODIFY_MARK);
|
File mod = new File(file.getParentFile(), HgPyFix.MODIFY_MARK);
|
||||||
|
|
||||||
assertTrue(mod.exists());
|
assertTrue(mod.exists());
|
||||||
|
|
||||||
Reference in New Issue
Block a user