mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-22 16:29:51 +01:00
Merge with 2.0.0-m3
This commit is contained in:
@@ -205,7 +205,7 @@ public final class GitUtil
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
throw new InternalRepositoryException(ContextEntry.ContextBuilder.entity("remote", directory.toString()).in(remoteRepository), "could not fetch", ex);
|
||||
throw new InternalRepositoryException(ContextEntry.ContextBuilder.entity("Remote", directory.toString()).in(remoteRepository), "could not fetch", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
|
||||
|
||||
if (gitBlameResult == null)
|
||||
{
|
||||
throw new InternalRepositoryException(entity("path", request.getPath()).in(repository),
|
||||
throw new InternalRepositoryException(entity("Path", request.getPath()).in(repository),
|
||||
"could not create blame result for path");
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,9 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -128,10 +131,11 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
if (Util.isNotEmpty(request.getRevision()))
|
||||
{
|
||||
logger.error("could not find revision {}", request.getRevision());
|
||||
throw notFound(entity("Revision", request.getRevision()).in(this.repository));
|
||||
}
|
||||
else if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("coul not find head of repository, empty?");
|
||||
logger.warn("could not find head of repository, empty?");
|
||||
}
|
||||
|
||||
result = new BrowserResult(Constants.HEAD, createEmtpyRoot());
|
||||
@@ -354,7 +358,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotFoundException("file", request.getPath());
|
||||
throw notFound(entity("File", request.getPath()).in("Revision", revId.getName()).in(this.repository));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
import org.eclipse.jgit.revwalk.filter.RevFilter;
|
||||
import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
|
||||
import org.eclipse.jgit.treewalk.filter.PathFilter;
|
||||
import org.eclipse.jgit.treewalk.filter.TreeFilter;
|
||||
@@ -79,6 +78,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
*/
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitLogCommand.class);
|
||||
public static final String REVISION = "Revision";
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
@@ -143,6 +143,10 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
{
|
||||
logger.error("could not open repository", ex);
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
throw notFound(entity(REVISION, revision).in(this.repository));
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(converter);
|
||||
@@ -208,7 +212,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
if (!Strings.isNullOrEmpty(request.getAncestorChangeset())) {
|
||||
ancestorId = repository.resolve(request.getAncestorChangeset());
|
||||
if (ancestorId == null) {
|
||||
throw notFound(entity("Revision", request.getAncestorChangeset()).in(this.repository));
|
||||
throw notFound(entity(REVISION, request.getAncestorChangeset()).in(this.repository));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +254,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
}
|
||||
}
|
||||
} else if (ancestorId != null) {
|
||||
throw notFound(entity("Revision", request.getBranch()).in(this.repository));
|
||||
throw notFound(entity(REVISION, request.getBranch()).in(this.repository));
|
||||
}
|
||||
|
||||
if (branch != null) {
|
||||
@@ -267,7 +271,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
}
|
||||
catch (MissingObjectException e)
|
||||
{
|
||||
throw notFound(entity("Revision", e.getObjectId().getName()).in(repository));
|
||||
throw notFound(entity(REVISION, e.getObjectId().getName()).in(repository));
|
||||
}
|
||||
catch (NotFoundException e)
|
||||
{
|
||||
@@ -285,17 +289,4 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
|
||||
return changesets;
|
||||
}
|
||||
|
||||
private ObjectId computeCommonAncestor(LogCommandRequest request, Repository repository, ObjectId startId, Ref branch) throws IOException {
|
||||
try (RevWalk mergeBaseWalk = new RevWalk(repository)) {
|
||||
mergeBaseWalk.setRevFilter(RevFilter.MERGE_BASE);
|
||||
if (startId != null) {
|
||||
mergeBaseWalk.markStart(mergeBaseWalk.lookupCommit(startId));
|
||||
} else {
|
||||
mergeBaseWalk.markStart(mergeBaseWalk.lookupCommit(branch.getObjectId()));
|
||||
}
|
||||
mergeBaseWalk.markStart(mergeBaseWalk.parseCommit(repository.resolve(request.getAncestorChangeset())));
|
||||
return mergeBaseWalk.next().getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class GitMergeCommand extends AbstractGitCommand implements MergeCommand
|
||||
private ObjectId resolveRevisionOrThrowNotFound(Repository repository, String revision) throws IOException {
|
||||
ObjectId resolved = repository.resolve(revision);
|
||||
if (resolved == null) {
|
||||
throw notFound(entity("revision", revision).in(context.getRepository()));
|
||||
throw notFound(entity("Revision", revision).in(context.getRepository()));
|
||||
} else {
|
||||
return resolved;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class GitMergeCommand extends AbstractGitCommand implements MergeCommand
|
||||
clone.checkout().setStartPoint(targetRevision.getName()).setName(target).setCreateBranch(true).call();
|
||||
} catch (RefNotFoundException e) {
|
||||
logger.debug("could not checkout target branch {} for merge as local branch", target, e);
|
||||
throw notFound(entity("revision", target).in(context.getRepository()));
|
||||
throw notFound(entity("Revision", target).in(context.getRepository()));
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not checkout target branch for merge as local branch: " + target, e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user