mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-31 19:59:17 +01:00
Merge branch 'develop' into feature/hg_hooks_over_tcp
# Conflicts: # CHANGELOG.md
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
package sonia.scm.api.v2.resources;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import de.otto.edison.hal.Embedded;
|
||||
import de.otto.edison.hal.HalRepresentation;
|
||||
import de.otto.edison.hal.Links;
|
||||
@@ -31,11 +32,14 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import sonia.scm.repository.Branch;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
import static sonia.scm.repository.Branch.VALID_BRANCH_NAMES;
|
||||
import java.time.Instant;
|
||||
|
||||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -45,10 +49,13 @@ public class BranchDto extends HalRepresentation {
|
||||
|
||||
@NotEmpty
|
||||
@Length(min = 1, max = 100)
|
||||
@Pattern(regexp = VALID_BRANCH_NAMES)
|
||||
@Pattern(regexp = Branch.VALID_BRANCH_NAMES)
|
||||
private String name;
|
||||
private String revision;
|
||||
private boolean defaultBranch;
|
||||
@JsonInclude(NON_NULL)
|
||||
private Instant lastCommitDate;
|
||||
private boolean stale;
|
||||
|
||||
BranchDto(Links links, Embedded embedded) {
|
||||
super(links, embedded);
|
||||
|
||||
@@ -38,11 +38,14 @@ import sonia.scm.web.EdisonHalAppender;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
|
||||
import static de.otto.edison.hal.Link.linkBuilder;
|
||||
import static de.otto.edison.hal.Links.linkingTo;
|
||||
|
||||
@Mapper
|
||||
public abstract class BranchToBranchDtoMapper extends HalAppenderMapper {
|
||||
public abstract class BranchToBranchDtoMapper extends HalAppenderMapper implements InstantAttributeMapper {
|
||||
|
||||
@Inject
|
||||
private ResourceLinks resourceLinks;
|
||||
@@ -68,4 +71,8 @@ public abstract class BranchToBranchDtoMapper extends HalAppenderMapper {
|
||||
|
||||
return new BranchDto(linksBuilder.build(), embeddedBuilder.build());
|
||||
}
|
||||
|
||||
Instant mapOptionalTime(Optional<Long> date) {
|
||||
return date.map(this::mapTime).orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,10 +192,16 @@ public class DefaultPluginManager implements PluginManager {
|
||||
dependencyTracker.addInstalled(plugin.getDescriptor());
|
||||
pendingInstallations.add(pending);
|
||||
eventBus.post(new PluginEvent(PluginEvent.PluginEventType.INSTALLED, plugin));
|
||||
} catch (PluginInstallException ex) {
|
||||
cancelPending(pendingInstallations);
|
||||
eventBus.post(new PluginEvent(PluginEvent.PluginEventType.INSTALLATION_FAILED, plugin));
|
||||
throw ex;
|
||||
} catch (PluginInstallException installException) {
|
||||
try {
|
||||
cancelPending(pendingInstallations);
|
||||
} catch (PluginFailedToCancelInstallationException cancelInstallationException) {
|
||||
LOG.error("could not install plugin {}; uninstallation failed (see next exception)", plugin.getDescriptor().getInformation().getName(), installException);
|
||||
throw cancelInstallationException;
|
||||
} finally {
|
||||
eventBus.post(new PluginEvent(PluginEvent.PluginEventType.INSTALLATION_FAILED, plugin));
|
||||
}
|
||||
throw installException;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.plugin;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -50,10 +50,14 @@ class PendingPluginInstallation {
|
||||
void cancel() {
|
||||
String name = plugin.getDescriptor().getInformation().getName();
|
||||
LOG.info("cancel installation of plugin {}", name);
|
||||
try {
|
||||
Files.delete(file);
|
||||
} catch (IOException ex) {
|
||||
throw new PluginFailedToCancelInstallationException("failed to cancel plugin installation ", name, ex);
|
||||
if (Files.exists(file)) {
|
||||
try {
|
||||
Files.delete(file);
|
||||
} catch (IOException ex) {
|
||||
throw new PluginFailedToCancelInstallationException("failed to cancel plugin installation ", name, ex);
|
||||
}
|
||||
} else {
|
||||
LOG.info("plugin file {} did not exists for plugin {}; nothing deleted", file, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ public final class PluginTree
|
||||
throw new PluginConditionFailedException(
|
||||
condition,
|
||||
String.format(
|
||||
"could not load plugin %s, the plugin condition does not match",
|
||||
plugin.getInformation().getId()
|
||||
"could not load plugin %s, the plugin condition does not match: %s",
|
||||
plugin.getInformation().getId(), condition
|
||||
)
|
||||
);
|
||||
//J+
|
||||
|
||||
Reference in New Issue
Block a user