diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java index 8319260f53..4f3e31f4d7 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java @@ -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; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitIncomingOutgoingCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitIncomingOutgoingCommand.java index c524191ddd..1b03a5a55e 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitIncomingOutgoingCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitIncomingOutgoingCommand.java @@ -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; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java index e7ce671a08..4ebc288608 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java @@ -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; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java index 41dacb4301..5c1f074a90 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBranchCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBranchCommand.java index c70fadf9ac..506580d5a9 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBranchCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBranchCommand.java @@ -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; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBranchesCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBranchesCommand.java index f4855d7c99..cd7892461b 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBranchesCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBranchesCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java index 79e23f4ec5..ab5a7d33b4 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java @@ -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()); diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java index f4d3350219..4629e4bce2 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java @@ -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; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java index 85e837904a..29c9f81b14 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java @@ -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 diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffResultCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffResultCommand.java index 703c0f9682..e0cbffbc2a 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffResultCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffResultCommand.java @@ -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 { diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitIncomingCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitIncomingCommand.java index a41d1af21f..f6e818bcdb 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitIncomingCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitIncomingCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index 406abd56e8..da00ba451b 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitMergeCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitMergeCommand.java index a5914cb533..5f915535b1 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitMergeCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitMergeCommand.java @@ -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; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitModificationsCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitModificationsCommand.java index 57c916116c..3839c98959 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitModificationsCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitModificationsCommand.java @@ -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) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitModifyCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitModifyCommand.java index 90abc418fa..d808434c1d 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitModifyCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitModifyCommand.java @@ -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; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitOutgoingCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitOutgoingCommand.java index 69eb25bfda..03acf9e914 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitOutgoingCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitOutgoingCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java index 671920183d..53b7a59916 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java @@ -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 -------------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPushCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPushCommand.java index 0e6ee9a4b2..fd874524f4 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPushCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPushCommand.java @@ -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; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java index 10b4303291..4aa6ab3a08 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java @@ -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; diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitTagsCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitTagsCommand.java index be97ce603e..208c931f63 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitTagsCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitTagsCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java index d31104b590..8943be1867 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java @@ -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()); } } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBranchCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBranchCommandTest.java index 3f3c49248d..020bde53c9 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBranchCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBranchCommandTest.java @@ -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 readBranches(GitContext context) throws IOException { - return new GitBranchesCommand(context, repository).getBranches(); + return new GitBranchesCommand(context).getBranches(); } @Test diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBranchesCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBranchesCommandTest.java index b2156d9a3e..967226012a 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBranchesCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBranchesCommandTest.java @@ -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; diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java index 7429590a00..0ba57cbada 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java @@ -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 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()); } } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java index c35eab6767..5e9e716173 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java @@ -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 { diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitDiffCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitDiffCommandTest.java index 5f64c87ade..042c1f3186 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitDiffCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitDiffCommandTest.java @@ -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"); diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitDiffResultCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitDiffResultCommandTest.java index cfeacd2b5a..cf42b00719 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitDiffResultCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitDiffResultCommandTest.java @@ -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); diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitIncomingCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitIncomingCommandTest.java index c2f39a0334..0ffa917a14 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitIncomingCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitIncomingCommandTest.java @@ -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()))); } } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandAncestorTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandAncestorTest.java index d217da7532..6fcb9303cb 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandAncestorTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandAncestorTest.java @@ -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()); } } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index 27c441bfca..38ab4e0ebb 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -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()); } } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitMergeCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitMergeCommandTest.java index 318b714de5..8586b26cfb 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitMergeCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitMergeCommandTest.java @@ -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 changes = modificationsCommand.getModifications("master").getAdded(); assertThat(changes.size()).isEqualTo(3); } @@ -423,7 +423,7 @@ public class GitMergeCommandTest extends AbstractGitCommandTestBase { } private GitMergeCommand createCommand(Consumer interceptor) { - return new GitMergeCommand(createContext(), repository, new SimpleGitWorkdirFactory(new WorkdirProvider())) { + return new GitMergeCommand(createContext(), new SimpleGitWorkdirFactory(new WorkdirProvider())) { @Override > R inClone(Function workerSupplier, GitWorkdirFactory workdirFactory, String initialBranch) { Function interceptedWorkerSupplier = git -> { diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitMergeCommand_Conflict_Test.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitMergeCommand_Conflict_Test.java index 1d5b6671bc..391ac2d762 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitMergeCommand_Conflict_Test.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitMergeCommand_Conflict_Test.java @@ -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); diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModificationsCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModificationsCommandTest.java index 7ab82153d6..e6ac22d32c 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModificationsCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModificationsCommandTest.java @@ -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); diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommandTest.java index fa3d6836cb..746f05f61c 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommandTest.java @@ -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 diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommand_LFSTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommand_LFSTest.java index 29914aef8e..bdad922b01 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommand_LFSTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommand_LFSTest.java @@ -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 diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommand_withEmptyRepositoryTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommand_withEmptyRepositoryTest.java index 2394cf144f..ae1c2fd854 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommand_withEmptyRepositoryTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitModifyCommand_withEmptyRepositoryTest.java @@ -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 diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitOutgoingCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitOutgoingCommandTest.java index 41863a91b3..5c7a491c72 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitOutgoingCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitOutgoingCommandTest.java @@ -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()))); } } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitPushCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitPushCommandTest.java index 40dc46ff16..1c5796a44f 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitPushCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitPushCommandTest.java @@ -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)); } } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractCommand.java index c7bc579456..f7d33b8973 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractCommand.java @@ -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 -------------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java index 4c365d9d18..02c4ae1b1d 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java @@ -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; } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java index 144532c553..83732bb879 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBranchCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBranchCommand.java index 31987afe2b..408daedd81 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBranchCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBranchCommand.java @@ -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; } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBranchesCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBranchesCommand.java index 43438ecc78..48b8ebc0a5 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBranchesCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBranchesCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java index 01471df442..6c83368cc4 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java index 93e201a99d..ee86e8a674 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java @@ -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 diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java index 7f6ef1a3b9..605ce5555a 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgIncomingCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgIncomingCommand.java index 4f587da1e2..27f2176392 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgIncomingCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgIncomingCommand.java @@ -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; } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java index f290e5d0ec..fabf364dc2 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgModificationsCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgModificationsCommand.java index 0c8dd2f456..f9c7a3e1d1 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgModificationsCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgModificationsCommand.java @@ -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); } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgOutgoingCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgOutgoingCommand.java index 8dc677c06b..c35de5bfc6 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgOutgoingCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgOutgoingCommand.java @@ -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; } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPullCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPullCommand.java index f7676f4764..e5cdbd957b 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPullCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPullCommand.java @@ -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 -------------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPushCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPushCommand.java index 6451bc234d..9b6581d3f3 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPushCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPushCommand.java @@ -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 -------------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java index 176f674516..3995146e42 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java @@ -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 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; } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgTagsCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgTagsCommand.java index db4ad42506..20bdac4ec1 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgTagsCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgTagsCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java index 29f5bcb35a..7662867e13 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java @@ -111,6 +111,6 @@ public class HgBlameCommandTest extends AbstractHgCommandTestBase */ private BlameCommand createCommand() { - return new HgBlameCommand(cmdContext, repository); + return new HgBlameCommand(cmdContext); } } diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBranchCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBranchCommandTest.java index a081d97f3d..1d7f0ca627 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBranchCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBranchCommandTest.java @@ -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 readBranches() { - return new HgBranchesCommand(cmdContext, repository).getBranches(); + return new HgBranchesCommand(cmdContext).getBranches(); } } diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java index 30cab9185b..eb9b34828d 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java @@ -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 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 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 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 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 foList = root.getChildren(); @@ -299,8 +296,7 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase { } private Collection getRootFromTip(BrowseCommandRequest request) throws IOException { - BrowserResult result = new HgBrowseCommand(cmdContext, - repository).getBrowserResult(request); + BrowserResult result = new HgBrowseCommand(cmdContext).getBrowserResult(request); assertNotNull(result); diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java index b27835f71a..e0a3538655 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java @@ -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(); } } diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgIncomingCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgIncomingCommandTest.java index 263dbaee18..a128e23075 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgIncomingCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgIncomingCommandTest.java @@ -121,6 +121,6 @@ public class HgIncomingCommandTest extends IncomingOutgoingTestBase return new HgIncomingCommand( new HgCommandContext( HgTestUtil.createHookManager(), handler, incomingRepository, - incomingDirectory), incomingRepository, handler); + incomingDirectory), handler); } } diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java index 40af201511..efb3919455 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java @@ -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); } } diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgModificationsCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgModificationsCommandTest.java index 6b8c8faed0..c257dc611a 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgModificationsCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgModificationsCommandTest.java @@ -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 diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgOutgoingCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgOutgoingCommandTest.java index 7e1a4513c4..192b425e6c 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgOutgoingCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgOutgoingCommandTest.java @@ -117,6 +117,6 @@ public class HgOutgoingCommandTest extends IncomingOutgoingTestBase return new HgOutgoingCommand( new HgCommandContext( HgTestUtil.createHookManager(), handler, outgoingRepository, - outgoingDirectory), outgoingRepository, handler); + outgoingDirectory), handler); } } diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java index e455b4eff3..3bf5dbcba5 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java @@ -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 -------------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java index 11e7d06876..b0361c7d04 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java @@ -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 diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java index f4655fba5f..e96a933080 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java @@ -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 diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java index d67e8b1423..9537bee326 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java @@ -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, diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java index e0676f130c..010fb7f73e 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java index 4f8ce79a95..e1746f0e1e 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java @@ -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 diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java index 8fe4b3f883..35f5ec1fec 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModificationsCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModificationsCommand.java index 578a523d21..97c44ce747 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModificationsCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModificationsCommand.java @@ -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 diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModifyCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModifyCommand.java index 8df3f14de9..1c7b8db5e7 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModifyCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModifyCommand.java @@ -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; } diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java index 9043332b21..65879834aa 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java @@ -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 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; } diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java index f1213ba11a..973c93fea3 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java @@ -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 -------------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java index 9b87113b7d..e3b09899e1 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java @@ -110,6 +110,6 @@ public class SvnBlameCommandTest extends AbstractSvnCommandTestBase */ private SvnBlameCommand createCommand() { - return new SvnBlameCommand(createContext(), repository); + return new SvnBlameCommand(createContext()); } } diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java index 50d3a03976..3d3a3131e5 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java @@ -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 ---------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java index 12f23bdb9d..3c8e125165 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java @@ -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)); diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java index 1037939dc6..26616f53df 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java @@ -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 { diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java index 0c5a9a2483..52162419fa 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java @@ -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()); } } diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnModifyCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnModifyCommandTest.java index 7f0f1eb00d..533e012dc3 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnModifyCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnModifyCommandTest.java @@ -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 diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java index 9556c7032c..6fc214eec8 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java @@ -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+