mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
prepare for lazy loading
This commit is contained in:
@@ -71,6 +71,11 @@ public class HgLogChangesetCommand extends AbstractCommand
|
||||
*/
|
||||
private static final byte[] CHANGESET_PATTERN = Utils.randomBytes();
|
||||
|
||||
/** Field description */
|
||||
private static final String CHANGESET_LAZY_STYLE_PATH =
|
||||
Utils.resourceAsFile("/sonia/scm/styles/changesets-lazy.style",
|
||||
ImmutableMap.of("pattern", CHANGESET_PATTERN)).getPath();
|
||||
|
||||
/** Field description */
|
||||
private static final String CHANGESET_EAGER_STYLE_PATH =
|
||||
Utils.resourceAsFile("/sonia/scm/styles/changesets-eager.style",
|
||||
@@ -141,6 +146,23 @@ public class HgLogChangesetCommand extends AbstractCommand
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param files
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Integer> loadRevisions(String... files)
|
||||
{
|
||||
cmdAppend("--style", CHANGESET_LAZY_STYLE_PATH);
|
||||
|
||||
HgInputStream stream = launchStream(files);
|
||||
|
||||
return loadRevisionsFromStream(stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -203,9 +225,6 @@ public class HgLogChangesetCommand extends AbstractCommand
|
||||
|
||||
changeset.setId(nodeString);
|
||||
|
||||
// revision
|
||||
in.revisionUpTo('\n');
|
||||
|
||||
String user = in.textUpTo('\n');
|
||||
|
||||
changeset.setAuthor(Person.toPerson(user));
|
||||
@@ -275,6 +294,39 @@ public class HgLogChangesetCommand extends AbstractCommand
|
||||
return changeset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param stream
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<Integer> loadRevisionsFromStream(HgInputStream stream)
|
||||
{
|
||||
List<Integer> revisions = Lists.newArrayList();
|
||||
|
||||
try
|
||||
{
|
||||
while (stream.peek() != -1)
|
||||
{
|
||||
int rev = stream.revisionUpTo(' ');
|
||||
|
||||
if (rev >= 0)
|
||||
{
|
||||
revisions.add(rev);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new RuntimeIOException(ex);
|
||||
}
|
||||
|
||||
return revisions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user