mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
fix mercurial sub repository detection in source browser
This commit is contained in:
@@ -40,9 +40,11 @@ import com.aragost.javahg.Repository;
|
|||||||
import com.aragost.javahg.internals.AbstractCommand;
|
import com.aragost.javahg.internals.AbstractCommand;
|
||||||
import com.aragost.javahg.internals.HgInputStream;
|
import com.aragost.javahg.internals.HgInputStream;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import sonia.scm.repository.FileObject;
|
import sonia.scm.repository.FileObject;
|
||||||
|
import sonia.scm.repository.SubRepository;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -112,7 +114,10 @@ public class HgFileviewCommand extends AbstractCommand
|
|||||||
{
|
{
|
||||||
file = readFile(stream);
|
file = readFile(stream);
|
||||||
}
|
}
|
||||||
else if (type == 's') {}
|
else if (type == 's')
|
||||||
|
{
|
||||||
|
file = readSubRepository(stream);
|
||||||
|
}
|
||||||
|
|
||||||
if (file != null)
|
if (file != null)
|
||||||
{
|
{
|
||||||
@@ -219,6 +224,40 @@ public class HgFileviewCommand extends AbstractCommand
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param stream
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private FileObject readSubRepository(HgInputStream stream) throws IOException
|
||||||
|
{
|
||||||
|
FileObject directory = new FileObject();
|
||||||
|
String path = removeTrailingSlash(stream.textUpTo('\n'));
|
||||||
|
|
||||||
|
directory.setName(getNameFromPath(path));
|
||||||
|
directory.setDirectory(true);
|
||||||
|
directory.setPath(path);
|
||||||
|
|
||||||
|
String revision = stream.textUpTo(' ');
|
||||||
|
String url = stream.textUpTo('\0');
|
||||||
|
|
||||||
|
SubRepository subRepository = new SubRepository(url);
|
||||||
|
|
||||||
|
if (!Strings.isNullOrEmpty(revision))
|
||||||
|
{
|
||||||
|
subRepository.setRevision(revision);
|
||||||
|
}
|
||||||
|
|
||||||
|
directory.setSubRepository(subRepository);
|
||||||
|
|
||||||
|
return directory;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user