mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
update jgit to version 2.0.0.201206130900-r
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -401,7 +401,7 @@
|
||||
<jetty.version>7.6.4.v20120524</jetty.version>
|
||||
|
||||
<!-- repostitory libraries -->
|
||||
<jgit.version>1.3.0.201202151440-r</jgit.version>
|
||||
<jgit.version>2.0.0.201206130900-r</jgit.version>
|
||||
<svnkit.version>1.7.5-1</svnkit.version>
|
||||
|
||||
<!-- build properties -->
|
||||
|
||||
@@ -37,6 +37,7 @@ package sonia.scm.repository;
|
||||
|
||||
import org.eclipse.jgit.api.BlameCommand;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.blame.BlameResult;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
@@ -136,7 +137,6 @@ public class GitBlameViewer implements BlameViewer
|
||||
blameLine.setLineNumber(i + 1);
|
||||
blameLine.setAuthor(new Person(author.getName(),
|
||||
author.getEmailAddress()));
|
||||
|
||||
blameLine.setDescription(commit.getShortMessage());
|
||||
|
||||
long when = GitUtil.getCommitTime(commit);
|
||||
@@ -160,6 +160,10 @@ public class GitBlameViewer implements BlameViewer
|
||||
{
|
||||
logger.error("could not open repository", ex);
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
logger.error("could not create blame view", ex);
|
||||
}
|
||||
|
||||
return blameResult;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ package sonia.scm.repository;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
@@ -198,6 +199,10 @@ public class GitChangesetViewer implements ChangesetViewer
|
||||
{
|
||||
logger.error("could not read changesets", ex);
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
logger.error("could not read changesets", ex);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.error("could not open repository", ex);
|
||||
@@ -279,6 +284,10 @@ public class GitChangesetViewer implements ChangesetViewer
|
||||
{
|
||||
logger.error("could not read changesets", ex);
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
logger.error("could not read changesets", ex);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.error("could not open repository", ex);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -38,6 +39,7 @@ import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
@@ -113,6 +115,10 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
|
||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(request.getPath()),
|
||||
"path is empty or null");
|
||||
|
||||
BlameResult result = null;
|
||||
|
||||
try
|
||||
{
|
||||
org.eclipse.jgit.lib.Repository gr = open();
|
||||
org.eclipse.jgit.api.BlameCommand blame = new Git(gr).blame();
|
||||
|
||||
@@ -127,7 +133,8 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
|
||||
if (gitBlameResult == null)
|
||||
{
|
||||
throw new RepositoryException(
|
||||
"could not create blame result for path ".concat(request.getPath()));
|
||||
"could not create blame result for path ".concat(
|
||||
request.getPath()));
|
||||
}
|
||||
|
||||
List<BlameLine> blameLines = new ArrayList<BlameLine>();
|
||||
@@ -163,6 +170,13 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
|
||||
}
|
||||
}
|
||||
|
||||
return new sonia.scm.repository.BlameResult(i, blameLines);
|
||||
result = new BlameResult(i, blameLines);
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
throw new RepositoryException("could not create blame view", ex);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -38,6 +39,7 @@ import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
@@ -51,6 +53,7 @@ import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.GitChangesetConverter;
|
||||
import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -154,10 +157,11 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Override
|
||||
public ChangesetPagingResult getChangesets(LogCommandRequest request)
|
||||
throws IOException
|
||||
throws IOException, RepositoryException
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -257,6 +261,10 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
|
||||
changesets = new ChangesetPagingResult(0, new ArrayList<Changeset>());
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
throw new RepositoryException("could not create change log", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(converter);
|
||||
|
||||
@@ -38,12 +38,16 @@ package sonia.scm.web;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.io.RegexResourceProcessor;
|
||||
import sonia.scm.io.ResourceProcessor;
|
||||
import sonia.scm.repository.GitUtil;
|
||||
@@ -75,6 +79,12 @@ public class GitRepositoryViewer
|
||||
/** Field description */
|
||||
public static final String RESOURCE_GITINDEX = "/sonia/scm/git.index.html";
|
||||
|
||||
/**
|
||||
* the logger for GitRepositoryViewer
|
||||
*/
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitRepositoryViewer.class);
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -107,6 +117,8 @@ public class GitRepositoryViewer
|
||||
int c = 0;
|
||||
ObjectId head = GitUtil.getRepositoryHead(repository);
|
||||
|
||||
try
|
||||
{
|
||||
for (RevCommit commit : git.log().add(head).call())
|
||||
{
|
||||
appendCommit(sb, commit);
|
||||
@@ -118,6 +130,11 @@ public class GitRepositoryViewer
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
logger.error("could not read changesets", ex);
|
||||
}
|
||||
}
|
||||
|
||||
processor.addVariable("commits", sb.toString());
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -39,6 +40,7 @@ import org.junit.Test;
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
@@ -60,9 +62,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAll() throws IOException
|
||||
public void testGetAll() throws IOException, RepositoryException
|
||||
{
|
||||
ChangesetPagingResult result =
|
||||
createCommand().getChangesets(new LogCommandRequest());
|
||||
@@ -77,9 +80,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllByPath() throws IOException
|
||||
public void testGetAllByPath() throws IOException, RepositoryException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -100,9 +104,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllWithLimit() throws IOException
|
||||
public void testGetAllWithLimit() throws IOException, RepositoryException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -130,9 +135,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllWithPaging() throws IOException
|
||||
public void testGetAllWithPaging() throws IOException, RepositoryException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -189,9 +195,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetRange() throws IOException
|
||||
public void testGetRange() throws IOException, RepositoryException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user