mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-03 20:15:52 +01:00
merge with default branch
This commit is contained in:
@@ -93,6 +93,11 @@ public class GitChangesetViewer implements ChangesetViewer
|
||||
@Override
|
||||
public ChangesetPagingResult getChangesets(int start, int max)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("fetch changesets. start: {}, max: {}", start, max);
|
||||
}
|
||||
|
||||
ChangesetPagingResult changesets = null;
|
||||
File directory = handler.getDirectory(repository);
|
||||
org.eclipse.jgit.lib.Repository gr = null;
|
||||
@@ -150,6 +155,87 @@ public class GitChangesetViewer implements ChangesetViewer
|
||||
return changesets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param path
|
||||
* @param revision
|
||||
* @param start
|
||||
* @param max
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ChangesetPagingResult getChangesets(String path, String revision,
|
||||
int start, int max)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"fetch changesets for path {} and revision {}. start: {}, max: {}",
|
||||
new Object[] { path,
|
||||
revision, start, max });
|
||||
}
|
||||
|
||||
ChangesetPagingResult changesets = null;
|
||||
File directory = handler.getDirectory(repository);
|
||||
org.eclipse.jgit.lib.Repository gr = null;
|
||||
GitChangesetConverter converter = null;
|
||||
|
||||
try
|
||||
{
|
||||
gr = GitUtil.open(directory);
|
||||
|
||||
int counter = 0;
|
||||
List<Changeset> changesetList = new ArrayList<Changeset>();
|
||||
|
||||
if (!gr.getAllRefs().isEmpty())
|
||||
{
|
||||
converter = new GitChangesetConverter(gr, GitUtil.ID_LENGTH);
|
||||
|
||||
Git git = new Git(gr);
|
||||
ObjectId revisionId = GitUtil.getRevisionId(gr, revision);
|
||||
|
||||
if (revisionId != null)
|
||||
{
|
||||
for (RevCommit commit :
|
||||
git.log().add(revisionId).addPath(path).call())
|
||||
{
|
||||
if ((counter >= start) && (counter < start + max))
|
||||
{
|
||||
changesetList.add(converter.createChangeset(commit));
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
else if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("could not find repository head of repository {}",
|
||||
repository.getName());
|
||||
}
|
||||
}
|
||||
|
||||
changesets = new ChangesetPagingResult(counter, changesetList);
|
||||
}
|
||||
catch (NoHeadException ex)
|
||||
{
|
||||
logger.error("could not read changesets", ex);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.error("could not open repository", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(converter);
|
||||
GitUtil.close(gr);
|
||||
}
|
||||
|
||||
return changesets;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
|
||||
Reference in New Issue
Block a user