Merge pull request #1149 from scm-manager/feature/cleanup_service_provider

Remove redundant constructor parameter
This commit is contained in:
Sebastian Sdorra
2020-05-13 09:41:31 +02:00
committed by GitHub
80 changed files with 308 additions and 425 deletions

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -77,14 +77,12 @@ class AbstractGitCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
AbstractGitCommand(GitContext context,
sonia.scm.repository.Repository repository)
AbstractGitCommand(GitContext context)
{
this.repository = repository;
this.repository = context.getRepository();
this.context = context;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -63,15 +63,12 @@ public abstract class AbstractGitIncomingOutgoingCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
AbstractGitIncomingOutgoingCommand(GitRepositoryHandler handler,
GitContext context, Repository repository)
AbstractGitIncomingOutgoingCommand(GitRepositoryHandler handler, GitContext context)
{
super(context, repository);
super(context);
this.handler = handler;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -67,15 +67,12 @@ public abstract class AbstractGitPushOrPullCommand extends AbstractGitCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
protected AbstractGitPushOrPullCommand(GitRepositoryHandler handler,
GitContext context, sonia.scm.repository.Repository repository)
protected AbstractGitPushOrPullCommand(GitRepositoryHandler handler, GitContext context)
{
super(context, repository);
super(context);
this.handler = handler;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -40,7 +40,6 @@ import sonia.scm.repository.BlameResult;
import sonia.scm.repository.GitUtil;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Person;
import sonia.scm.repository.Repository;
import java.io.IOException;
import java.util.ArrayList;
@@ -65,9 +64,9 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
//~--- constructors ---------------------------------------------------------
public GitBlameCommand(GitContext context, Repository repository)
public GitBlameCommand(GitContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.eclipse.jgit.api.Git;
@@ -34,7 +34,6 @@ import sonia.scm.repository.GitUtil;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.PostReceiveRepositoryHookEvent;
import sonia.scm.repository.PreReceiveRepositoryHookEvent;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryHookEvent;
import sonia.scm.repository.RepositoryHookType;
import sonia.scm.repository.api.BranchRequest;
@@ -57,8 +56,8 @@ public class GitBranchCommand extends AbstractGitCommand implements BranchComman
private final HookContextFactory hookContextFactory;
private final ScmEventBus eventBus;
GitBranchCommand(GitContext context, Repository repository, HookContextFactory hookContextFactory, ScmEventBus eventBus) {
super(context, repository);
GitBranchCommand(GitContext context, HookContextFactory hookContextFactory, ScmEventBus eventBus) {
super(context);
this.hookContextFactory = hookContextFactory;
this.eventBus = eventBus;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -37,7 +37,6 @@ import org.slf4j.LoggerFactory;
import sonia.scm.repository.Branch;
import sonia.scm.repository.GitUtil;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import java.io.IOException;
import java.util.List;
@@ -54,9 +53,9 @@ public class GitBranchesCommand extends AbstractGitCommand implements BranchesCo
private static final Logger LOG = LoggerFactory.getLogger(GitBranchesCommand.class);
public GitBranchesCommand(GitContext context, Repository repository)
public GitBranchesCommand(GitContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -51,7 +51,6 @@ import sonia.scm.repository.FileObject;
import sonia.scm.repository.GitSubModuleParser;
import sonia.scm.repository.GitUtil;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SubRepository;
import sonia.scm.store.Blob;
import sonia.scm.store.BlobStore;
@@ -112,8 +111,8 @@ public class GitBrowseCommand extends AbstractGitCommand
private int resultCount = 0;
public GitBrowseCommand(GitContext context, Repository repository, LfsBlobStoreFactory lfsBlobStoreFactory, SyncAsyncExecutor executor) {
super(context, repository);
public GitBrowseCommand(GitContext context, LfsBlobStoreFactory lfsBlobStoreFactory, SyncAsyncExecutor executor) {
super(context);
this.lfsBlobStoreFactory = lfsBlobStoreFactory;
this.executor = executor;
}
@@ -326,8 +325,7 @@ public class GitBrowseCommand extends AbstractGitCommand
logger.debug("read submodules of {} at {}", repository.getName(), revId);
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
new GitCatCommand(context, repository, lfsBlobStoreFactory).getContent(repo, revId,
PATH_MODULES, baos);
new GitCatCommand(context, lfsBlobStoreFactory).getContent(repo, revId, PATH_MODULES, baos);
return GitSubModuleParser.parse(baos.toString());
} catch (NotFoundException ex) {
logger.trace("could not find .gitmodules: {}", ex.getMessage());

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.eclipse.jgit.errors.MissingObjectException;
@@ -61,8 +61,8 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand {
private final LfsBlobStoreFactory lfsBlobStoreFactory;
public GitCatCommand(GitContext context, sonia.scm.repository.Repository repository, LfsBlobStoreFactory lfsBlobStoreFactory) {
super(context, repository);
public GitCatCommand(GitContext context, LfsBlobStoreFactory lfsBlobStoreFactory) {
super(context);
this.lfsBlobStoreFactory = lfsBlobStoreFactory;
}

View File

@@ -21,13 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.DiffFormatter;
import org.eclipse.jgit.util.QuotedString;
import sonia.scm.repository.Repository;
import sonia.scm.repository.api.DiffCommandBuilder;
import java.io.BufferedOutputStream;
@@ -42,8 +41,8 @@ import static java.nio.charset.StandardCharsets.UTF_8;
*/
public class GitDiffCommand extends AbstractGitCommand implements DiffCommand {
GitDiffCommand(GitContext context, Repository repository) {
super(context, repository);
GitDiffCommand(GitContext context) {
super(context);
}
@Override

View File

@@ -21,14 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.DiffFormatter;
import sonia.scm.repository.GitUtil;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.api.DiffFile;
import sonia.scm.repository.api.DiffResult;
import sonia.scm.repository.api.Hunk;
@@ -40,8 +39,8 @@ import java.util.stream.Collectors;
public class GitDiffResultCommand extends AbstractGitCommand implements DiffResultCommand {
GitDiffResultCommand(GitContext context, Repository repository) {
super(context, repository);
GitDiffResultCommand(GitContext context) {
super(context);
}
public DiffResult getDiffResult(DiffCommandRequest diffCommandRequest) throws IOException {

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -30,7 +30,6 @@ import org.eclipse.jgit.api.LogCommand;
import org.eclipse.jgit.lib.ObjectId;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.GitRepositoryHandler;
import sonia.scm.repository.Repository;
import java.io.IOException;
@@ -47,15 +46,12 @@ public class GitIncomingCommand extends AbstractGitIncomingOutgoingCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
GitIncomingCommand(GitRepositoryHandler handler, GitContext context,
Repository repository)
GitIncomingCommand(GitRepositoryHandler handler, GitContext context)
{
super(handler, context, repository);
super(handler, context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -77,13 +77,12 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
* Constructs ...
*
*
* @param context
*
* @param context
* @param repository
*/
GitLogCommand(GitContext context, sonia.scm.repository.Repository repository)
GitLogCommand(GitContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.google.common.collect.ImmutableSet;
@@ -61,8 +61,8 @@ public class GitMergeCommand extends AbstractGitCommand implements MergeCommand
MergeStrategy.SQUASH
);
GitMergeCommand(GitContext context, sonia.scm.repository.Repository repository, GitWorkdirFactory workdirFactory) {
super(context, repository);
GitMergeCommand(GitContext context, GitWorkdirFactory workdirFactory) {
super(context);
this.workdirFactory = workdirFactory;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import lombok.extern.slf4j.Slf4j;
@@ -35,7 +35,6 @@ import org.eclipse.jgit.treewalk.TreeWalk;
import sonia.scm.repository.GitUtil;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Modifications;
import sonia.scm.repository.Repository;
import java.io.IOException;
import java.text.MessageFormat;
@@ -47,8 +46,8 @@ import static sonia.scm.ContextEntry.ContextBuilder.entity;
@Slf4j
public class GitModificationsCommand extends AbstractGitCommand implements ModificationsCommand {
protected GitModificationsCommand(GitContext context, Repository repository) {
super(context, repository);
protected GitModificationsCommand(GitContext context) {
super(context);
}
private Modifications createModifications(TreeWalk treeWalk, RevCommit commit, RevWalk revWalk, String revision)

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.google.common.util.concurrent.Striped;
@@ -53,8 +53,8 @@ public class GitModifyCommand extends AbstractGitCommand implements ModifyComman
private final GitWorkdirFactory workdirFactory;
private final LfsBlobStoreFactory lfsBlobStoreFactory;
GitModifyCommand(GitContext context, Repository repository, GitWorkdirFactory workdirFactory, LfsBlobStoreFactory lfsBlobStoreFactory) {
super(context, repository);
GitModifyCommand(GitContext context, GitWorkdirFactory workdirFactory, LfsBlobStoreFactory lfsBlobStoreFactory) {
super(context);
this.workdirFactory = workdirFactory;
this.lfsBlobStoreFactory = lfsBlobStoreFactory;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -30,7 +30,6 @@ import org.eclipse.jgit.api.LogCommand;
import org.eclipse.jgit.lib.ObjectId;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.GitRepositoryHandler;
import sonia.scm.repository.Repository;
import java.io.IOException;
@@ -47,15 +46,12 @@ public class GitOutgoingCommand extends AbstractGitIncomingOutgoingCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
GitOutgoingCommand(GitRepositoryHandler handler, GitContext context,
Repository repository)
GitOutgoingCommand(GitRepositoryHandler handler, GitContext context)
{
super(handler, context, repository);
super(handler, context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -70,15 +70,12 @@ public class GitPullCommand extends AbstractGitPushOrPullCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
public GitPullCommand(GitRepositoryHandler handler, GitContext context,
Repository repository)
public GitPullCommand(GitRepositoryHandler handler, GitContext context)
{
super(handler, context, repository);
super(handler, context);
}
//~--- methods --------------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -29,7 +29,6 @@ package sonia.scm.repository.spi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.GitRepositoryHandler;
import sonia.scm.repository.Repository;
import sonia.scm.repository.api.PushResponse;
import java.io.IOException;
@@ -53,15 +52,12 @@ public class GitPushCommand extends AbstractGitPushOrPullCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
public GitPushCommand(GitRepositoryHandler handler, GitContext context,
Repository repository)
public GitPushCommand(GitRepositoryHandler handler, GitContext context)
{
super(handler, context, repository);
super(handler, context);
this.handler = handler;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.google.common.collect.ImmutableSet;
@@ -58,7 +58,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
Command.LOG,
Command.TAGS,
Command.BRANCH,
Command.BRANCHES,
Command.BRANCHES,
Command.INCOMING,
Command.OUTGOING,
Command.PUSH,
@@ -73,7 +73,6 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
public GitRepositoryServiceProvider(GitRepositoryHandler handler, Repository repository, GitRepositoryConfigStoreProvider storeProvider, LfsBlobStoreFactory lfsBlobStoreFactory, HookContextFactory hookContextFactory, ScmEventBus eventBus, SyncAsyncExecutorProvider executorProvider) {
this.handler = handler;
this.repository = repository;
this.lfsBlobStoreFactory = lfsBlobStoreFactory;
this.hookContextFactory = hookContextFactory;
this.eventBus = eventBus;
@@ -106,7 +105,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public BlameCommand getBlameCommand()
{
return new GitBlameCommand(context, repository);
return new GitBlameCommand(context);
}
/**
@@ -118,7 +117,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public BranchesCommand getBranchesCommand()
{
return new GitBranchesCommand(context, repository);
return new GitBranchesCommand(context);
}
/**
@@ -130,7 +129,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public BranchCommand getBranchCommand()
{
return new GitBranchCommand(context, repository, hookContextFactory, eventBus);
return new GitBranchCommand(context, hookContextFactory, eventBus);
}
/**
@@ -142,7 +141,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public BrowseCommand getBrowseCommand()
{
return new GitBrowseCommand(context, repository, lfsBlobStoreFactory, executorProvider.createExecutorWithDefaultTimeout());
return new GitBrowseCommand(context, lfsBlobStoreFactory, executorProvider.createExecutorWithDefaultTimeout());
}
/**
@@ -154,7 +153,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public CatCommand getCatCommand()
{
return new GitCatCommand(context, repository, lfsBlobStoreFactory);
return new GitCatCommand(context, lfsBlobStoreFactory);
}
/**
@@ -166,12 +165,12 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public DiffCommand getDiffCommand()
{
return new GitDiffCommand(context, repository);
return new GitDiffCommand(context);
}
@Override
public DiffResultCommand getDiffResultCommand() {
return new GitDiffResultCommand(context, repository);
return new GitDiffResultCommand(context);
}
/**
@@ -183,7 +182,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public IncomingCommand getIncomingCommand()
{
return new GitIncomingCommand(handler, context, repository);
return new GitIncomingCommand(handler, context);
}
/**
@@ -195,12 +194,12 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public LogCommand getLogCommand()
{
return new GitLogCommand(context, repository);
return new GitLogCommand(context);
}
@Override
public ModificationsCommand getModificationsCommand() {
return new GitModificationsCommand(context,repository);
return new GitModificationsCommand(context);
}
/**
@@ -212,7 +211,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public OutgoingCommand getOutgoingCommand()
{
return new GitOutgoingCommand(handler, context, repository);
return new GitOutgoingCommand(handler, context);
}
/**
@@ -224,7 +223,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public PullCommand getPullCommand()
{
return new GitPullCommand(handler, context, repository);
return new GitPullCommand(handler, context);
}
/**
@@ -236,7 +235,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public PushCommand getPushCommand()
{
return new GitPushCommand(handler, context, repository);
return new GitPushCommand(handler, context);
}
/**
@@ -260,17 +259,17 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public TagsCommand getTagsCommand()
{
return new GitTagsCommand(context, repository);
return new GitTagsCommand(context);
}
@Override
public MergeCommand getMergeCommand() {
return new GitMergeCommand(context, repository, handler.getWorkdirFactory());
return new GitMergeCommand(context, handler.getWorkdirFactory());
}
@Override
public ModifyCommand getModifyCommand() {
return new GitModifyCommand(context, repository, handler.getWorkdirFactory(), lfsBlobStoreFactory);
return new GitModifyCommand(context, handler.getWorkdirFactory(), lfsBlobStoreFactory);
}
@Override
@@ -285,9 +284,6 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
/** Field description */
private final GitRepositoryHandler handler;
/** Field description */
private final Repository repository;
private final LfsBlobStoreFactory lfsBlobStoreFactory;
private final HookContextFactory hookContextFactory;

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -37,7 +37,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.GitUtil;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.Tag;
import java.io.IOException;
@@ -55,13 +54,12 @@ public class GitTagsCommand extends AbstractGitCommand implements TagsCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
public GitTagsCommand(GitContext context, Repository repository)
public GitTagsCommand(GitContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -40,7 +40,7 @@ import static org.junit.Assert.assertNotNull;
/**
* Unit tests for {@link GitBlameCommand}.
*
*
* @author Sebastian Sdorra
*/
public class GitBlameCommandTest extends AbstractGitCommandTestBase
@@ -48,7 +48,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
/**
* Tests blame command with default branch.
*
*
* @throws IOException
* @
*/
@@ -60,18 +60,18 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
BlameResult result = createCommand().getBlameResult(request);
assertNotNull(result);
assertEquals(2, result.getTotal());
assertEquals(2, result.getTotal());
assertEquals("435df2f061add3589cb326cc64be9b9c3897ceca", result.getLine(0).getRevision());
assertEquals("fcd0ef1831e4002ac43ea539f4094334c79ea9ec", result.getLine(1).getRevision());
// set default branch and test again
createContext().setConfig(new GitRepositoryConfig("test-branch"));
result = createCommand().getBlameResult(request);
assertNotNull(result);
assertEquals(1, result.getTotal());
assertEquals(1, result.getTotal());
assertEquals("3f76a12f08a6ba0dc988c68b7f0b2cd190efc3c4", result.getLine(0).getRevision());
}
/**
* Method description
*
@@ -156,6 +156,6 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
*/
private GitBlameCommand createCommand()
{
return new GitBlameCommand(createContext(), repository);
return new GitBlameCommand(createContext());
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Test;
@@ -107,11 +107,11 @@ public class GitBranchCommandTest extends AbstractGitCommandTestBase {
}
private GitBranchCommand createCommand() {
return new GitBranchCommand(createContext(), repository, hookContextFactory, eventBus);
return new GitBranchCommand(createContext(), hookContextFactory, eventBus);
}
private List<Branch> readBranches(GitContext context) throws IOException {
return new GitBranchesCommand(context, repository).getBranches();
return new GitBranchesCommand(context).getBranches();
}
@Test

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.eclipse.jgit.api.Git;
@@ -36,7 +36,6 @@ import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import sonia.scm.repository.Branch;
import sonia.scm.repository.GitRepositoryConfig;
import sonia.scm.repository.Repository;
import java.io.IOException;
import java.util.List;
@@ -73,7 +72,7 @@ class GitBranchesCommandTest {
@BeforeEach
void initCommand() {
master = createRef("master", "0000");
branchesCommand = new GitBranchesCommand(context, new Repository("1", "git", "space", "X")) {
branchesCommand = new GitBranchesCommand(context) {
@Override
Git createGit() {
return git;

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Test;
@@ -121,7 +121,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
@Test
public void testAsynchronousBrowse() throws IOException {
try (AsyncExecutorStepper executor = stepperAsynchronousExecutor()) {
GitBrowseCommand command = new GitBrowseCommand(createContext(), repository, null, executor);
GitBrowseCommand command = new GitBrowseCommand(createContext(), null, executor);
List<BrowserResult> updatedResults = new LinkedList<>();
BrowseCommandRequest request = new BrowseCommandRequest(updatedResults::add);
FileObject root = command.getBrowserResult(request).getFile();
@@ -354,6 +354,6 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
}
private GitBrowseCommand createCommand() {
return new GitBrowseCommand(createContext(), repository, lfsBlobStoreFactory, synchronousExecutor());
return new GitBrowseCommand(createContext(), lfsBlobStoreFactory, synchronousExecutor());
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.hamcrest.BaseMatcher;
@@ -46,7 +46,7 @@ import static org.mockito.Mockito.when;
/**
* Unit tests for {@link GitCatCommand}.
*
*
* TODO add not found test
*
* @author Sebastian Sdorra
@@ -61,9 +61,9 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
// without default branch, the repository head should be used
CatCommandRequest request = new CatCommandRequest();
request.setPath("a.txt");
assertEquals("a\nline for blame", execute(request));
// set default branch for repository and check again
createContext().setConfig(new GitRepositoryConfig("test-branch"));
assertEquals("a and b", execute(request));
@@ -134,7 +134,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
CatCommandRequest request = new CatCommandRequest();
request.setPath("b.txt");
InputStream catResultStream = new GitCatCommand(createContext(), repository, null).getCatResultStream(request);
InputStream catResultStream = new GitCatCommand(createContext(), null).getCatResultStream(request);
assertEquals('b', catResultStream.read());
assertEquals('\n', catResultStream.read());
@@ -157,7 +157,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
request.setRevision("lfs-test");
request.setPath("lfs-image.png");
InputStream catResultStream = new GitCatCommand(createContext(), repository, lfsBlobStoreFactory)
InputStream catResultStream = new GitCatCommand(createContext(), lfsBlobStoreFactory)
.getCatResultStream(request);
assertEquals('i', catResultStream.read());
@@ -174,8 +174,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
try
{
new GitCatCommand(createContext(), repository, null).getCatResult(request,
baos);
new GitCatCommand(createContext(), null).getCatResult(request, baos);
}
finally
{

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Test;
@@ -78,7 +78,7 @@ public class GitDiffCommandTest extends AbstractGitCommandTestBase {
@Test
public void diffForOneRevisionShouldCreateDiff() throws IOException {
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext());
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
diffCommandRequest.setRevision("3f76a12f08a6ba0dc988c68b7f0b2cd190efc3c4");
ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -88,7 +88,7 @@ public class GitDiffCommandTest extends AbstractGitCommandTestBase {
@Test
public void diffForOneBranchShouldCreateDiff() throws IOException {
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext());
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
diffCommandRequest.setRevision("test-branch");
ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -98,7 +98,7 @@ public class GitDiffCommandTest extends AbstractGitCommandTestBase {
@Test
public void diffForPathShouldCreateLimitedDiff() throws IOException {
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext());
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
diffCommandRequest.setRevision("test-branch");
diffCommandRequest.setPath("a.txt");
@@ -109,7 +109,7 @@ public class GitDiffCommandTest extends AbstractGitCommandTestBase {
@Test
public void diffBetweenTwoBranchesShouldCreateDiff() throws IOException {
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext());
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
diffCommandRequest.setRevision("master");
diffCommandRequest.setAncestorChangeset("test-branch");
@@ -120,7 +120,7 @@ public class GitDiffCommandTest extends AbstractGitCommandTestBase {
@Test
public void diffBetweenTwoBranchesForPathShouldCreateLimitedDiff() throws IOException {
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext());
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
diffCommandRequest.setRevision("master");
diffCommandRequest.setAncestorChangeset("test-branch");
@@ -132,7 +132,7 @@ public class GitDiffCommandTest extends AbstractGitCommandTestBase {
@Test
public void diffBetweenTwoBranchesWithMergedIntegrationBranchShouldCreateDiffOfAllIncomingChanges() throws IOException {
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext());
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
diffCommandRequest.setRevision("partially_merged");
diffCommandRequest.setAncestorChangeset("master");

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Test;
@@ -104,7 +104,7 @@ public class GitDiffResultCommandTest extends AbstractGitCommandTestBase {
}
private DiffResult createDiffResult(String s) throws IOException {
GitDiffResultCommand gitDiffResultCommand = new GitDiffResultCommand(createContext(), repository);
GitDiffResultCommand gitDiffResultCommand = new GitDiffResultCommand(createContext());
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
diffCommandRequest.setRevision(s);

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -32,7 +32,6 @@ import org.junit.Ignore;
import org.junit.Test;
import sonia.scm.api.v2.resources.GitRepositoryConfigStoreProvider;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.Repository;
import sonia.scm.store.InMemoryConfigurationStoreFactory;
import java.io.IOException;
@@ -82,7 +81,7 @@ public class GitIncomingCommandTest
assertCommitsEquals(c1, cpr.getChangesets().get(0));
assertCommitsEquals(c2, cpr.getChangesets().get(1));
}
/**
* Method description
*
@@ -97,8 +96,8 @@ public class GitIncomingCommandTest
write(outgoing, outgoingDirectory, "a.txt", "content of a.txt");
commit(outgoing, "added a");
GitPullCommand pull = new GitPullCommand(handler, new GitContext(incomingDirectory, null, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())), incomingRepository);
GitPullCommand pull = new GitPullCommand(handler, new GitContext(incomingDirectory, incomingRepository, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())));
PullCommandRequest req = new PullCommandRequest();
req.setRemoteRepository(outgoingRepository);
pull.pull(req);
@@ -182,7 +181,6 @@ public class GitIncomingCommandTest
*/
private GitIncomingCommand createCommand()
{
return new GitIncomingCommand(handler, new GitContext(incomingDirectory, incomingRepository, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())),
this.incomingRepository);
return new GitIncomingCommand(handler, new GitContext(incomingDirectory, incomingRepository, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())));
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Test;
@@ -110,6 +110,6 @@ public class GitLogCommandAncestorTest extends AbstractGitCommandTestBase
private GitLogCommand createCommand()
{
return new GitLogCommand(createContext(), repository);
return new GitLogCommand(createContext());
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.google.common.io.Files;
@@ -180,7 +180,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
assertEquals("douglas.adams@hitchhiker.com", c.getAuthor().getMail());
assertEquals("added a and b files", c.getDescription());
GitModificationsCommand gitModificationsCommand = new GitModificationsCommand(createContext(), repository);
GitModificationsCommand gitModificationsCommand = new GitModificationsCommand(createContext());
Modifications modifications = gitModificationsCommand.getModifications(revision);
assertNotNull(modifications);
@@ -279,6 +279,6 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
private GitLogCommand createCommand()
{
return new GitLogCommand(createContext(), repository);
return new GitLogCommand(createContext());
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.github.sdorra.shiro.ShiroRule;
@@ -317,7 +317,7 @@ public class GitMergeCommandTest extends AbstractGitCommandTestBase {
assertThat(mergeAuthor.getName()).isEqualTo("Dirk Gently");
assertThat(message).isEqualTo("squash three commits");
GitModificationsCommand modificationsCommand = new GitModificationsCommand(createContext(), repository);
GitModificationsCommand modificationsCommand = new GitModificationsCommand(createContext());
List<String> changes = modificationsCommand.getModifications("master").getAdded();
assertThat(changes.size()).isEqualTo(3);
}
@@ -423,7 +423,7 @@ public class GitMergeCommandTest extends AbstractGitCommandTestBase {
}
private GitMergeCommand createCommand(Consumer<Git> interceptor) {
return new GitMergeCommand(createContext(), repository, new SimpleGitWorkdirFactory(new WorkdirProvider())) {
return new GitMergeCommand(createContext(), new SimpleGitWorkdirFactory(new WorkdirProvider())) {
@Override
<R, W extends GitCloneWorker<R>> R inClone(Function<Git, W> workerSupplier, GitWorkdirFactory workdirFactory, String initialBranch) {
Function<Git, W> interceptedWorkerSupplier = git -> {

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Rule;
@@ -91,7 +91,7 @@ public class GitMergeCommand_Conflict_Test extends AbstractGitCommandTestBase {
}
private MergeConflictResult computeMergeConflictResult(String branchToMerge, String targetBranch) {
GitMergeCommand gitMergeCommand = new GitMergeCommand(createContext(), repository, new SimpleGitWorkdirFactory(new WorkdirProvider()));
GitMergeCommand gitMergeCommand = new GitMergeCommand(createContext(), new SimpleGitWorkdirFactory(new WorkdirProvider()));
MergeCommandRequest mergeCommandRequest = new MergeCommandRequest();
mergeCommandRequest.setBranchToMerge(branchToMerge);
mergeCommandRequest.setTargetBranch(targetBranch);

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -42,8 +42,8 @@ public class GitModificationsCommandTest extends AbstractRemoteCommandTestBase {
@Before
public void init() {
incomingModificationsCommand = new GitModificationsCommand(new GitContext(incomingDirectory, null, null), incomingRepository);
outgoingModificationsCommand = new GitModificationsCommand(new GitContext(outgoingDirectory, null, null), outgoingRepository);
incomingModificationsCommand = new GitModificationsCommand(new GitContext(incomingDirectory, incomingRepository, null));
outgoingModificationsCommand = new GitModificationsCommand(new GitContext(outgoingDirectory, outgoingRepository, null));
}
@Test
@@ -87,13 +87,11 @@ public class GitModificationsCommandTest extends AbstractRemoteCommandTestBase {
}
void pushOutgoingAndPullIncoming() throws IOException {
GitPushCommand cmd = new GitPushCommand(handler, new GitContext(outgoingDirectory, null, null),
outgoingRepository);
GitPushCommand cmd = new GitPushCommand(handler, new GitContext(outgoingDirectory, outgoingRepository, null));
PushCommandRequest request = new PushCommandRequest();
request.setRemoteRepository(incomingRepository);
cmd.push(request);
GitPullCommand pullCommand = new GitPullCommand(handler, new GitContext(incomingDirectory, null, null),
incomingRepository);
GitPullCommand pullCommand = new GitPullCommand(handler, new GitContext(incomingDirectory, incomingRepository, null));
PullCommandRequest pullRequest = new PullCommandRequest();
pullRequest.setRemoteRepository(incomingRepository);
pullCommand.pull(pullRequest);

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.github.sdorra.shiro.ShiroRule;
@@ -323,7 +323,7 @@ public class GitModifyCommandTest extends AbstractGitCommandTestBase {
}
private GitModifyCommand createCommand() {
return new GitModifyCommand(createContext(), repository, new SimpleGitWorkdirFactory(new WorkdirProvider()), lfsBlobStoreFactory);
return new GitModifyCommand(createContext(), new SimpleGitWorkdirFactory(new WorkdirProvider()), lfsBlobStoreFactory);
}
@FunctionalInterface

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.github.sdorra.shiro.ShiroRule;
@@ -130,7 +130,7 @@ public class GitModifyCommand_LFSTest extends AbstractGitCommandTestBase {
}
private GitModifyCommand createCommand() {
return new GitModifyCommand(createContext(), repository, new SimpleGitWorkdirFactory(new WorkdirProvider()), lfsBlobStoreFactory);
return new GitModifyCommand(createContext(), new SimpleGitWorkdirFactory(new WorkdirProvider()), lfsBlobStoreFactory);
}
@Override

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.github.sdorra.shiro.ShiroRule;
@@ -101,7 +101,7 @@ public class GitModifyCommand_withEmptyRepositoryTest extends AbstractGitCommand
}
private GitModifyCommand createCommand() {
return new GitModifyCommand(createContext(), repository, new SimpleGitWorkdirFactory(new WorkdirProvider()), lfsBlobStoreFactory);
return new GitModifyCommand(createContext(), new SimpleGitWorkdirFactory(new WorkdirProvider()), lfsBlobStoreFactory);
}
@FunctionalInterface

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -31,7 +31,6 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Test;
import sonia.scm.api.v2.resources.GitRepositoryConfigStoreProvider;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.Repository;
import sonia.scm.store.InMemoryConfigurationStoreFactory;
import java.io.IOException;
@@ -43,7 +42,7 @@ import static org.junit.Assert.assertNotNull;
/**
* Unit tests for {@link OutgoingCommand}.
*
*
* @author Sebastian Sdorra
*/
public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
@@ -98,8 +97,8 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
commit(outgoing, "added a");
GitPushCommand push = new GitPushCommand(handler,
new GitContext(outgoingDirectory, null, null),
outgoingRepository);
new GitContext(outgoingDirectory, outgoingRepository, null)
);
PushCommandRequest req = new PushCommandRequest();
req.setRemoteRepository(incomingRepository);
@@ -152,7 +151,6 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
*/
private GitOutgoingCommand createCommand()
{
return new GitOutgoingCommand(handler, new GitContext(outgoingDirectory, outgoingRepository, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())),
outgoingRepository);
return new GitOutgoingCommand(handler, new GitContext(outgoingDirectory, outgoingRepository, new GitRepositoryConfigStoreProvider(new InMemoryConfigurationStoreFactory())));
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -89,7 +89,6 @@ public class GitPushCommandTest extends AbstractRemoteCommandTestBase
*/
private GitPushCommand createCommand()
{
return new GitPushCommand(handler, new GitContext(outgoingDirectory, null, null),
outgoingRepository);
return new GitPushCommand(handler, new GitContext(outgoingDirectory, outgoingRepository, null));
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -38,14 +38,13 @@ public class AbstractCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
public AbstractCommand(HgCommandContext context, Repository repository)
public AbstractCommand(HgCommandContext context)
{
this.context = context;
this.repository = repository;
this.repository = context.getScmRepository();
}
//~--- methods --------------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -39,15 +39,12 @@ public class AbstractHgPushOrPullCommand extends AbstractCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
protected AbstractHgPushOrPullCommand(HgRepositoryHandler handler,
HgCommandContext context, Repository repository)
protected AbstractHgPushOrPullCommand(HgRepositoryHandler handler, HgCommandContext context)
{
super(context, repository);
super(context);
this.handler = handler;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory;
import sonia.scm.repository.BlameLine;
import sonia.scm.repository.BlameResult;
import sonia.scm.repository.Person;
import sonia.scm.repository.Repository;
import sonia.scm.web.HgUtil;
import java.io.IOException;
@@ -62,13 +61,12 @@ public class HgBlameCommand extends AbstractCommand implements BlameCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
HgBlameCommand(HgCommandContext context, Repository repository)
HgBlameCommand(HgCommandContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.aragost.javahg.Changeset;
@@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
import sonia.scm.ContextEntry;
import sonia.scm.repository.Branch;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.api.BranchRequest;
import sonia.scm.repository.util.WorkingCopy;
import sonia.scm.user.User;
@@ -48,8 +47,8 @@ public class HgBranchCommand extends AbstractCommand implements BranchCommand {
private final HgWorkdirFactory workdirFactory;
HgBranchCommand(HgCommandContext context, Repository repository, HgWorkdirFactory workdirFactory) {
super(context, repository);
HgBranchCommand(HgCommandContext context, HgWorkdirFactory workdirFactory) {
super(context);
this.workdirFactory = workdirFactory;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -30,7 +30,6 @@ import com.aragost.javahg.Changeset;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import sonia.scm.repository.Branch;
import sonia.scm.repository.Repository;
import java.util.List;
@@ -49,13 +48,12 @@ public class HgBranchesCommand extends AbstractCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
public HgBranchesCommand(HgCommandContext context, Repository repository)
public HgBranchesCommand(HgCommandContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -32,7 +32,6 @@ import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import sonia.scm.repository.BrowserResult;
import sonia.scm.repository.FileObject;
import sonia.scm.repository.Repository;
import sonia.scm.repository.spi.javahg.HgFileviewCommand;
import java.io.IOException;
@@ -50,13 +49,12 @@ public class HgBrowseCommand extends AbstractCommand implements BrowseCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
public HgBrowseCommand(HgCommandContext context, Repository repository)
public HgBrowseCommand(HgCommandContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.aragost.javahg.commands.ExecutionException;
@@ -31,7 +31,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.ContextEntry;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.web.HgUtil;
import java.io.IOException;
@@ -42,8 +41,8 @@ public class HgCatCommand extends AbstractCommand implements CatCommand {
private static final Logger log = LoggerFactory.getLogger(HgCatCommand.class);
HgCatCommand(HgCommandContext context, Repository repository) {
super(context, repository);
HgCatCommand(HgCommandContext context) {
super(context);
}
@Override

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -29,7 +29,6 @@ package sonia.scm.repository.spi;
import com.google.common.base.Strings;
import com.google.common.io.ByteStreams;
import com.google.common.io.Closeables;
import sonia.scm.repository.Repository;
import sonia.scm.repository.api.DiffCommandBuilder;
import sonia.scm.repository.api.DiffFormat;
import sonia.scm.repository.spi.javahg.HgDiffInternalCommand;
@@ -49,13 +48,12 @@ public class HgDiffCommand extends AbstractCommand implements DiffCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
HgDiffCommand(HgCommandContext context, Repository repository)
HgDiffCommand(HgCommandContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -31,7 +31,6 @@ import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.HgRepositoryHandler;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.spi.javahg.HgIncomingChangesetCommand;
import java.io.File;
@@ -56,15 +55,12 @@ public class HgIncomingCommand extends AbstractCommand
/**
* Constructs ...
*
*
* @param context
* @param repository
* @param context
* @param handler
*/
HgIncomingCommand(HgCommandContext context, Repository repository,
HgRepositoryHandler handler)
HgIncomingCommand(HgCommandContext context, HgRepositoryHandler handler)
{
super(context, repository);
super(context);
this.handler = handler;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -29,7 +29,6 @@ package sonia.scm.repository.spi;
import com.google.common.base.Strings;
import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.Repository;
import sonia.scm.repository.spi.javahg.HgLogChangesetCommand;
import java.util.ArrayList;
@@ -47,13 +46,12 @@ public class HgLogCommand extends AbstractCommand implements LogCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
HgLogCommand(HgCommandContext context, Repository repository)
HgLogCommand(HgCommandContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,17 +21,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import sonia.scm.repository.Modifications;
import sonia.scm.repository.Repository;
import sonia.scm.repository.spi.javahg.HgLogChangesetCommand;
public class HgModificationsCommand extends AbstractCommand implements ModificationsCommand {
HgModificationsCommand(HgCommandContext context, Repository repository) {
super(context, repository);
HgModificationsCommand(HgCommandContext context) {
super(context);
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -31,7 +31,6 @@ import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.HgRepositoryHandler;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.spi.javahg.HgOutgoingChangesetCommand;
import java.io.File;
@@ -56,15 +55,12 @@ public class HgOutgoingCommand extends AbstractCommand
/**
* Constructs ...
*
*
* @param context
* @param repository
* @param context
* @param handler
*/
public HgOutgoingCommand(HgCommandContext context, Repository repository,
HgRepositoryHandler handler)
public HgOutgoingCommand(HgCommandContext context, HgRepositoryHandler handler)
{
super(context, repository);
super(context);
this.handler = handler;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -32,7 +32,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.HgRepositoryHandler;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.api.PullResponse;
import java.io.IOException;
@@ -58,15 +57,12 @@ public class HgPullCommand extends AbstractHgPushOrPullCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
public HgPullCommand(HgRepositoryHandler handler, HgCommandContext context,
Repository repository)
public HgPullCommand(HgRepositoryHandler handler, HgCommandContext context)
{
super(handler, context, repository);
super(handler, context);
}
//~--- methods --------------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -32,7 +32,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.HgRepositoryHandler;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.api.PushResponse;
import java.io.IOException;
@@ -58,15 +57,12 @@ public class HgPushCommand extends AbstractHgPushOrPullCommand
/**
* Constructs ...
*
*
* @param handler
* @param handler
* @param context
* @param repository
*/
public HgPushCommand(HgRepositoryHandler handler, HgCommandContext context,
Repository repository)
public HgPushCommand(HgRepositoryHandler handler, HgCommandContext context)
{
super(handler, context, repository);
super(handler, context);
}
//~--- methods --------------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.google.common.io.Closeables;
@@ -48,9 +48,9 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
//J-
public static final Set<Command> COMMANDS = EnumSet.of(
Command.BLAME,
Command.BROWSE,
Command.BROWSE,
Command.CAT,
Command.DIFF,
Command.DIFF,
Command.LOG,
Command.TAGS,
Command.BRANCH,
@@ -72,7 +72,6 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
HgRepositoryServiceProvider(HgRepositoryHandler handler,
HgHookManager hookManager, Repository repository)
{
this.repository = repository;
this.handler = handler;
this.repositoryDirectory = handler.getDirectory(repository.getId());
this.context = new HgCommandContext(hookManager, handler, repository,
@@ -104,7 +103,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public HgBlameCommand getBlameCommand()
{
return new HgBlameCommand(context, repository);
return new HgBlameCommand(context);
}
/**
@@ -116,12 +115,12 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public BranchesCommand getBranchesCommand()
{
return new HgBranchesCommand(context, repository);
return new HgBranchesCommand(context);
}
@Override
public BranchCommand getBranchCommand() {
return new HgBranchCommand(context, repository, handler.getWorkdirFactory());
return new HgBranchCommand(context, handler.getWorkdirFactory());
}
/**
@@ -133,7 +132,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public HgBrowseCommand getBrowseCommand()
{
return new HgBrowseCommand(context, repository);
return new HgBrowseCommand(context);
}
/**
@@ -145,7 +144,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public HgCatCommand getCatCommand()
{
return new HgCatCommand(context, repository);
return new HgCatCommand(context);
}
/**
@@ -157,7 +156,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public HgDiffCommand getDiffCommand()
{
return new HgDiffCommand(context, repository);
return new HgDiffCommand(context);
}
/**
@@ -169,7 +168,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public IncomingCommand getIncomingCommand()
{
return new HgIncomingCommand(context, repository, handler);
return new HgIncomingCommand(context, handler);
}
/**
@@ -181,7 +180,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public HgLogCommand getLogCommand()
{
return new HgLogCommand(context, repository);
return new HgLogCommand(context);
}
/**
@@ -192,7 +191,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
*/
@Override
public ModificationsCommand getModificationsCommand() {
return new HgModificationsCommand(context,repository);
return new HgModificationsCommand(context);
}
/**
@@ -204,7 +203,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public OutgoingCommand getOutgoingCommand()
{
return new HgOutgoingCommand(context, repository, handler);
return new HgOutgoingCommand(context, handler);
}
/**
@@ -216,7 +215,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public PullCommand getPullCommand()
{
return new HgPullCommand(handler, context, repository);
return new HgPullCommand(handler, context);
}
/**
@@ -228,7 +227,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public PushCommand getPushCommand()
{
return new HgPushCommand(handler, context, repository);
return new HgPushCommand(handler, context);
}
@Override
@@ -269,7 +268,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public TagsCommand getTagsCommand()
{
return new HgTagsCommand(context, repository);
return new HgTagsCommand(context);
}
//~--- fields ---------------------------------------------------------------
@@ -280,9 +279,6 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
/** Field description */
private HgRepositoryHandler handler;
/** Field description */
private Repository repository;
/** Field description */
private File repositoryDirectory;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -30,7 +30,6 @@ import com.google.common.base.Function;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import sonia.scm.repository.Repository;
import sonia.scm.repository.Tag;
import sonia.scm.util.Util;
@@ -48,13 +47,12 @@ public class HgTagsCommand extends AbstractCommand implements TagsCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
public HgTagsCommand(HgCommandContext context, Repository repository)
public HgTagsCommand(HgCommandContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -111,6 +111,6 @@ public class HgBlameCommandTest extends AbstractHgCommandTestBase
*/
private BlameCommand createCommand()
{
return new HgBlameCommand(cmdContext, repository);
return new HgBlameCommand(cmdContext);
}
}

View File

@@ -62,7 +62,7 @@ public class HgBranchCommandTest extends AbstractHgCommandTestBase {
BranchRequest branchRequest = new BranchRequest();
branchRequest.setNewBranch("new_branch");
Branch newBranch = new HgBranchCommand(cmdContext, repository, workdirFactory).branch(branchRequest);
Branch newBranch = new HgBranchCommand(cmdContext, workdirFactory).branch(branchRequest);
assertThat(readBranches()).filteredOn(b -> b.getName().equals("new_branch")).isNotEmpty();
assertThat(cmdContext.open().changeset(newBranch.getRevision()).getParent1().getBranch()).isEqualTo("default");
@@ -74,7 +74,7 @@ public class HgBranchCommandTest extends AbstractHgCommandTestBase {
branchRequest.setParentBranch("test-branch");
branchRequest.setNewBranch("new_branch");
Branch newBranch = new HgBranchCommand(cmdContext, repository, workdirFactory).branch(branchRequest);
Branch newBranch = new HgBranchCommand(cmdContext, workdirFactory).branch(branchRequest);
assertThat(readBranches()).filteredOn(b -> b.getName().equals("new_branch")).isNotEmpty();
assertThat(cmdContext.open().changeset(newBranch.getRevision()).getParent1().getBranch()).isEqualTo("test-branch");
@@ -84,7 +84,7 @@ public class HgBranchCommandTest extends AbstractHgCommandTestBase {
public void shouldCloseBranch() {
String branchToBeClosed = "test-branch";
new HgBranchCommand(cmdContext, repository, workdirFactory).deleteOrClose(branchToBeClosed);
new HgBranchCommand(cmdContext, workdirFactory).deleteOrClose(branchToBeClosed);
assertThat(readBranches()).filteredOn(b -> b.getName().equals(branchToBeClosed)).isEmpty();
}
@@ -92,11 +92,11 @@ public class HgBranchCommandTest extends AbstractHgCommandTestBase {
public void shouldThrowInternalRepositoryException() {
String branchToBeClosed = "default";
new HgBranchCommand(cmdContext, repository, workdirFactory).deleteOrClose(branchToBeClosed);
assertThrows(InternalRepositoryException.class, () -> new HgBranchCommand(cmdContext, repository, workdirFactory).deleteOrClose(branchToBeClosed));
new HgBranchCommand(cmdContext, workdirFactory).deleteOrClose(branchToBeClosed);
assertThrows(InternalRepositoryException.class, () -> new HgBranchCommand(cmdContext, workdirFactory).deleteOrClose(branchToBeClosed));
}
private List<Branch> readBranches() {
return new HgBranchesCommand(cmdContext, repository).getBranches();
return new HgBranchesCommand(cmdContext).getBranches();
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.aragost.javahg.commands.LogCommand;
@@ -48,7 +48,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
public void testBrowseWithFilePath() throws IOException {
BrowseCommandRequest request = new BrowseCommandRequest();
request.setPath("a.txt");
FileObject file = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request).getFile();
FileObject file = new HgBrowseCommand(cmdContext).getBrowserResult(request).getFile();
assertEquals("a.txt", file.getName());
assertFalse(file.isDirectory());
assertTrue(file.getChildren() == null || file.getChildren().isEmpty());
@@ -83,8 +83,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
BrowseCommandRequest browseCommandRequest = new BrowseCommandRequest();
browseCommandRequest.setRevision("default");
BrowserResult result = new HgBrowseCommand(cmdContext,
repository).getBrowserResult(browseCommandRequest);
BrowserResult result = new HgBrowseCommand(cmdContext).getBrowserResult(browseCommandRequest);
assertThat(result.getRevision()).isEqualTo(defaultBranchRevision);
}
@@ -95,8 +94,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
request.setPath("c");
BrowserResult result = new HgBrowseCommand(cmdContext,
repository).getBrowserResult(request);
BrowserResult result = new HgBrowseCommand(cmdContext).getBrowserResult(request);
assertNotNull(result);
@@ -163,8 +161,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
request.setRecursive(true);
BrowserResult result = new HgBrowseCommand(cmdContext,
repository).getBrowserResult(request);
BrowserResult result = new HgBrowseCommand(cmdContext).getBrowserResult(request);
assertNotNull(result);
@@ -185,7 +182,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
BrowseCommandRequest request = new BrowseCommandRequest();
request.setLimit(1);
BrowserResult result = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request);
BrowserResult result = new HgBrowseCommand(cmdContext).getBrowserResult(request);
FileObject root = result.getFile();
Collection<FileObject> foList = root.getChildren();
@@ -200,7 +197,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
request.setLimit(2);
request.setOffset(1);
BrowserResult result = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request);
BrowserResult result = new HgBrowseCommand(cmdContext).getBrowserResult(request);
FileObject root = result.getFile();
Collection<FileObject> foList = root.getChildren();
@@ -217,7 +214,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
request.setLimit(3);
request.setRecursive(true);
FileObject root = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request).getFile();
FileObject root = new HgBrowseCommand(cmdContext).getBrowserResult(request).getFile();
Collection<FileObject> foList = root.getChildren();
@@ -240,7 +237,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
request.setLimit(1);
request.setRecursive(true);
FileObject root = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request).getFile();
FileObject root = new HgBrowseCommand(cmdContext).getBrowserResult(request).getFile();
Collection<FileObject> foList = root.getChildren();
@@ -263,7 +260,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
request.setOffset(1);
request.setRecursive(true);
FileObject root = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request).getFile();
FileObject root = new HgBrowseCommand(cmdContext).getBrowserResult(request).getFile();
Collection<FileObject> foList = root.getChildren();
@@ -299,8 +296,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
}
private Collection<FileObject> getRootFromTip(BrowseCommandRequest request) throws IOException {
BrowserResult result = new HgBrowseCommand(cmdContext,
repository).getBrowserResult(request);
BrowserResult result = new HgBrowseCommand(cmdContext).getBrowserResult(request);
assertNotNull(result);

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Ignore;
@@ -77,7 +77,7 @@ public class HgCatCommandTest extends AbstractHgCommandTestBase {
CatCommandRequest request = new CatCommandRequest();
request.setPath("b.txt");
InputStream catResultStream = new HgCatCommand(cmdContext, repository).getCatResultStream(request);
InputStream catResultStream = new HgCatCommand(cmdContext).getCatResultStream(request);
assertEquals('b', catResultStream.read());
assertEquals('\n', catResultStream.read());
@@ -88,7 +88,7 @@ public class HgCatCommandTest extends AbstractHgCommandTestBase {
private String execute(CatCommandRequest request) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new HgCatCommand(cmdContext, repository).getCatResult(request, baos);
new HgCatCommand(cmdContext).getCatResult(request, baos);
return baos.toString().trim();
}
}

View File

@@ -121,6 +121,6 @@ public class HgIncomingCommandTest extends IncomingOutgoingTestBase
return new HgIncomingCommand(
new HgCommandContext(
HgTestUtil.createHookManager(), handler, incomingRepository,
incomingDirectory), incomingRepository, handler);
incomingDirectory), handler);
}
}

View File

@@ -154,7 +154,7 @@ public class HgLogCommandTest extends AbstractHgCommandTestBase
assertEquals("Douglas Adams", c.getAuthor().getName());
assertEquals("douglas.adams@hitchhiker.com", c.getAuthor().getMail());
assertEquals("added a and b files", c.getDescription());
ModificationsCommand modificationsCommand = new HgModificationsCommand(cmdContext, repository);
ModificationsCommand modificationsCommand = new HgModificationsCommand(cmdContext);
Modifications modifications = modificationsCommand.getModifications(revision);
assertNotNull(modifications);
@@ -195,6 +195,6 @@ public class HgLogCommandTest extends AbstractHgCommandTestBase
*/
private HgLogCommand createComamnd()
{
return new HgLogCommand(cmdContext, repository);
return new HgLogCommand(cmdContext);
}
}

View File

@@ -44,7 +44,7 @@ public class HgModificationsCommandTest extends IncomingOutgoingTestBase {
@Before
public void init() {
HgCommandContext outgoingContext = new HgCommandContext(HgTestUtil.createHookManager(), handler, outgoingRepository, outgoingDirectory);
outgoingModificationsCommand = new HgModificationsCommand(outgoingContext, outgoingRepository);
outgoingModificationsCommand = new HgModificationsCommand(outgoingContext);
}
@Test

View File

@@ -117,6 +117,6 @@ public class HgOutgoingCommandTest extends IncomingOutgoingTestBase
return new HgOutgoingCommand(
new HgCommandContext(
HgTestUtil.createHookManager(), handler, outgoingRepository,
outgoingDirectory), outgoingRepository, handler);
outgoingDirectory), handler);
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -44,13 +44,11 @@ public class AbstractSvnCommand
*
*
* @param context
* @param repository
* @param repositoryDirectory
*/
protected AbstractSvnCommand(SvnContext context, Repository repository)
protected AbstractSvnCommand(SvnContext context)
{
this.context = context;
this.repository = repository;
this.repository = context.getRepository();
}
//~--- methods --------------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -37,7 +37,6 @@ import org.tmatesoft.svn.core.wc.SVNRevision;
import sonia.scm.repository.BlameLine;
import sonia.scm.repository.BlameResult;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnBlameHandler;
import sonia.scm.util.Util;
@@ -53,9 +52,9 @@ import java.util.List;
public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand
{
public SvnBlameCommand(SvnContext context, Repository repository)
public SvnBlameCommand(SvnContext context)
{
super(context, repository);
super(context);
}
@Override

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -37,7 +37,6 @@ import org.tmatesoft.svn.core.SVNProperty;
import org.tmatesoft.svn.core.io.SVNRepository;
import sonia.scm.repository.BrowserResult;
import sonia.scm.repository.FileObject;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SubRepository;
import sonia.scm.repository.SvnUtil;
import sonia.scm.util.Util;
@@ -70,9 +69,9 @@ public class SvnBrowseCommand extends AbstractSvnCommand
private int resultCount = 0;
SvnBrowseCommand(SvnContext context, Repository repository)
SvnBrowseCommand(SvnContext context)
{
super(context, repository);
super(context);
}
@Override

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -32,7 +32,6 @@ import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.admin.SVNAdminClient;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnUtil;
import sonia.scm.repository.api.BundleResponse;
@@ -52,9 +51,9 @@ public class SvnBundleCommand extends AbstractSvnCommand
implements BundleCommand
{
public SvnBundleCommand(SvnContext context, Repository repository)
public SvnBundleCommand(SvnContext context)
{
super(context, repository);
super(context);
}
private static void dump(SVNAdminClient adminClient, File repository,

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -35,7 +35,6 @@ import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.admin.SVNLookClient;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnUtil;
import java.io.ByteArrayInputStream;
@@ -63,9 +62,9 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
//~--- constructors ---------------------------------------------------------
SvnCatCommand(SvnContext context, Repository repository)
SvnCatCommand(SvnContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -37,7 +37,6 @@ import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNDiffClient;
import org.tmatesoft.svn.core.wc.SVNRevision;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnUtil;
import sonia.scm.repository.api.DiffCommandBuilder;
import sonia.scm.repository.api.DiffFormat;
@@ -57,8 +56,8 @@ public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand {
private static final Logger logger =
LoggerFactory.getLogger(SvnDiffCommand.class);
public SvnDiffCommand(SvnContext context, Repository repository) {
super(context, repository);
public SvnDiffCommand(SvnContext context) {
super(context);
}
@Override

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -37,7 +37,6 @@ import org.tmatesoft.svn.core.io.SVNRepository;
import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnUtil;
import sonia.scm.util.Util;
@@ -57,9 +56,9 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
private static final Logger logger =
LoggerFactory.getLogger(SvnLogCommand.class);
SvnLogCommand(SvnContext context, Repository repository)
SvnLogCommand(SvnContext context)
{
super(context, repository);
super(context);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import lombok.extern.slf4j.Slf4j;
@@ -32,7 +32,6 @@ import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.admin.SVNLookClient;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Modifications;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnUtil;
import sonia.scm.util.Util;
@@ -41,8 +40,8 @@ import java.util.Collection;
@Slf4j
public class SvnModificationsCommand extends AbstractSvnCommand implements ModificationsCommand {
SvnModificationsCommand(SvnContext context, Repository repository) {
super(context, repository);
SvnModificationsCommand(SvnContext context) {
super(context);
}
@Override

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.apache.shiro.SecurityUtils;
@@ -46,9 +46,9 @@ public class SvnModifyCommand implements ModifyCommand {
private SvnWorkDirFactory workDirFactory;
private Repository repository;
SvnModifyCommand(SvnContext context, Repository repository, SvnWorkDirFactory workDirFactory) {
SvnModifyCommand(SvnContext context, SvnWorkDirFactory workDirFactory) {
this.context = context;
this.repository = repository;
this.repository = context.getRepository();
this.workDirFactory = workDirFactory;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import com.google.common.collect.ImmutableSet;
@@ -45,7 +45,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
/** Field description */
//J-
public static final Set<Command> COMMANDS = ImmutableSet.of(
Command.BLAME, Command.BROWSE, Command.CAT, Command.DIFF,
Command.BLAME, Command.BROWSE, Command.CAT, Command.DIFF,
Command.LOG, Command.BUNDLE, Command.UNBUNDLE, Command.MODIFY
);
//J+
@@ -56,7 +56,6 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
SvnRepositoryServiceProvider(SvnRepositoryHandler handler,
Repository repository, SvnWorkDirFactory workdirFactory)
{
this.repository = repository;
this.context = new SvnContext(repository, handler.getDirectory(repository.getId()));
this.workDirFactory = workdirFactory;
}
@@ -86,7 +85,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public SvnBlameCommand getBlameCommand()
{
return new SvnBlameCommand(context, repository);
return new SvnBlameCommand(context);
}
/**
@@ -98,7 +97,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public SvnBrowseCommand getBrowseCommand()
{
return new SvnBrowseCommand(context, repository);
return new SvnBrowseCommand(context);
}
/**
@@ -110,7 +109,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public BundleCommand getBundleCommand()
{
return new SvnBundleCommand(context, repository);
return new SvnBundleCommand(context);
}
/**
@@ -122,7 +121,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public SvnCatCommand getCatCommand()
{
return new SvnCatCommand(context, repository);
return new SvnCatCommand(context);
}
/**
@@ -134,7 +133,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public SvnDiffCommand getDiffCommand()
{
return new SvnDiffCommand(context, repository);
return new SvnDiffCommand(context);
}
/**
@@ -146,15 +145,15 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public SvnLogCommand getLogCommand()
{
return new SvnLogCommand(context, repository);
return new SvnLogCommand(context);
}
public ModificationsCommand getModificationsCommand() {
return new SvnModificationsCommand(context, repository);
return new SvnModificationsCommand(context);
}
public ModifyCommand getModifyCommand() {
return new SvnModifyCommand(context, repository, workDirFactory);
return new SvnModifyCommand(context, workDirFactory);
}
/**
@@ -178,7 +177,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
@Override
public UnbundleCommand getUnbundleCommand()
{
return new SvnUnbundleCommand(context, repository);
return new SvnUnbundleCommand(context);
}
//~--- fields ---------------------------------------------------------------
@@ -186,8 +185,5 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
/** Field description */
private final SvnContext context;
/** Field description */
private final Repository repository;
private final SvnWorkDirFactory workDirFactory;
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -36,7 +36,6 @@ import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.admin.SVNAdminClient;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnUtil;
import sonia.scm.repository.api.UnbundleResponse;
@@ -65,13 +64,12 @@ public class SvnUnbundleCommand extends AbstractSvnCommand
/**
* Constructs ...
*
* @param context
*
* @param context
* @param repository
*/
public SvnUnbundleCommand(SvnContext context, Repository repository)
public SvnUnbundleCommand(SvnContext context)
{
super(context, repository);
super(context);
}
//~--- methods --------------------------------------------------------------

View File

@@ -110,6 +110,6 @@ public class SvnBlameCommandTest extends AbstractSvnCommandTestBase
*/
private SvnBlameCommand createCommand()
{
return new SvnBlameCommand(createContext(), repository);
return new SvnBlameCommand(createContext());
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Test;
@@ -268,7 +268,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
*/
private SvnBrowseCommand createCommand()
{
return new SvnBrowseCommand(createContext(), repository);
return new SvnBrowseCommand(createContext());
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -57,8 +57,7 @@ public class SvnBundleCommandTest extends AbstractSvnCommandTestBase
File file = temp.newFile();
ByteSink sink = Files.asByteSink(file);
BundleCommandRequest req = new BundleCommandRequest(sink);
BundleResponse res = new SvnBundleCommand(createContext(),
repository).bundle(req);
BundleResponse res = new SvnBundleCommand(createContext()).bundle(req);
assertThat(res, notNullValue());
assertThat(res.getChangesetCount(), is(5l));

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.hamcrest.BaseMatcher;
@@ -111,7 +111,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
request.setPath("a.txt");
request.setRevision("1");
InputStream catResultStream = new SvnCatCommand(createContext(), repository).getCatResultStream(request);
InputStream catResultStream = new SvnCatCommand(createContext()).getCatResultStream(request);
assertEquals('a', catResultStream.read());
assertEquals('\n', catResultStream.read());
@@ -126,8 +126,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
try
{
new SvnCatCommand(createContext(), repository).getCatResult(request,
baos);
new SvnCatCommand(createContext()).getCatResult(request, baos);
}
finally
{

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -136,7 +136,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
checkDate(c.getDate());
assertEquals("perfect", c.getAuthor().getName());
assertNull("douglas.adams@hitchhiker.com", c.getAuthor().getMail());
SvnModificationsCommand modificationsCommand = new SvnModificationsCommand(createContext(), repository);
SvnModificationsCommand modificationsCommand = new SvnModificationsCommand(createContext());
Modifications modifications = modificationsCommand.getModifications("3");
assertNotNull(modifications);
@@ -177,6 +177,6 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
*/
private SvnLogCommand createCommand()
{
return new SvnLogCommand(createContext(), repository);
return new SvnLogCommand(createContext());
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.apache.shiro.subject.Subject;
@@ -57,7 +57,7 @@ public class SvnModifyCommandTest extends AbstractSvnCommandTestBase {
public void initSvnModifyCommand() {
context = createContext();
workDirFactory = new SimpleSvnWorkDirFactory(new WorkdirProvider(context.getDirectory()));
svnModifyCommand = new SvnModifyCommand(context, createRepository(), workDirFactory);
svnModifyCommand = new SvnModifyCommand(context, workDirFactory);
}
@Before

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -57,13 +57,8 @@ public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase
File bundle = bundle();
SvnContext ctx = createEmptyContext();
//J-
UnbundleResponse res = new SvnUnbundleCommand(
ctx,
repository
).unbundle(
new UnbundleCommandRequest(
Files.asByteSource(bundle)
)
UnbundleResponse res = new SvnUnbundleCommand(ctx)
.unbundle(new UnbundleCommandRequest(Files.asByteSource(bundle))
);
//J+
@@ -81,13 +76,8 @@ public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase
File file = tempFolder.newFile();
//J-
new SvnBundleCommand(
createContext(),
repository
).bundle(
new BundleCommandRequest(
Files.asByteSink(file)
)
new SvnBundleCommand(createContext())
.bundle(new BundleCommandRequest(Files.asByteSink(file))
);
//J+