mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
Merge with 2.0.0-m3
This commit is contained in:
@@ -3,14 +3,8 @@ package sonia.scm.api.v2.resources;
|
||||
import de.otto.edison.hal.HalRepresentation;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public abstract class BaseMapper<T, D extends HalRepresentation> {
|
||||
public abstract class BaseMapper<T, D extends HalRepresentation> implements InstantAttributeMapper {
|
||||
|
||||
@Mapping(target = "attributes", ignore = true) // We do not map HAL attributes
|
||||
public abstract D map(T modelObject);
|
||||
|
||||
protected Instant mapTime(Long epochMilli) {
|
||||
return epochMilli == null? null: Instant.ofEpochMilli(epochMilli);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package sonia.scm.api.v2.resources;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public interface InstantAttributeMapper {
|
||||
default Instant mapTime(Long epochMilli) {
|
||||
return epochMilli == null? null: Instant.ofEpochMilli(epochMilli);
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,8 @@ package sonia.scm.plugin;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* The WebResourceLoader is able to load web resources. The resources are loaded
|
||||
|
||||
@@ -41,7 +41,6 @@ import sonia.scm.util.ValidationUtil;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -84,12 +83,6 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* List of files changed by this changeset
|
||||
*/
|
||||
@XmlElement(name = "modifications")
|
||||
private Modifications modifications;
|
||||
|
||||
/**
|
||||
* parent changeset ids
|
||||
*/
|
||||
@@ -137,7 +130,6 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||
&& Objects.equal(parents, other.parents)
|
||||
&& Objects.equal(tags, other.tags)
|
||||
&& Objects.equal(branches, other.branches)
|
||||
&& Objects.equal(modifications, other.modifications)
|
||||
&& Objects.equal(properties, other.properties);
|
||||
//J+
|
||||
}
|
||||
@@ -152,7 +144,7 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hashCode(id, date, author, description, parents, tags,
|
||||
branches, modifications, properties);
|
||||
branches, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,11 +176,6 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||
out.append("branches: ").append(Util.toString(branches)).append("\n");
|
||||
out.append("tags: ").append(Util.toString(tags)).append("\n");
|
||||
|
||||
if (modifications != null)
|
||||
{
|
||||
out.append("modifications: \n").append(modifications);
|
||||
}
|
||||
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
@@ -285,21 +272,6 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the file modifications, which was done with this changeset.
|
||||
*
|
||||
*
|
||||
* @return file modifications
|
||||
*/
|
||||
public Modifications getModifications()
|
||||
{
|
||||
if (modifications == null)
|
||||
{
|
||||
modifications = new Modifications();
|
||||
}
|
||||
|
||||
return modifications;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ids of the parent changesets.
|
||||
@@ -402,17 +374,6 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file modification of the changeset.
|
||||
*
|
||||
*
|
||||
* @param modifications file modifications
|
||||
*/
|
||||
public void setModifications(Modifications modifications)
|
||||
{
|
||||
this.modifications = modifications;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parents of the changeset.
|
||||
*
|
||||
|
||||
@@ -36,15 +36,13 @@ package sonia.scm.repository;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -200,4 +198,10 @@ public final class EscapeUtil
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
public static void escape(Modifications modifications) {
|
||||
modifications.setAdded(escapeList(modifications.getAdded()));
|
||||
modifications.setModified(escapeList(modifications.getModified()));
|
||||
modifications.setRemoved(escapeList(modifications.getRemoved()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,8 @@ public class Modifications implements Serializable
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public Modifications() {}
|
||||
public Modifications() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
@@ -218,6 +219,10 @@ public class Modifications implements Serializable
|
||||
return removed;
|
||||
}
|
||||
|
||||
public String getRevision() {
|
||||
return revision;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -253,8 +258,14 @@ public class Modifications implements Serializable
|
||||
this.removed = removed;
|
||||
}
|
||||
|
||||
public void setRevision(String revision) {
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
private String revision;
|
||||
|
||||
/** list of added files */
|
||||
@XmlElement(name = "added")
|
||||
@XmlElementWrapper(name = "added")
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package sonia.scm.repository;
|
||||
|
||||
import sonia.scm.plugin.ExtensionPoint;
|
||||
|
||||
|
||||
/**
|
||||
* A pre processor for {@link Modifications} objects. A pre processor is able to
|
||||
* modify the object before it is delivered to the user interface.
|
||||
*
|
||||
* @author Mohamed Karray
|
||||
* @since 2.0
|
||||
*/
|
||||
@ExtensionPoint
|
||||
public interface ModificationsPreProcessor extends PreProcessor<Modifications> {
|
||||
|
||||
/**
|
||||
* Process the given modifications.
|
||||
*
|
||||
* @param modifications modifications to process
|
||||
*/
|
||||
@Override
|
||||
void process(Modifications modifications);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package sonia.scm.repository;
|
||||
|
||||
import sonia.scm.plugin.ExtensionPoint;
|
||||
|
||||
|
||||
/**
|
||||
* This factory create a {@link ModificationsPreProcessor}
|
||||
*
|
||||
* @author Mohamed Karray
|
||||
* @since 2.0
|
||||
*/
|
||||
@ExtensionPoint
|
||||
public interface ModificationsPreProcessorFactory extends PreProcessorFactory<Modifications> {
|
||||
|
||||
/**
|
||||
* Create a new {@link ModificationsPreProcessor} for the given repository.
|
||||
*
|
||||
*
|
||||
* @param repository repository
|
||||
*
|
||||
* @return {@link ModificationsPreProcessor} for the given repository
|
||||
*/
|
||||
@Override
|
||||
ModificationsPreProcessor createPreProcessor(Repository repository);
|
||||
|
||||
}
|
||||
@@ -36,17 +36,15 @@ package sonia.scm.repository;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -73,14 +71,18 @@ public class PreProcessorUtil
|
||||
* @param fileObjectPreProcessorFactorySet
|
||||
* @param blameLinePreProcessorSet
|
||||
* @param blameLinePreProcessorFactorySet
|
||||
* @param modificationsPreProcessorFactorySet
|
||||
* @param modificationsPreProcessorSet
|
||||
*/
|
||||
@Inject
|
||||
public PreProcessorUtil(Set<ChangesetPreProcessor> changesetPreProcessorSet,
|
||||
Set<ChangesetPreProcessorFactory> changesetPreProcessorFactorySet,
|
||||
Set<FileObjectPreProcessor> fileObjectPreProcessorSet,
|
||||
Set<FileObjectPreProcessorFactory> fileObjectPreProcessorFactorySet,
|
||||
Set<BlameLinePreProcessor> blameLinePreProcessorSet,
|
||||
Set<BlameLinePreProcessorFactory> blameLinePreProcessorFactorySet)
|
||||
Set<ChangesetPreProcessorFactory> changesetPreProcessorFactorySet,
|
||||
Set<FileObjectPreProcessor> fileObjectPreProcessorSet,
|
||||
Set<FileObjectPreProcessorFactory> fileObjectPreProcessorFactorySet,
|
||||
Set<BlameLinePreProcessor> blameLinePreProcessorSet,
|
||||
Set<BlameLinePreProcessorFactory> blameLinePreProcessorFactorySet,
|
||||
Set<ModificationsPreProcessorFactory> modificationsPreProcessorFactorySet,
|
||||
Set<ModificationsPreProcessor> modificationsPreProcessorSet)
|
||||
{
|
||||
this.changesetPreProcessorSet = changesetPreProcessorSet;
|
||||
this.changesetPreProcessorFactorySet = changesetPreProcessorFactorySet;
|
||||
@@ -88,6 +90,8 @@ public class PreProcessorUtil
|
||||
this.fileObjectPreProcessorFactorySet = fileObjectPreProcessorFactorySet;
|
||||
this.blameLinePreProcessorSet = blameLinePreProcessorSet;
|
||||
this.blameLinePreProcessorFactorySet = blameLinePreProcessorFactorySet;
|
||||
this.modificationsPreProcessorFactorySet = modificationsPreProcessorFactorySet;
|
||||
this.modificationsPreProcessorSet = modificationsPreProcessorSet;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -108,13 +112,7 @@ public class PreProcessorUtil
|
||||
}
|
||||
|
||||
EscapeUtil.escape(blameLine);
|
||||
|
||||
PreProcessorHandler<BlameLine> handler =
|
||||
new PreProcessorHandler<BlameLine>(blameLinePreProcessorFactorySet,
|
||||
blameLinePreProcessorSet, repository);
|
||||
|
||||
handler.callPreProcessors(blameLine);
|
||||
handler.callPreProcessorFactories(blameLine);
|
||||
handlePreProcess(repository,blameLine,blameLinePreProcessorFactorySet, blameLinePreProcessorSet);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,13 +150,7 @@ public class PreProcessorUtil
|
||||
{
|
||||
EscapeUtil.escape(blameResult);
|
||||
}
|
||||
|
||||
PreProcessorHandler<BlameLine> handler =
|
||||
new PreProcessorHandler<BlameLine>(blameLinePreProcessorFactorySet,
|
||||
blameLinePreProcessorSet, repository);
|
||||
|
||||
handler.callPreProcessors(blameResult.getBlameLines());
|
||||
handler.callPreProcessorFactories(blameResult.getBlameLines());
|
||||
handlePreProcessForIterable(repository, blameResult.getBlameLines(),blameLinePreProcessorFactorySet, blameLinePreProcessorSet);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,26 +175,20 @@ public class PreProcessorUtil
|
||||
*
|
||||
* @since 1.35
|
||||
*/
|
||||
public void prepareForReturn(Repository repository, Changeset changeset,
|
||||
boolean escape)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("prepare changeset {} of repository {} for return",
|
||||
changeset.getId(), repository.getName());
|
||||
}
|
||||
|
||||
if (escape)
|
||||
{
|
||||
public void prepareForReturn(Repository repository, Changeset changeset, boolean escape){
|
||||
logger.trace("prepare changeset {} of repository {} for return", changeset.getId(), repository.getName());
|
||||
if (escape) {
|
||||
EscapeUtil.escape(changeset);
|
||||
}
|
||||
handlePreProcess(repository, changeset, changesetPreProcessorFactorySet, changesetPreProcessorSet);
|
||||
}
|
||||
|
||||
PreProcessorHandler<Changeset> handler =
|
||||
new PreProcessorHandler<Changeset>(changesetPreProcessorFactorySet,
|
||||
changesetPreProcessorSet, repository);
|
||||
|
||||
handler.callPreProcessors(changeset);
|
||||
handler.callPreProcessorFactories(changeset);
|
||||
public void prepareForReturn(Repository repository, Modifications modifications, boolean escape) {
|
||||
logger.trace("prepare modifications {} of repository {} for return", modifications, repository.getName());
|
||||
if (escape) {
|
||||
EscapeUtil.escape(modifications);
|
||||
}
|
||||
handlePreProcess(repository, modifications, modificationsPreProcessorFactorySet, modificationsPreProcessorSet);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,13 +226,7 @@ public class PreProcessorUtil
|
||||
{
|
||||
EscapeUtil.escape(result);
|
||||
}
|
||||
|
||||
PreProcessorHandler<FileObject> handler =
|
||||
new PreProcessorHandler<FileObject>(fileObjectPreProcessorFactorySet,
|
||||
fileObjectPreProcessorSet, repository);
|
||||
|
||||
handler.callPreProcessors(result);
|
||||
handler.callPreProcessorFactories(result);
|
||||
handlePreProcessForIterable(repository, result,fileObjectPreProcessorFactorySet, fileObjectPreProcessorSet);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,13 +252,7 @@ public class PreProcessorUtil
|
||||
{
|
||||
EscapeUtil.escape(result);
|
||||
}
|
||||
|
||||
PreProcessorHandler<Changeset> handler =
|
||||
new PreProcessorHandler<Changeset>(changesetPreProcessorFactorySet,
|
||||
changesetPreProcessorSet, repository);
|
||||
|
||||
handler.callPreProcessors(result);
|
||||
handler.callPreProcessorFactories(result);
|
||||
handlePreProcessForIterable(repository,result,changesetPreProcessorFactorySet, changesetPreProcessorSet);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,6 +268,23 @@ public class PreProcessorUtil
|
||||
prepareForReturn(repository, result, true);
|
||||
}
|
||||
|
||||
|
||||
private <T, F extends PreProcessorFactory<T>, P extends PreProcessor<T>> void handlePreProcess(Repository repository, T processedObject,
|
||||
Collection<F> factories,
|
||||
Collection<P> preProcessors) {
|
||||
PreProcessorHandler<T> handler = new PreProcessorHandler<T>(factories, preProcessors, repository);
|
||||
handler.callPreProcessors(processedObject);
|
||||
handler.callPreProcessorFactories(processedObject);
|
||||
}
|
||||
|
||||
private <T, I extends Iterable<T>, F extends PreProcessorFactory<T>, P extends PreProcessor<T>> void handlePreProcessForIterable(Repository repository, I processedObjects,
|
||||
Collection<F> factories,
|
||||
Collection<P> preProcessors) {
|
||||
PreProcessorHandler<T> handler = new PreProcessorHandler<T>(factories, preProcessors, repository);
|
||||
handler.callPreProcessors(processedObjects);
|
||||
handler.callPreProcessorFactories(processedObjects);
|
||||
}
|
||||
|
||||
//~--- inner classes --------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -454,6 +445,10 @@ public class PreProcessorUtil
|
||||
/** Field description */
|
||||
private final Collection<ChangesetPreProcessor> changesetPreProcessorSet;
|
||||
|
||||
private final Collection<ModificationsPreProcessorFactory> modificationsPreProcessorFactorySet;
|
||||
|
||||
private final Collection<ModificationsPreProcessor> modificationsPreProcessorSet;
|
||||
|
||||
/** Field description */
|
||||
private final Collection<FileObjectPreProcessorFactory> fileObjectPreProcessorFactorySet;
|
||||
|
||||
|
||||
@@ -61,5 +61,11 @@ public enum Command
|
||||
/**
|
||||
* @since 1.43
|
||||
*/
|
||||
BUNDLE, UNBUNDLE;
|
||||
BUNDLE, UNBUNDLE,
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
*/
|
||||
MODIFICATIONS
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package sonia.scm.repository.api;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import sonia.scm.cache.Cache;
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.PreProcessorUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryCacheKey;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.repository.spi.ModificationsCommand;
|
||||
import sonia.scm.repository.spi.ModificationsCommandRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Get the modifications applied to files in a revision.
|
||||
* <p>
|
||||
* Modifications are for example: Add, Update and Delete
|
||||
*
|
||||
* @author Mohamed Karray
|
||||
* @since 2.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Accessors(fluent = true)
|
||||
public final class ModificationsCommandBuilder {
|
||||
static final String CACHE_NAME = "sonia.cache.cmd.modifications";
|
||||
|
||||
private final ModificationsCommand modificationsCommand;
|
||||
|
||||
private final ModificationsCommandRequest request = new ModificationsCommandRequest();
|
||||
|
||||
private final Repository repository;
|
||||
|
||||
private final Cache<ModificationsCommandBuilder.CacheKey, Modifications> cache;
|
||||
|
||||
private final PreProcessorUtil preProcessorUtil;
|
||||
|
||||
@Setter
|
||||
private boolean disableEscaping = false;
|
||||
|
||||
@Setter
|
||||
private boolean disableCache = false;
|
||||
|
||||
@Setter
|
||||
private boolean disablePreProcessors = false;
|
||||
|
||||
public ModificationsCommandBuilder revision(String revision){
|
||||
request.setRevision(revision);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset each parameter to its default value.
|
||||
*
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ModificationsCommandBuilder reset() {
|
||||
request.reset();
|
||||
this.disableCache = false;
|
||||
this.disablePreProcessors = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Modifications getModifications() throws IOException, RevisionNotFoundException {
|
||||
Modifications modifications;
|
||||
if (disableCache) {
|
||||
log.info("Get modifications for {} with disabled cache", request);
|
||||
modifications = modificationsCommand.getModifications(request);
|
||||
} else {
|
||||
ModificationsCommandBuilder.CacheKey key = new ModificationsCommandBuilder.CacheKey(repository.getId(), request);
|
||||
if (cache.contains(key)) {
|
||||
modifications = cache.get(key);
|
||||
log.debug("Get modifications for {} from the cache", request);
|
||||
} else {
|
||||
log.info("Get modifications for {} with enabled cache", request);
|
||||
modifications = modificationsCommand.getModifications(request);
|
||||
if (modifications != null) {
|
||||
cache.put(key, modifications);
|
||||
log.debug("Modifications for {} added to the cache with key {}", request, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!disablePreProcessors && (modifications != null)) {
|
||||
preProcessorUtil.prepareForReturn(repository, modifications, !disableEscaping);
|
||||
}
|
||||
return modifications;
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
class CacheKey implements RepositoryCacheKey {
|
||||
private final String repositoryId;
|
||||
private final ModificationsCommandRequest request;
|
||||
|
||||
@Override
|
||||
public String getRepositoryId() {
|
||||
return repositoryId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -253,6 +253,18 @@ public final class RepositoryService implements Closeable {
|
||||
repository, preProcessorUtil);
|
||||
}
|
||||
|
||||
/**
|
||||
* The modification command shows file modifications in a revision.
|
||||
*
|
||||
* @return instance of {@link ModificationsCommandBuilder}
|
||||
* @throws CommandNotSupportedException if the command is not supported
|
||||
* by the implementation of the repository service provider.
|
||||
*/
|
||||
public ModificationsCommandBuilder getModificationsCommand() {
|
||||
logger.debug("create modifications command for repository {}",repository.getNamespaceAndName());
|
||||
return new ModificationsCommandBuilder(provider.getModificationsCommand(),repository, cacheManager.getCache(ModificationsCommandBuilder.CACHE_NAME), preProcessorUtil);
|
||||
}
|
||||
|
||||
/**
|
||||
* The outgoing command show {@link Changeset}s not found in a remote repository.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Command to get the modifications applied to files in a revision.
|
||||
*
|
||||
* Modifications are for example: Add, Update, Delete
|
||||
*
|
||||
* @author Mohamed Karray
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface ModificationsCommand {
|
||||
|
||||
Modifications getModifications(String revision) throws IOException, RevisionNotFoundException;
|
||||
|
||||
Modifications getModifications(ModificationsCommandRequest request) throws IOException, RevisionNotFoundException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ModificationsCommandRequest implements Resetable {
|
||||
private String revision;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
revision = null;
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,8 @@ import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -168,6 +170,16 @@ public abstract class RepositoryServiceProvider implements Closeable
|
||||
throw new CommandNotSupportedException(Command.LOG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the corresponding {@link ModificationsCommand} implemented from the Plugins
|
||||
*
|
||||
* @return the corresponding {@link ModificationsCommand} implemented from the Plugins
|
||||
* @throws CommandNotSupportedException if there is no Implementation
|
||||
*/
|
||||
public ModificationsCommand getModificationsCommand() {
|
||||
throw new CommandNotSupportedException(Command.MODIFICATIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -21,6 +21,7 @@ public class VndMediaType {
|
||||
public static final String PERMISSION = PREFIX + "permission" + SUFFIX;
|
||||
public static final String CHANGESET = PREFIX + "changeset" + SUFFIX;
|
||||
public static final String CHANGESET_COLLECTION = PREFIX + "changesetCollection" + SUFFIX;
|
||||
public static final String MODIFICATIONS = PREFIX + "modifications" + SUFFIX;;
|
||||
public static final String TAG = PREFIX + "tag" + SUFFIX;
|
||||
public static final String TAG_COLLECTION = PREFIX + "tagCollection" + SUFFIX;
|
||||
public static final String BRANCH = PREFIX + "branch" + SUFFIX;
|
||||
|
||||
Reference in New Issue
Block a user