merge with default branch

This commit is contained in:
Sebastian Sdorra
2011-11-19 13:02:05 +01:00
320 changed files with 7673 additions and 484 deletions

View File

@@ -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 */