mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 17:56:17 +01:00
cleanup outdated jaxb annotations
This commit is contained in:
@@ -24,213 +24,56 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changeset information by line for a given file.
|
* Changeset information by line for a given file.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "blame-result")
|
@EqualsAndHashCode
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@ToString
|
||||||
public class BlameResult implements Serializable, Iterable<BlameLine>
|
public class BlameResult implements Serializable, Iterable<BlameLine> {
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = -8606237881465520606L;
|
private static final long serialVersionUID = -8606237881465520606L;
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
private List<BlameLine> blameLines;
|
||||||
|
private int total;
|
||||||
|
|
||||||
/**
|
public BlameResult(List<BlameLine> blameLines) {
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public BlameResult() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param blameLines
|
|
||||||
*/
|
|
||||||
public BlameResult(List<BlameLine> blameLines)
|
|
||||||
{
|
|
||||||
this.blameLines = blameLines;
|
this.blameLines = blameLines;
|
||||||
this.total = blameLines.size();
|
this.total = blameLines.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public BlameResult(int total, List<BlameLine> blameLines) {
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param total
|
|
||||||
* @param blameLines
|
|
||||||
*/
|
|
||||||
public BlameResult(int total, List<BlameLine> blameLines)
|
|
||||||
{
|
|
||||||
this.total = total;
|
this.total = total;
|
||||||
this.blameLines = blameLines;
|
this.blameLines = blameLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public Iterator<BlameLine> iterator() {
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final BlameResult other = (BlameResult) obj;
|
|
||||||
|
|
||||||
return Objects.equal(total, other.total)
|
|
||||||
&& Objects.equal(blameLines, other.blameLines);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(total, blameLines);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @since 1.17
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Iterator<BlameLine> iterator()
|
|
||||||
{
|
|
||||||
return getBlameLines().iterator();
|
return getBlameLines().iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public List<BlameLine> getBlameLines() {
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("total", total)
|
|
||||||
.add("blameLines", blameLines)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<BlameLine> getBlameLines()
|
|
||||||
{
|
|
||||||
if (blameLines == null) {
|
if (blameLines == null) {
|
||||||
blameLines = Lists.newArrayList();
|
blameLines = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
return blameLines;
|
return blameLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public BlameLine getLine(int i) {
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param i
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public BlameLine getLine(int i)
|
|
||||||
{
|
|
||||||
return blameLines.get(i);
|
return blameLines.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public int getTotal() {
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int getTotal()
|
|
||||||
{
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param blameLines
|
|
||||||
*/
|
|
||||||
public void setBlameLines(List<BlameLine> blameLines)
|
|
||||||
{
|
|
||||||
this.blameLines = blameLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param total
|
|
||||||
*/
|
|
||||||
public void setTotal(int total)
|
|
||||||
{
|
|
||||||
this.total = total;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
@XmlElement(name = "blameline")
|
|
||||||
@XmlElementWrapper(name = "blamelines")
|
|
||||||
private List<BlameLine> blameLines;
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private int total;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,163 +24,51 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
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.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents all branches of a repository.
|
* Represents all branches of a repository.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.18
|
* @since 1.18
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name="branches")
|
@EqualsAndHashCode
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@ToString
|
||||||
public final class Branches implements Iterable<Branch>
|
@Setter
|
||||||
{
|
public final class Branches implements Iterable<Branch> {
|
||||||
|
|
||||||
/**
|
private List<Branch> branches;
|
||||||
* Constructs a new instance of branches.
|
|
||||||
* This constructor should only be called from JAXB.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Branches() {}
|
|
||||||
|
|
||||||
/**
|
public Branches() {
|
||||||
* Constructs a new instance of branches.
|
}
|
||||||
*
|
|
||||||
*
|
;
|
||||||
* @param branches list of branches.
|
|
||||||
*/
|
public Branches(Branch... branches) {
|
||||||
public Branches(Branch... branches)
|
|
||||||
{
|
|
||||||
this.branches = Lists.newArrayList(branches);
|
this.branches = Lists.newArrayList(branches);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Branches(List<Branch> branches) {
|
||||||
* Constructs a new instance of branches.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param branches list of branches.
|
|
||||||
*/
|
|
||||||
public Branches(List<Branch> branches)
|
|
||||||
{
|
|
||||||
this.branches = branches;
|
this.branches = branches;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public Iterator<Branch> iterator() {
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Branches other = (Branches) obj;
|
|
||||||
|
|
||||||
return Objects.equal(branches, other.branches);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(branches);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Iterator<Branch> iterator()
|
|
||||||
{
|
|
||||||
return getBranches().iterator();
|
return getBranches().iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("branches", branches)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
public List<Branch> getBranches() {
|
||||||
|
if (branches == null) {
|
||||||
/**
|
|
||||||
* Returns all branches of a repository.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return all branches
|
|
||||||
*/
|
|
||||||
public List<Branch> getBranches()
|
|
||||||
{
|
|
||||||
if (branches == null)
|
|
||||||
{
|
|
||||||
branches = Lists.newArrayList();
|
branches = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return branches;
|
return branches;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets all branches.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param branches branches
|
|
||||||
*/
|
|
||||||
public void setBranches(List<Branch> branches)
|
|
||||||
{
|
|
||||||
this.branches = branches;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** branches */
|
|
||||||
@XmlElement(name="branch")
|
|
||||||
private List<Branch> branches;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,25 +24,13 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
* @since 1.5
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "browser-result")
|
|
||||||
public class BrowserResult implements Serializable {
|
public class BrowserResult implements Serializable {
|
||||||
|
|
||||||
private String revision;
|
private String revision;
|
||||||
@@ -52,6 +40,8 @@ public class BrowserResult implements Serializable {
|
|||||||
public BrowserResult() {
|
public BrowserResult() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
public BrowserResult(String revision, FileObject file) {
|
public BrowserResult(String revision, FileObject file) {
|
||||||
this(revision, revision, file);
|
this(revision, revision, file);
|
||||||
}
|
}
|
||||||
@@ -73,36 +63,4 @@ public class BrowserResult implements Serializable {
|
|||||||
public FileObject getFile() {
|
public FileObject getFile() {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final BrowserResult other = (BrowserResult) obj;
|
|
||||||
|
|
||||||
return Objects.equal(revision, other.revision)
|
|
||||||
&& Objects.equal(file, other.file);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(revision, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("revision", revision)
|
|
||||||
.add("files", file)
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,27 +24,22 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import lombok.EqualsAndHashCode;
|
||||||
import sonia.scm.BasicPropertiesAware;
|
import sonia.scm.BasicPropertiesAware;
|
||||||
import sonia.scm.ModelObject;
|
import sonia.scm.ModelObject;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
import sonia.scm.util.ValidationUtil;
|
import sonia.scm.util.ValidationUtil;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a changeset/commit of a repository.
|
* Represents a changeset/commit of a repository.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "changeset")
|
@EqualsAndHashCode
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class Changeset extends BasicPropertiesAware implements ModelObject {
|
public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8373308448928993039L;
|
private static final long serialVersionUID = -8373308448928993039L;
|
||||||
@@ -91,8 +86,7 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
this(id, date, author, null);
|
this(id, date, author, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Changeset(String id, Long date, Person author, String description)
|
public Changeset(String id, Long date, Person author, String description) {
|
||||||
{
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
@@ -100,66 +94,18 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public String toString() {
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Changeset other = (Changeset) obj;
|
|
||||||
|
|
||||||
//J-
|
|
||||||
return Objects.equal(id, other.id)
|
|
||||||
&& Objects.equal(date, other.date)
|
|
||||||
&& Objects.equal(author, other.author)
|
|
||||||
&& Objects.equal(description, other.description)
|
|
||||||
&& Objects.equal(parents, other.parents)
|
|
||||||
&& Objects.equal(tags, other.tags)
|
|
||||||
&& Objects.equal(branches, other.branches)
|
|
||||||
&& Objects.equal(properties, other.properties);
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(id, date, author, description, parents, tags,
|
|
||||||
branches, properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder out = new StringBuilder("changeset: ");
|
StringBuilder out = new StringBuilder("changeset: ");
|
||||||
|
|
||||||
out.append(id).append("\n");
|
out.append(id).append("\n");
|
||||||
|
|
||||||
if (parents != null)
|
if (parents != null) {
|
||||||
{
|
|
||||||
out.append("parents: ").append(Util.toString(parents)).append("\n");
|
out.append("parents: ").append(Util.toString(parents)).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
out.append("author: ").append(author).append("\n");
|
out.append("author: ").append(author).append("\n");
|
||||||
|
|
||||||
if (date != null)
|
if (date != null) {
|
||||||
{
|
|
||||||
out.append("date: ").append(Util.formatDate(new Date(date))).append("\n");
|
out.append("date: ").append(Util.formatDate(new Date(date))).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +116,6 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
return out.toString();
|
return out.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a timestamp of the creation date of the {@link Changeset}.
|
* Returns a timestamp of the creation date of the {@link Changeset}.
|
||||||
*
|
*
|
||||||
@@ -185,11 +130,9 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
this.setDate(timestamp);
|
this.setDate(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the author of the changeset.
|
* Returns the author of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return author of the changeset
|
* @return author of the changeset
|
||||||
*/
|
*/
|
||||||
public Person getAuthor() {
|
public Person getAuthor() {
|
||||||
@@ -201,13 +144,10 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
* only related to one branch, but in the case of receive hooks it is possible
|
* only related to one branch, but in the case of receive hooks it is possible
|
||||||
* that a changeset is related to more than a branch.
|
* that a changeset is related to more than a branch.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return branches of the changeset
|
* @return branches of the changeset
|
||||||
*/
|
*/
|
||||||
public List<String> getBranches()
|
public List<String> getBranches() {
|
||||||
{
|
if (branches == null) {
|
||||||
if (branches == null)
|
|
||||||
{
|
|
||||||
branches = new ArrayList<String>();
|
branches = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,29 +157,24 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
/**
|
/**
|
||||||
* Returns the creation date of the changeset.
|
* Returns the creation date of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return date of the changeset
|
* @return date of the changeset
|
||||||
*/
|
*/
|
||||||
public Long getDate()
|
public Long getDate() {
|
||||||
{
|
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the description (commit message) of the changeset.
|
* Return the description (commit message) of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return description of the changeset
|
* @return description of the changeset
|
||||||
*/
|
*/
|
||||||
public String getDescription()
|
public String getDescription() {
|
||||||
{
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id of the changeset.
|
* Returns the id of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return id of the changeset
|
* @return id of the changeset
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -263,18 +198,14 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the ids of the parent changesets.
|
* Return the ids of the parent changesets.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
* @since 1.11
|
* @since 1.11
|
||||||
*/
|
*/
|
||||||
public List<String> getParents()
|
public List<String> getParents() {
|
||||||
{
|
if (parents == null) {
|
||||||
if (parents == null)
|
|
||||||
{
|
|
||||||
parents = new ArrayList<String>();
|
parents = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,13 +215,10 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
/**
|
/**
|
||||||
* Returns tags associated with this changeset.
|
* Returns tags associated with this changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return tags of the changeset
|
* @return tags of the changeset
|
||||||
*/
|
*/
|
||||||
public List<String> getTags()
|
public List<String> getTags() {
|
||||||
{
|
if (tags == null) {
|
||||||
if (tags == null)
|
|
||||||
{
|
|
||||||
tags = new ArrayList<String>();
|
tags = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,12 +228,10 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
/**
|
/**
|
||||||
* Returns true if the changeset is valid.
|
* Returns true if the changeset is valid.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return true if the changeset is valid
|
* @return true if the changeset is valid
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid()
|
public boolean isValid() {
|
||||||
{
|
|
||||||
return Util.isNotEmpty(id) && ValidationUtil.isValid(author)
|
return Util.isNotEmpty(id) && ValidationUtil.isValid(author)
|
||||||
&& (date != null);
|
&& (date != null);
|
||||||
}
|
}
|
||||||
@@ -313,78 +239,64 @@ public class Changeset extends BasicPropertiesAware implements ModelObject {
|
|||||||
/**
|
/**
|
||||||
* Sets the author of the changeset.
|
* Sets the author of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param author author of the changeset
|
* @param author author of the changeset
|
||||||
*/
|
*/
|
||||||
public void setAuthor(Person author)
|
public void setAuthor(Person author) {
|
||||||
{
|
|
||||||
this.author = author;
|
this.author = author;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the branches of the changeset.
|
* Sets the branches of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param branches branches of the changeset
|
* @param branches branches of the changeset
|
||||||
*/
|
*/
|
||||||
public void setBranches(List<String> branches)
|
public void setBranches(List<String> branches) {
|
||||||
{
|
|
||||||
this.branches = branches;
|
this.branches = branches;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the date of the changeset.
|
* Sets the date of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param date date of the changeset
|
* @param date date of the changeset
|
||||||
*/
|
*/
|
||||||
public void setDate(Long date)
|
public void setDate(Long date) {
|
||||||
{
|
|
||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the description (commit message) of the changeset.
|
* Sets the description (commit message) of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param description description of the changeset
|
* @param description description of the changeset
|
||||||
*/
|
*/
|
||||||
public void setDescription(String description)
|
public void setDescription(String description) {
|
||||||
{
|
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the id of the changeset.
|
* Sets the id of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param id id of the changeset
|
* @param id id of the changeset
|
||||||
*/
|
*/
|
||||||
public void setId(String id)
|
public void setId(String id) {
|
||||||
{
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the parents of the changeset.
|
* Sets the parents of the changeset.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param parents parents of the changeset
|
* @param parents parents of the changeset
|
||||||
* @since 1.11
|
* @since 1.11
|
||||||
*/
|
*/
|
||||||
public void setParents(List<String> parents)
|
public void setParents(List<String> parents) {
|
||||||
{
|
|
||||||
this.parents = parents;
|
this.parents = parents;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tags of the changeset
|
* Sets the tags of the changeset
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param tags tags of the changeset
|
* @param tags tags of the changeset
|
||||||
*/
|
*/
|
||||||
public void setTags(List<String> tags)
|
public void setTags(List<String> tags) {
|
||||||
{
|
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,53 +24,37 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The changeset paging result is used to do a paging over the
|
* The changeset paging result is used to do a paging over the
|
||||||
* {@link Changeset}s of a {@link Repository}.
|
* {@link Changeset}s of a {@link Repository}.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "changeset-paging")
|
@ToString
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@Setter
|
||||||
public class ChangesetPagingResult implements Iterable<Changeset>, Serializable
|
public class ChangesetPagingResult implements Iterable<Changeset>, Serializable {
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = -8678755403658841733L;
|
private static final long serialVersionUID = -8678755403658841733L;
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
private List<Changeset> changesets;
|
||||||
|
private int total;
|
||||||
|
private String branchName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new changeset paging result.
|
* Constructs a new changeset paging result.
|
||||||
*
|
*
|
||||||
*/
|
|
||||||
public ChangesetPagingResult() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new changeset paging result.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param total total number of changesets
|
* @param total total number of changesets
|
||||||
* @param changesets current list of fetched changesets
|
* @param changesets current list of fetched changesets
|
||||||
*/
|
*/
|
||||||
public ChangesetPagingResult(int total, List<Changeset> changesets)
|
public ChangesetPagingResult(int total, List<Changeset> changesets) {
|
||||||
{
|
|
||||||
this.total = total;
|
this.total = total;
|
||||||
this.changesets = changesets;
|
this.changesets = changesets;
|
||||||
this.branchName = null;
|
this.branchName = null;
|
||||||
@@ -79,38 +63,23 @@ public class ChangesetPagingResult implements Iterable<Changeset>, Serializable
|
|||||||
/**
|
/**
|
||||||
* Constructs a new changeset paging result for a specific branch.
|
* Constructs a new changeset paging result for a specific branch.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param total total number of changesets
|
* @param total total number of changesets
|
||||||
* @param changesets current list of fetched changesets
|
* @param changesets current list of fetched changesets
|
||||||
* @param branchName branch name this result was created for
|
* @param branchName branch name this result was created for
|
||||||
*/
|
*/
|
||||||
public ChangesetPagingResult(int total, List<Changeset> changesets, String branchName)
|
public ChangesetPagingResult(int total, List<Changeset> changesets, String branchName) {
|
||||||
{
|
|
||||||
this.total = total;
|
this.total = total;
|
||||||
this.changesets = changesets;
|
this.changesets = changesets;
|
||||||
this.branchName = branchName;
|
this.branchName = branchName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj) {
|
||||||
{
|
if (obj == null) {
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
if (getClass() != obj.getClass()) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,94 +89,46 @@ public class ChangesetPagingResult implements Iterable<Changeset>, Serializable
|
|||||||
&& Objects.equal(total, other.total);
|
&& Objects.equal(total, other.total);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode() {
|
||||||
{
|
|
||||||
return Objects.hashCode(changesets, total);
|
return Objects.hashCode(changesets, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an iterator which can iterate over the current list of changesets.
|
* Returns an iterator which can iterate over the current list of changesets.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return iterator for current list of changesets
|
* @return iterator for current list of changesets
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Iterator<Changeset> iterator()
|
public Iterator<Changeset> iterator() {
|
||||||
{
|
|
||||||
Iterator<Changeset> it = null;
|
Iterator<Changeset> it = null;
|
||||||
|
|
||||||
if (changesets != null)
|
if (changesets != null) {
|
||||||
{
|
|
||||||
it = changesets.iterator();
|
it = changesets.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("changesets", changesets)
|
|
||||||
.add("total", total)
|
|
||||||
.add("branch", branchName)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current list of changesets.
|
* Returns the current list of changesets.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return current list of changesets
|
* @return current list of changesets
|
||||||
*/
|
*/
|
||||||
public List<Changeset> getChangesets()
|
public List<Changeset> getChangesets() {
|
||||||
{
|
|
||||||
return changesets;
|
return changesets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the total number of changesets.
|
* Returns the total number of changesets.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return total number of changesets
|
* @return total number of changesets
|
||||||
*/
|
*/
|
||||||
public int getTotal()
|
public int getTotal() {
|
||||||
{
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setChangesets(List<Changeset> changesets)
|
|
||||||
{
|
|
||||||
this.changesets = changesets;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTotal(int total)
|
|
||||||
{
|
|
||||||
this.total = total;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setBranchName(String branchName) {
|
|
||||||
this.branchName = branchName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the branch name this result was created for. This can either be an explicit branch ("give me all
|
* Returns the branch name this result was created for. This can either be an explicit branch ("give me all
|
||||||
* changesets for branch xyz") or an implicit one ("give me the changesets for the default").
|
* changesets for branch xyz") or an implicit one ("give me the changesets for the default").
|
||||||
@@ -216,13 +137,4 @@ public class ChangesetPagingResult implements Iterable<Changeset>, Serializable
|
|||||||
return branchName;
|
return branchName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
@XmlElement(name = "changeset")
|
|
||||||
@XmlElementWrapper(name = "changesets")
|
|
||||||
private List<Changeset> changesets;
|
|
||||||
|
|
||||||
private int total;
|
|
||||||
|
|
||||||
private String branchName;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,15 +24,12 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
import sonia.scm.LastModifiedAware;
|
import sonia.scm.LastModifiedAware;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -49,98 +46,70 @@ import static java.util.Optional.ofNullable;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "file")
|
@EqualsAndHashCode
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@ToString
|
||||||
public class FileObject implements LastModifiedAware, Serializable
|
public class FileObject implements LastModifiedAware, Serializable {
|
||||||
{
|
|
||||||
|
|
||||||
/** serial version uid */
|
|
||||||
private static final long serialVersionUID = -5562537629609891499L;
|
private static final long serialVersionUID = -5562537629609891499L;
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* directory indicator
|
||||||
*/
|
*/
|
||||||
@Override
|
private boolean directory;
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final FileObject other = (FileObject) obj;
|
|
||||||
|
|
||||||
//J-
|
|
||||||
return Objects.equal(name, other.name)
|
|
||||||
&& Objects.equal(path, other.path)
|
|
||||||
&& Objects.equal(directory, other.directory)
|
|
||||||
&& Objects.equal(description, other.description)
|
|
||||||
&& Objects.equal(length, other.length)
|
|
||||||
&& Objects.equal(subRepository, other.subRepository)
|
|
||||||
&& Objects.equal(commitDate, other.commitDate)
|
|
||||||
&& Objects.equal(partialResult, other.partialResult)
|
|
||||||
&& Objects.equal(computationAborted, other.computationAborted);
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* commit date
|
||||||
*/
|
*/
|
||||||
@Override
|
private Long commitDate;
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(
|
|
||||||
name,
|
|
||||||
path,
|
|
||||||
directory,
|
|
||||||
description,
|
|
||||||
length,
|
|
||||||
subRepository,
|
|
||||||
commitDate,
|
|
||||||
partialResult,
|
|
||||||
computationAborted);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* file length
|
||||||
*/
|
*/
|
||||||
@Override
|
private Long length;
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("name", name)
|
|
||||||
.add("path", path)
|
|
||||||
.add("directory", directory)
|
|
||||||
.add("description", description)
|
|
||||||
.add("length", length)
|
|
||||||
.add("subRepository", subRepository)
|
|
||||||
.add("commitDate", commitDate)
|
|
||||||
.add("partialResult", partialResult)
|
|
||||||
.add("computationAborted", computationAborted)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
/**
|
||||||
|
* filename
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* file path
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marker for partial result.
|
||||||
|
*/
|
||||||
|
private boolean partialResult = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marker for aborted computation.
|
||||||
|
*/
|
||||||
|
private boolean computationAborted = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sub repository informations
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "subrepository")
|
||||||
|
private SubRepository subRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Children of this file (aka directory).
|
||||||
|
*/
|
||||||
|
private Collection<FileObject> children = new ArrayList<>();
|
||||||
|
|
||||||
|
private boolean truncated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last commit message for this file. The method will return null,
|
* Returns the last commit message for this file. The method will return null,
|
||||||
* if the repository provider is not able to get the last commit for the path.
|
* if the repository provider is not able to get the last commit for the path.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return Last commit message or <code>null</code>, when this value has not been computed
|
* @return Last commit message or <code>null</code>, when this value has not been computed
|
||||||
* (see {@link #isPartialResult()}).
|
* (see {@link #isPartialResult()}).
|
||||||
*/
|
*/
|
||||||
public Optional<String> getDescription()
|
public Optional<String> getDescription() {
|
||||||
{
|
|
||||||
return ofNullable(description);
|
return ofNullable(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +118,6 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
* if the repository provider is not able to get the last commit for the path
|
* if the repository provider is not able to get the last commit for the path
|
||||||
* or it has not been computed.
|
* or it has not been computed.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return last commit date
|
* @return last commit date
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -162,8 +130,7 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
* if the repository provider is not able to get the last commit for the path or if this value has not been computed
|
* if the repository provider is not able to get the last commit for the path or if this value has not been computed
|
||||||
* (see {@link #isPartialResult()} and {@link #isComputationAborted()}).
|
* (see {@link #isPartialResult()} and {@link #isComputationAborted()}).
|
||||||
*/
|
*/
|
||||||
public OptionalLong getCommitDate()
|
public OptionalLong getCommitDate() {
|
||||||
{
|
|
||||||
return commitDate == null ? OptionalLong.empty() : OptionalLong.of(commitDate);
|
return commitDate == null ? OptionalLong.empty() : OptionalLong.of(commitDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,30 +138,25 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
* Returns the length of the file or {@link OptionalLong#empty()}, when this value has not been computed
|
* Returns the length of the file or {@link OptionalLong#empty()}, when this value has not been computed
|
||||||
* (see {@link #isPartialResult()} and {@link #isComputationAborted()}).
|
* (see {@link #isPartialResult()} and {@link #isComputationAborted()}).
|
||||||
*/
|
*/
|
||||||
public OptionalLong getLength()
|
public OptionalLong getLength() {
|
||||||
{
|
|
||||||
return length == null ? OptionalLong.empty() : OptionalLong.of(length);
|
return length == null ? OptionalLong.empty() : OptionalLong.of(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the file.
|
* Returns the name of the file.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return name of file
|
* @return name of file
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path of the file.
|
* Returns the path of the file.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return path of file
|
* @return path of file
|
||||||
*/
|
*/
|
||||||
public String getPath()
|
public String getPath() {
|
||||||
{
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,22 +180,19 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
* Return sub repository information or null if the file is not
|
* Return sub repository information or null if the file is not
|
||||||
* sub repository.
|
* sub repository.
|
||||||
*
|
*
|
||||||
* @since 1.10
|
|
||||||
* @return sub repository informations or null
|
* @return sub repository informations or null
|
||||||
|
* @since 1.10
|
||||||
*/
|
*/
|
||||||
public SubRepository getSubRepository()
|
public SubRepository getSubRepository() {
|
||||||
{
|
|
||||||
return subRepository;
|
return subRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the file is a directory.
|
* Returns true if the file is a directory.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return true if file is a directory
|
* @return true if file is a directory
|
||||||
*/
|
*/
|
||||||
public boolean isDirectory()
|
public boolean isDirectory() {
|
||||||
{
|
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,9 +211,8 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
* will return {@link Optional#empty()} (or {@link OptionalLong#empty()} respectively), unless they are computed.
|
* will return {@link Optional#empty()} (or {@link OptionalLong#empty()} respectively), unless they are computed.
|
||||||
* There may be an asynchronous task running, that will set these values in the future.
|
* There may be an asynchronous task running, that will set these values in the future.
|
||||||
*
|
*
|
||||||
* @since 2.0.0
|
|
||||||
*
|
|
||||||
* @return <code>true</code>, whenever some values of this object have not been computed, yet.
|
* @return <code>true</code>, whenever some values of this object have not been computed, yet.
|
||||||
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
public boolean isPartialResult() {
|
public boolean isPartialResult() {
|
||||||
return partialResult;
|
return partialResult;
|
||||||
@@ -265,9 +223,8 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
* values (like {@link #getLength()}, {@link #getDescription()} or {@link #getCommitDate()})
|
* values (like {@link #getLength()}, {@link #getDescription()} or {@link #getCommitDate()})
|
||||||
* will return {@link Optional#empty()} (or {@link OptionalLong#empty()} respectively), unless they are computed.
|
* will return {@link Optional#empty()} (or {@link OptionalLong#empty()} respectively), unless they are computed.
|
||||||
*
|
*
|
||||||
* @since 2.0.0
|
|
||||||
*
|
|
||||||
* @return <code>true</code>, whenever some values of this object finally are not computed.
|
* @return <code>true</code>, whenever some values of this object finally are not computed.
|
||||||
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
public boolean isComputationAborted() {
|
public boolean isComputationAborted() {
|
||||||
return computationAborted;
|
return computationAborted;
|
||||||
@@ -282,87 +239,72 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
/**
|
/**
|
||||||
* Sets the description of the file.
|
* Sets the description of the file.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param description description of file
|
* @param description description of file
|
||||||
*/
|
*/
|
||||||
public void setDescription(String description)
|
public void setDescription(String description) {
|
||||||
{
|
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to true to indicate that the file is a directory.
|
* Set to true to indicate that the file is a directory.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param directory true for directory
|
* @param directory true for directory
|
||||||
*/
|
*/
|
||||||
public void setDirectory(boolean directory)
|
public void setDirectory(boolean directory) {
|
||||||
{
|
|
||||||
this.directory = directory;
|
this.directory = directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the commit date of the file.
|
* Sets the commit date of the file.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param commitDate commit date
|
* @param commitDate commit date
|
||||||
*/
|
*/
|
||||||
public void setCommitDate(Long commitDate)
|
public void setCommitDate(Long commitDate) {
|
||||||
{
|
|
||||||
this.commitDate = commitDate;
|
this.commitDate = commitDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the length of the file.
|
* Sets the length of the file.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param length file length
|
* @param length file length
|
||||||
*/
|
*/
|
||||||
public void setLength(Long length)
|
public void setLength(Long length) {
|
||||||
{
|
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the file.
|
* Sets the name of the file.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param name filename
|
* @param name filename
|
||||||
*/
|
*/
|
||||||
public void setName(String name)
|
public void setName(String name) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the path of the file.
|
* Sets the path of the file.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param path file path
|
* @param path file path
|
||||||
*/
|
*/
|
||||||
public void setPath(String path)
|
public void setPath(String path) {
|
||||||
{
|
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set sub repository information for the file.
|
* Set sub repository information for the file.
|
||||||
*
|
*
|
||||||
* @since 1.10
|
|
||||||
*
|
|
||||||
* @param subRepository sub repository informations
|
* @param subRepository sub repository informations
|
||||||
|
* @since 1.10
|
||||||
*/
|
*/
|
||||||
public void setSubRepository(SubRepository subRepository)
|
public void setSubRepository(SubRepository subRepository) {
|
||||||
{
|
|
||||||
this.subRepository = subRepository;
|
this.subRepository = subRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set marker, that some values for this object are not computed, yet.
|
* Set marker, that some values for this object are not computed, yet.
|
||||||
*
|
*
|
||||||
* @since 2.0.0
|
|
||||||
*
|
|
||||||
* @param partialResult Set this to <code>true</code>, whenever some values of this object are not computed, yet.
|
* @param partialResult Set this to <code>true</code>, whenever some values of this object are not computed, yet.
|
||||||
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
public void setPartialResult(boolean partialResult) {
|
public void setPartialResult(boolean partialResult) {
|
||||||
this.partialResult = partialResult;
|
this.partialResult = partialResult;
|
||||||
@@ -371,10 +313,9 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
/**
|
/**
|
||||||
* Set marker, that computation of some values for this object has been aborted.
|
* Set marker, that computation of some values for this object has been aborted.
|
||||||
*
|
*
|
||||||
* @since 2.0.0
|
|
||||||
*
|
|
||||||
* @param computationAborted Set this to <code>true</code>, whenever some values of this object are not computed and
|
* @param computationAborted Set this to <code>true</code>, whenever some values of this object are not computed and
|
||||||
* will not be computed in the future.
|
* will not be computed in the future.
|
||||||
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
public void setComputationAborted(boolean computationAborted) {
|
public void setComputationAborted(boolean computationAborted) {
|
||||||
this.computationAborted = computationAborted;
|
this.computationAborted = computationAborted;
|
||||||
@@ -401,39 +342,4 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
public void setTruncated(boolean truncated) {
|
public void setTruncated(boolean truncated) {
|
||||||
this.truncated = truncated;
|
this.truncated = truncated;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** file description */
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
/** directory indicator */
|
|
||||||
private boolean directory;
|
|
||||||
|
|
||||||
/** commit date */
|
|
||||||
private Long commitDate;
|
|
||||||
|
|
||||||
/** file length */
|
|
||||||
private Long length;
|
|
||||||
|
|
||||||
/** filename */
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** file path */
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
/** Marker for partial result. */
|
|
||||||
private boolean partialResult = false;
|
|
||||||
|
|
||||||
/** Marker for aborted computation. */
|
|
||||||
private boolean computationAborted = false;
|
|
||||||
|
|
||||||
/** sub repository informations */
|
|
||||||
@XmlElement(name = "subrepository")
|
|
||||||
private SubRepository subRepository;
|
|
||||||
|
|
||||||
/** Children of this file (aka directory). */
|
|
||||||
private Collection<FileObject> children = new ArrayList<>();
|
|
||||||
|
|
||||||
private boolean truncated;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,163 +24,71 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import result of the {@link AdvancedImportHandler}.
|
* Import result of the {@link AdvancedImportHandler}.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.43
|
* @since 1.43
|
||||||
*/
|
*/
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@EqualsAndHashCode
|
||||||
@XmlRootElement(name = "import-result")
|
@ToString
|
||||||
public final class ImportResult
|
@Getter
|
||||||
{
|
public final class ImportResult {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs ...
|
* failed directories
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
ImportResult() {}
|
private List<String> failedDirectories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new import result.
|
* successfully imported directories
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param importedDirectories imported directories
|
|
||||||
* @param failedDirectories failed directories
|
|
||||||
*/
|
*/
|
||||||
|
private List<String> importedDirectories;
|
||||||
|
|
||||||
public ImportResult(List<String> importedDirectories,
|
public ImportResult(List<String> importedDirectories,
|
||||||
List<String> failedDirectories)
|
List<String> failedDirectories) {
|
||||||
{
|
|
||||||
this.importedDirectories = checkNotNull(importedDirectories,
|
this.importedDirectories = checkNotNull(importedDirectories,
|
||||||
"list of imported directories is required");
|
"list of imported directories is required");
|
||||||
this.failedDirectories = checkNotNull(failedDirectories,
|
this.failedDirectories = checkNotNull(failedDirectories,
|
||||||
"list of failed directories is required");
|
"list of failed directories is required");
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
public static Builder builder() {
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a import result builder.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return import result builder
|
|
||||||
*/
|
|
||||||
public static Builder builder()
|
|
||||||
{
|
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ImportResult other = (ImportResult) obj;
|
|
||||||
|
|
||||||
return Objects.equal(importedDirectories, other.importedDirectories)
|
|
||||||
&& Objects.equal(failedDirectories, other.failedDirectories);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(importedDirectories, failedDirectories);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("importedDirectories", importedDirectories)
|
|
||||||
.add("failedDirectories", failedDirectories)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns list of failed directories.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return list of failed directories
|
|
||||||
*/
|
|
||||||
public List<String> getFailedDirectories()
|
|
||||||
{
|
|
||||||
return failedDirectories;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns list of successfully imported directories.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return list of successfully imported directories
|
|
||||||
*/
|
|
||||||
public List<String> getImportedDirectories()
|
|
||||||
{
|
|
||||||
return importedDirectories;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- inner classes --------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder for {@link ImportResult}.
|
* Builder for {@link ImportResult}.
|
||||||
*/
|
*/
|
||||||
public static class Builder
|
public static class Builder {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs ...
|
* successfully imported directories
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
private Builder() {}
|
private final List<String> importedDirectories = Lists.newArrayList();
|
||||||
|
|
||||||
//~--- methods ------------------------------------------------------------
|
/**
|
||||||
|
* failed directories
|
||||||
|
*/
|
||||||
|
private final List<String> failedDirectories = Lists.newArrayList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a failed directory to the import result.
|
* Adds a failed directory to the import result.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param name name of the directory
|
* @param name name of the directory
|
||||||
*
|
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
*/
|
*/
|
||||||
public Builder addFailedDirectory(String name)
|
public Builder addFailedDirectory(String name) {
|
||||||
{
|
|
||||||
this.failedDirectories.add(name);
|
this.failedDirectories.add(name);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -189,13 +97,10 @@ public final class ImportResult
|
|||||||
/**
|
/**
|
||||||
* Adds a successfully imported directory to the import result.
|
* Adds a successfully imported directory to the import result.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param name name of the directory
|
* @param name name of the directory
|
||||||
*
|
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
*/
|
*/
|
||||||
public Builder addImportedDirectory(String name)
|
public Builder addImportedDirectory(String name) {
|
||||||
{
|
|
||||||
this.importedDirectories.add(name);
|
this.importedDirectories.add(name);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -204,30 +109,11 @@ public final class ImportResult
|
|||||||
/**
|
/**
|
||||||
* Builds the final import result.
|
* Builds the final import result.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return final import result
|
* @return final import result
|
||||||
*/
|
*/
|
||||||
public ImportResult build()
|
public ImportResult build() {
|
||||||
{
|
|
||||||
return new ImportResult(ImmutableList.copyOf(importedDirectories),
|
return new ImportResult(ImmutableList.copyOf(importedDirectories),
|
||||||
ImmutableList.copyOf(failedDirectories));
|
ImmutableList.copyOf(failedDirectories));
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields -------------------------------------------------------------
|
|
||||||
|
|
||||||
/** successfully imported directories */
|
|
||||||
private final List<String> importedDirectories = Lists.newArrayList();
|
|
||||||
|
|
||||||
/** failed directories */
|
|
||||||
private final List<String> failedDirectories = Lists.newArrayList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** failed directories */
|
|
||||||
private List<String> failedDirectories;
|
|
||||||
|
|
||||||
/** successfully imported directories */
|
|
||||||
private List<String> importedDirectories;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,186 +24,66 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import sonia.scm.util.Util;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
|
@Setter
|
||||||
|
public class Modifications implements Serializable {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "modifications")
|
|
||||||
public class Modifications implements Serializable
|
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = -8902033326668658140L;
|
private static final long serialVersionUID = -8902033326668658140L;
|
||||||
|
private String revision;
|
||||||
//~--- constructors ---------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs ...
|
* lists of changed files
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
private List<String> added;
|
||||||
|
private List<String> modified;
|
||||||
|
private List<String> removed;
|
||||||
|
|
||||||
public Modifications() {
|
public Modifications() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
;
|
||||||
* Constructs ...
|
|
||||||
*
|
public Modifications(List<String> added) {
|
||||||
*
|
|
||||||
* @param added
|
|
||||||
*/
|
|
||||||
public Modifications(List<String> added)
|
|
||||||
{
|
|
||||||
this(added, null, null);
|
this(added, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Modifications(List<String> added, List<String> modified) {
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param added
|
|
||||||
* @param modified
|
|
||||||
*/
|
|
||||||
public Modifications(List<String> added, List<String> modified)
|
|
||||||
{
|
|
||||||
this(added, modified, null);
|
this(added, modified, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Modifications(List<String> added, List<String> modified, List<String> removed) {
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param added
|
|
||||||
* @param modified
|
|
||||||
* @param removed
|
|
||||||
*/
|
|
||||||
public Modifications(List<String> added, List<String> modified,
|
|
||||||
List<String> removed)
|
|
||||||
{
|
|
||||||
this.added = added;
|
this.added = added;
|
||||||
this.modified = modified;
|
this.modified = modified;
|
||||||
this.removed = removed;
|
this.removed = removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
public List<String> getAdded() {
|
||||||
|
if (added == null) {
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Modifications other = (Modifications) obj;
|
|
||||||
|
|
||||||
return Objects.equal(added, other.added)
|
|
||||||
&& Objects.equal(modified, other.modified)
|
|
||||||
&& Objects.equal(removed, other.removed);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(added, modified, removed);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder out = new StringBuilder();
|
|
||||||
|
|
||||||
out.append("added:").append(Util.toString(added)).append("\n");
|
|
||||||
out.append("modified:").append(Util.toString(modified)).append("\n");
|
|
||||||
out.append("removed:").append(Util.toString(removed)).append("\n");
|
|
||||||
|
|
||||||
return out.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<String> getAdded()
|
|
||||||
{
|
|
||||||
if (added == null)
|
|
||||||
{
|
|
||||||
added = Lists.newArrayList();
|
added = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public List<String> getModified() {
|
||||||
* Method description
|
if (modified == null) {
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<String> getModified()
|
|
||||||
{
|
|
||||||
if (modified == null)
|
|
||||||
{
|
|
||||||
modified = Lists.newArrayList();
|
modified = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public List<String> getRemoved() {
|
||||||
* Method description
|
if (removed == null) {
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<String> getRemoved()
|
|
||||||
{
|
|
||||||
if (removed == null)
|
|
||||||
{
|
|
||||||
removed = Lists.newArrayList();
|
removed = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,62 +93,4 @@ public class Modifications implements Serializable
|
|||||||
public String getRevision() {
|
public String getRevision() {
|
||||||
return revision;
|
return revision;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param added
|
|
||||||
*/
|
|
||||||
public void setAdded(List<String> added)
|
|
||||||
{
|
|
||||||
this.added = added;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param modified
|
|
||||||
*/
|
|
||||||
public void setModified(List<String> modified)
|
|
||||||
{
|
|
||||||
this.modified = modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param removed
|
|
||||||
*/
|
|
||||||
public void setRemoved(List<String> removed)
|
|
||||||
{
|
|
||||||
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")
|
|
||||||
private List<String> added;
|
|
||||||
|
|
||||||
/** list of modified files */
|
|
||||||
@XmlElement(name = "modified")
|
|
||||||
@XmlElementWrapper(name = "modified")
|
|
||||||
private List<String> modified;
|
|
||||||
|
|
||||||
/** list of removed files */
|
|
||||||
@XmlElement(name = "removed")
|
|
||||||
@XmlElementWrapper(name = "removed")
|
|
||||||
private List<String> removed;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,91 +24,67 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
import com.google.common.base.Objects;
|
import lombok.Setter;
|
||||||
import sonia.scm.Validateable;
|
import sonia.scm.Validateable;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
import sonia.scm.util.ValidationUtil;
|
import sonia.scm.util.ValidationUtil;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link Person} (author) of a changeset.
|
* The {@link Person} (author) of a changeset.
|
||||||
*
|
*
|
||||||
* @person Sebastian Sdorra
|
* @person Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "person")
|
@EqualsAndHashCode
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@Getter
|
||||||
public class Person implements Validateable, Serializable
|
@Setter
|
||||||
{
|
public class Person implements Validateable, Serializable {
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = -4675080650527063196L;
|
private static final long serialVersionUID = -4675080650527063196L;
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
/**
|
||||||
|
* mail address of the person
|
||||||
|
*/
|
||||||
|
private String mail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@link Person}.
|
* name of the person
|
||||||
* This constructor is used by JAXB.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public Person() {}
|
private String name;
|
||||||
|
|
||||||
/**
|
public Person() {
|
||||||
* Constructs a new {@link Person}.
|
}
|
||||||
*
|
|
||||||
*
|
public Person(String name) {
|
||||||
* @param name name of {@link Person}
|
|
||||||
*/
|
|
||||||
public Person(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Person(String name, String mail) {
|
||||||
* Constructs a new {@link Person} with name and mail address.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param name name of the {@link Person}
|
|
||||||
* @param mail mail address of the {@link Person}
|
|
||||||
*/
|
|
||||||
public Person(String name, String mail)
|
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.mail = mail;
|
this.mail = mail;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the given string and returns a {@link Person} object. The string
|
* Parses the given string and returns a {@link Person} object. The string
|
||||||
* should be in the format "name >mail<". if the string contains no
|
* should be in the format "name >mail<". if the string contains no
|
||||||
* "><" the whole string is handled as the name of the {@link Person}.
|
* "><" the whole string is handled as the name of the {@link Person}.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param value string representation of a {@link Person} object
|
* @param value string representation of a {@link Person} object
|
||||||
*
|
|
||||||
* @return {@link Person} object which is generated from the given string
|
* @return {@link Person} object which is generated from the given string
|
||||||
*/
|
*/
|
||||||
public static Person toPerson(String value)
|
public static Person toPerson(String value) {
|
||||||
{
|
|
||||||
Person person = null;
|
Person person = null;
|
||||||
|
|
||||||
if (Util.isNotEmpty(value))
|
if (Util.isNotEmpty(value)) {
|
||||||
{
|
|
||||||
String name = value;
|
String name = value;
|
||||||
String mail = null;
|
String mail = null;
|
||||||
int s = value.indexOf('<');
|
int s = value.indexOf('<');
|
||||||
int e = value.indexOf('>');
|
int e = value.indexOf('>');
|
||||||
|
|
||||||
if ((s > 0) && (e > 0))
|
if ((s > 0) && (e > 0)) {
|
||||||
{
|
|
||||||
name = value.substring(0, s).trim();
|
name = value.substring(0, s).trim();
|
||||||
mail = value.substring(s + 1, e).trim();
|
mail = value.substring(s + 1, e).trim();
|
||||||
}
|
}
|
||||||
@@ -119,56 +95,17 @@ public class Person implements Validateable, Serializable
|
|||||||
return person;
|
return person;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Person other = (Person) obj;
|
|
||||||
|
|
||||||
return Objects.equal(name, other.name) && Objects.equal(mail, other.mail);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(name, mail);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string representation of the {@link Person} object,
|
* Returns a string representation of the {@link Person} object,
|
||||||
* in the format "name >mail<".
|
* in the format "name >mail<".
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return string representation of {@link Person} object
|
* @return string representation of {@link Person} object
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
String out = name;
|
String out = name;
|
||||||
|
|
||||||
if (mail != null)
|
if (mail != null) {
|
||||||
{
|
|
||||||
out = out.concat(" <").concat(mail).concat(">");
|
out = out.concat(" <").concat(mail).concat(">");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,71 +117,30 @@ public class Person implements Validateable, Serializable
|
|||||||
/**
|
/**
|
||||||
* Returns the mail address of the changeset author.
|
* Returns the mail address of the changeset author.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return mail address of the changeset author
|
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getMail()
|
public String getMail() {
|
||||||
{
|
|
||||||
return mail;
|
return mail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the changeset author.
|
* Returns the name of the changeset author.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return name of the changeset person
|
* @return name of the changeset person
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the person is valid.
|
* Returns true if the person is valid.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return true if the person is valid
|
* @return true if the person is valid
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid()
|
public boolean isValid() {
|
||||||
{
|
|
||||||
return Util.isNotEmpty(name)
|
return Util.isNotEmpty(name)
|
||||||
&& (Util.isEmpty(mail) || ValidationUtil.isMailAddressValid(mail));
|
&& (Util.isEmpty(mail) || ValidationUtil.isMailAddressValid(mail));
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the mail address of the changeset author.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param mail mail address of the author
|
|
||||||
*/
|
|
||||||
public void setMail(String mail)
|
|
||||||
{
|
|
||||||
this.mail = mail;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the name of the changeset author.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param name name of the author
|
|
||||||
*/
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** mail address of the person */
|
|
||||||
private String mail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* name of the person
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,218 +24,42 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
|
|
||||||
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.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class SubRepository implements Serializable {
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 1.10
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
@XmlRootElement(name = "subrepository")
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class SubRepository implements Serializable
|
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = 6960065820378492531L;
|
private static final long serialVersionUID = 6960065820378492531L;
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public SubRepository() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param repositoryUrl
|
|
||||||
*/
|
|
||||||
public SubRepository(String repositoryUrl)
|
|
||||||
{
|
|
||||||
this.repositoryUrl = repositoryUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param revision
|
|
||||||
* @param repositoryUrl
|
|
||||||
*/
|
|
||||||
public SubRepository(String repositoryUrl, String revision)
|
|
||||||
{
|
|
||||||
this.repositoryUrl = repositoryUrl;
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param revision
|
|
||||||
* @param repositoryUrl
|
|
||||||
* @param browserUrl
|
|
||||||
*/
|
|
||||||
public SubRepository(String repositoryUrl, String browserUrl, String revision)
|
|
||||||
{
|
|
||||||
this.repositoryUrl = repositoryUrl;
|
|
||||||
this.browserUrl = browserUrl;
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SubRepository other = (SubRepository) obj;
|
|
||||||
|
|
||||||
return Objects.equal(repositoryUrl, other.repositoryUrl)
|
|
||||||
&& Objects.equal(browserUrl, other.browserUrl)
|
|
||||||
&& Objects.equal(revision, other.revision);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(repositoryUrl, browserUrl, revision);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("repositoryUrl", repositoryUrl)
|
|
||||||
.add("browserUrl", browserUrl)
|
|
||||||
.add("revision", revision)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getBrowserUrl()
|
|
||||||
{
|
|
||||||
return browserUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getRepositoryUrl()
|
|
||||||
{
|
|
||||||
return repositoryUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param browserUrl
|
|
||||||
*/
|
|
||||||
public void setBrowserUrl(String browserUrl)
|
|
||||||
{
|
|
||||||
this.browserUrl = browserUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param repositoryUrl
|
|
||||||
*/
|
|
||||||
public void setRepositoryUrl(String repositoryUrl)
|
|
||||||
{
|
|
||||||
this.repositoryUrl = repositoryUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param revision
|
|
||||||
*/
|
|
||||||
public void setRevision(String revision)
|
|
||||||
{
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
@XmlElement(name = "browser-url")
|
|
||||||
private String browserUrl;
|
private String browserUrl;
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
@XmlElement(name = "repository-url")
|
|
||||||
private String repositoryUrl;
|
private String repositoryUrl;
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private String revision;
|
private String revision;
|
||||||
|
|
||||||
|
public SubRepository() {
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
public SubRepository(String repositoryUrl) {
|
||||||
|
this.repositoryUrl = repositoryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubRepository(String repositoryUrl, String revision) {
|
||||||
|
this.repositoryUrl = repositoryUrl;
|
||||||
|
this.revision = revision;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubRepository(String repositoryUrl, String browserUrl, String revision) {
|
||||||
|
this.repositoryUrl = repositoryUrl;
|
||||||
|
this.browserUrl = browserUrl;
|
||||||
|
this.revision = revision;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,16 +24,9 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
import com.google.common.base.MoreObjects;
|
import lombok.ToString;
|
||||||
import com.google.common.base.Objects;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a tag in a repository.
|
* Represents a tag in a repository.
|
||||||
@@ -41,118 +34,25 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.18
|
* @since 1.18
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "tag")
|
@EqualsAndHashCode
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@ToString
|
||||||
public final class Tag
|
@Getter
|
||||||
{
|
public final class Tag {
|
||||||
|
|
||||||
/**
|
private String name;
|
||||||
* Constructs a new instance of tag.
|
private String revision;
|
||||||
* This constructor should only be called from JAXB.
|
|
||||||
*
|
public Tag() {
|
||||||
*/
|
}
|
||||||
public Tag() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new tag.
|
* Constructs a new tag.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param name name of the tag
|
* @param name name of the tag
|
||||||
* @param revision tagged revision
|
* @param revision tagged revision
|
||||||
*/
|
*/
|
||||||
public Tag(String name, String revision)
|
public Tag(String name, String revision) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.revision = revision;
|
this.revision = revision;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Tag other = (Tag) obj;
|
|
||||||
|
|
||||||
return Objects.equal(name, other.name)
|
|
||||||
&& Objects.equal(revision, other.revision);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(name, revision);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("name", name)
|
|
||||||
.add("revision", revision)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of the tag.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return name of the tag
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Id of the tagged revision.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return tagged revision id
|
|
||||||
*/
|
|
||||||
public String getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private String revision;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,136 +24,52 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
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.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents all tags of a repository.
|
* Represents all tags of a repository.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.18
|
* @since 1.18
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "tags")
|
@EqualsAndHashCode
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@ToString
|
||||||
public final class Tags implements Iterable<Tag>
|
@Setter
|
||||||
{
|
public final class Tags implements Iterable<Tag> {
|
||||||
|
|
||||||
/**
|
private List<Tag> tags;
|
||||||
* Constructs a new instance of tags.
|
|
||||||
* This constructor should only be called from JAXB.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Tags() {}
|
|
||||||
|
|
||||||
/**
|
public Tags() {
|
||||||
* Constructs a new instance of tags.
|
}
|
||||||
*
|
|
||||||
*
|
;
|
||||||
* @param tags list of tags.
|
|
||||||
*/
|
public Tags(List<Tag> tags) {
|
||||||
public Tags(List<Tag> tags)
|
|
||||||
{
|
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public Iterator<Tag> iterator() {
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Tags other = (Tags) obj;
|
|
||||||
|
|
||||||
return Objects.equal(tags, other.tags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(tags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Iterator<Tag> iterator()
|
|
||||||
{
|
|
||||||
return getTags().iterator();
|
return getTags().iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("tags", tags)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Tag} with the given name or null.
|
* Returns the {@link Tag} with the given name or null.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param name name of the tag
|
* @param name name of the tag
|
||||||
*
|
|
||||||
* @return {@link Tag} with the given name or null
|
* @return {@link Tag} with the given name or null
|
||||||
*/
|
*/
|
||||||
public Tag getTagByName(String name)
|
public Tag getTagByName(String name) {
|
||||||
{
|
|
||||||
Tag tag = null;
|
Tag tag = null;
|
||||||
|
|
||||||
for (Tag t : getTags())
|
for (Tag t : getTags()) {
|
||||||
{
|
if (name.equals(t.getName())) {
|
||||||
if (name.equals(t.getName()))
|
|
||||||
{
|
|
||||||
tag = t;
|
tag = t;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -166,19 +82,14 @@ public final class Tags implements Iterable<Tag>
|
|||||||
/**
|
/**
|
||||||
* Returns the {@link Tag} with the given revision or null.
|
* Returns the {@link Tag} with the given revision or null.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param revision revision of the tag
|
* @param revision revision of the tag
|
||||||
*
|
|
||||||
* @return {@link Tag} with the given revision or null
|
* @return {@link Tag} with the given revision or null
|
||||||
*/
|
*/
|
||||||
public Tag getTagByRevision(String revision)
|
public Tag getTagByRevision(String revision) {
|
||||||
{
|
|
||||||
Tag tag = null;
|
Tag tag = null;
|
||||||
|
|
||||||
for (Tag t : getTags())
|
for (Tag t : getTags()) {
|
||||||
{
|
if (revision.equals(t.getRevision())) {
|
||||||
if (revision.equals(t.getRevision()))
|
|
||||||
{
|
|
||||||
tag = t;
|
tag = t;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -191,35 +102,13 @@ public final class Tags implements Iterable<Tag>
|
|||||||
/**
|
/**
|
||||||
* Returns all tags of a repository.
|
* Returns all tags of a repository.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return all tags
|
* @return all tags
|
||||||
*/
|
*/
|
||||||
public List<Tag> getTags()
|
public List<Tag> getTags() {
|
||||||
{
|
if (tags == null) {
|
||||||
if (tags == null)
|
|
||||||
{
|
|
||||||
tags = Lists.newArrayList();
|
tags = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets all tags.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param tags tags
|
|
||||||
*/
|
|
||||||
public void setTags(List<Tag> tags)
|
|
||||||
{
|
|
||||||
this.tags = tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
@XmlElement(name = "tag")
|
|
||||||
private List<Tag> tags;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,6 @@
|
|||||||
|
|
||||||
package sonia.scm.repository.api;
|
package sonia.scm.repository.api;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link PushResponse} is the result of the
|
* The {@link PushResponse} is the result of the
|
||||||
* {@link PushCommandBuilder#push(sonia.scm.repository.Repository)} method and
|
* {@link PushCommandBuilder#push(sonia.scm.repository.Repository)} method and
|
||||||
@@ -36,24 +32,14 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.31
|
* @since 1.31
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "push-response")
|
public final class PushResponse extends AbstractPushOrPullResponse {
|
||||||
public final class PushResponse extends AbstractPushOrPullResponse
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new PushResponse.
|
* Constructs a new PushResponse.
|
||||||
*
|
*
|
||||||
*/
|
|
||||||
public PushResponse() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new PushResponse.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param changesetCount count of pushed changesets
|
* @param changesetCount count of pushed changesets
|
||||||
*/
|
*/
|
||||||
public PushResponse(long changesetCount)
|
public PushResponse(long changesetCount) {
|
||||||
{
|
|
||||||
super(changesetCount);
|
super(changesetCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import com.google.inject.Provider;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import sonia.scm.ConfigurationException;
|
|
||||||
import sonia.scm.SCMContextProvider;
|
import sonia.scm.SCMContextProvider;
|
||||||
import sonia.scm.installer.HgInstaller;
|
import sonia.scm.installer.HgInstaller;
|
||||||
import sonia.scm.installer.HgInstallerFactory;
|
import sonia.scm.installer.HgInstallerFactory;
|
||||||
@@ -48,7 +47,6 @@ import sonia.scm.util.IOUtil;
|
|||||||
import sonia.scm.util.SystemUtil;
|
import sonia.scm.util.SystemUtil;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -56,87 +54,47 @@ import java.io.InputStream;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Extension
|
@Extension
|
||||||
public class HgRepositoryHandler
|
public class HgRepositoryHandler
|
||||||
extends AbstractSimpleRepositoryHandler<HgConfig>
|
extends AbstractSimpleRepositoryHandler<HgConfig> {
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
public static final String PATH_HOOK = ".hook-1.8";
|
public static final String PATH_HOOK = ".hook-1.8";
|
||||||
|
public static final String RESOURCE_VERSION = "sonia/scm/version/scm-hg-plugin";
|
||||||
/** Field description */
|
|
||||||
public static final String RESOURCE_VERSION =
|
|
||||||
"sonia/scm/version/scm-hg-plugin";
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
public static final String TYPE_DISPLAYNAME = "Mercurial";
|
public static final String TYPE_DISPLAYNAME = "Mercurial";
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
public static final String TYPE_NAME = "hg";
|
public static final String TYPE_NAME = "hg";
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
public static final RepositoryType TYPE = new RepositoryType(TYPE_NAME,
|
public static final RepositoryType TYPE = new RepositoryType(TYPE_NAME,
|
||||||
TYPE_DISPLAYNAME,
|
TYPE_DISPLAYNAME,
|
||||||
HgRepositoryServiceProvider.COMMANDS,
|
HgRepositoryServiceProvider.COMMANDS,
|
||||||
HgRepositoryServiceProvider.FEATURES);
|
HgRepositoryServiceProvider.FEATURES);
|
||||||
|
|
||||||
/** the logger for HgRepositoryHandler */
|
private static final Logger logger = LoggerFactory.getLogger(HgRepositoryHandler.class);
|
||||||
private static final Logger logger =
|
|
||||||
LoggerFactory.getLogger(HgRepositoryHandler.class);
|
|
||||||
|
|
||||||
/** Field description */
|
public static final String PATH_HGRC = ".hg".concat(File.separator).concat("hgrc");
|
||||||
public static final String PATH_HGRC =
|
|
||||||
".hg".concat(File.separator).concat("hgrc");
|
|
||||||
private static final String CONFIG_SECTION_SCMM = "scmm";
|
private static final String CONFIG_SECTION_SCMM = "scmm";
|
||||||
private static final String CONFIG_KEY_REPOSITORY_ID = "repositoryid";
|
private static final String CONFIG_KEY_REPOSITORY_ID = "repositoryid";
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
private final Provider<HgContext> hgContextProvider;
|
||||||
|
|
||||||
|
private final HgWorkdirFactory workdirFactory;
|
||||||
|
|
||||||
|
private JAXBContext jaxbContext;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public HgRepositoryHandler(ConfigurationStoreFactory storeFactory,
|
public HgRepositoryHandler(ConfigurationStoreFactory storeFactory,
|
||||||
Provider<HgContext> hgContextProvider,
|
Provider<HgContext> hgContextProvider,
|
||||||
RepositoryLocationResolver repositoryLocationResolver,
|
RepositoryLocationResolver repositoryLocationResolver,
|
||||||
PluginLoader pluginLoader, HgWorkdirFactory workdirFactory)
|
PluginLoader pluginLoader, HgWorkdirFactory workdirFactory) {
|
||||||
{
|
|
||||||
super(storeFactory, repositoryLocationResolver, pluginLoader);
|
super(storeFactory, repositoryLocationResolver, pluginLoader);
|
||||||
this.hgContextProvider = hgContextProvider;
|
this.hgContextProvider = hgContextProvider;
|
||||||
this.workdirFactory = workdirFactory;
|
this.workdirFactory = workdirFactory;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.jaxbContext = JAXBContext.newInstance(BrowserResult.class,
|
|
||||||
BlameResult.class, Changeset.class, ChangesetPagingResult.class,
|
|
||||||
HgVersion.class);
|
|
||||||
}
|
|
||||||
catch (JAXBException ex)
|
|
||||||
{
|
|
||||||
throw new ConfigurationException("could not create jaxbcontext", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
public void doAutoConfiguration(HgConfig autoConfig) {
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param autoConfig
|
|
||||||
*/
|
|
||||||
public void doAutoConfiguration(HgConfig autoConfig)
|
|
||||||
{
|
|
||||||
HgInstaller installer = HgInstallerFactory.createInstaller();
|
HgInstaller installer = HgInstallerFactory.createInstaller();
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
if (logger.isDebugEnabled()) {
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("installing mercurial with {}",
|
logger.debug("installing mercurial with {}",
|
||||||
installer.getClass().getName());
|
installer.getClass().getName());
|
||||||
}
|
}
|
||||||
@@ -144,159 +102,83 @@ public class HgRepositoryHandler
|
|||||||
installer.install(baseDirectory, autoConfig);
|
installer.install(baseDirectory, autoConfig);
|
||||||
config = autoConfig;
|
config = autoConfig;
|
||||||
storeConfig();
|
storeConfig();
|
||||||
}
|
} catch (IOException ioe) {
|
||||||
catch (IOException ioe)
|
if (logger.isErrorEnabled()) {
|
||||||
{
|
|
||||||
if (logger.isErrorEnabled())
|
|
||||||
{
|
|
||||||
logger.error("Could not write Hg CGI for inital config. "
|
logger.error("Could not write Hg CGI for inital config. "
|
||||||
+ "HgWeb may not function until a new Hg config is set", ioe);
|
+ "HgWeb may not function until a new Hg config is set", ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void init(SCMContextProvider context)
|
public void init(SCMContextProvider context) {
|
||||||
{
|
|
||||||
super.init(context);
|
super.init(context);
|
||||||
writePythonScripts(context);
|
writePythonScripts(context);
|
||||||
|
|
||||||
// fix wrong hg.bat from package installation
|
// fix wrong hg.bat from package installation
|
||||||
if (SystemUtil.isWindows())
|
if (SystemUtil.isWindows()) {
|
||||||
{
|
|
||||||
HgWindowsPackageFix.fixHgPackage(context, getConfig());
|
HgWindowsPackageFix.fixHgPackage(context, getConfig());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void loadConfig()
|
public void loadConfig() {
|
||||||
{
|
|
||||||
super.loadConfig();
|
super.loadConfig();
|
||||||
|
|
||||||
if (config == null)
|
if (config == null) {
|
||||||
{
|
|
||||||
doAutoConfiguration(new HgConfig());
|
doAutoConfiguration(new HgConfig());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
public HgContext getHgContext() {
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public HgContext getHgContext()
|
|
||||||
{
|
|
||||||
HgContext context = hgContextProvider.get();
|
HgContext context = hgContextProvider.get();
|
||||||
|
|
||||||
if (context == null)
|
if (context == null) {
|
||||||
{
|
|
||||||
context = new HgContext();
|
context = new HgContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ImportHandler getImportHandler()
|
public ImportHandler getImportHandler() {
|
||||||
{
|
|
||||||
return new HgImportHandler(this);
|
return new HgImportHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public JAXBContext getJaxbContext()
|
|
||||||
{
|
|
||||||
return jaxbContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public RepositoryType getType()
|
public RepositoryType getType() {
|
||||||
{
|
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersionInformation()
|
public String getVersionInformation() {
|
||||||
{
|
|
||||||
String version = getStringFromResource(RESOURCE_VERSION,
|
String version = getStringFromResource(RESOURCE_VERSION,
|
||||||
DEFAULT_VERSION_INFORMATION);
|
DEFAULT_VERSION_INFORMATION);
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
HgVersion hgVersion = new HgVersionHandler(this, hgContextProvider.get(),
|
HgVersion hgVersion = new HgVersionHandler(this, hgContextProvider.get(),
|
||||||
baseDirectory).getVersion();
|
baseDirectory).getVersion();
|
||||||
|
|
||||||
if (hgVersion != null)
|
if (hgVersion != null) {
|
||||||
{
|
if (logger.isDebugEnabled()) {
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("mercurial/python informations: {}", hgVersion);
|
logger.debug("mercurial/python informations: {}", hgVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
version = MessageFormat.format(version, hgVersion.getPython(),
|
version = MessageFormat.format(version, hgVersion.getPython(),
|
||||||
hgVersion.getMercurial());
|
hgVersion.getMercurial());
|
||||||
}
|
} else if (logger.isWarnEnabled()) {
|
||||||
else if (logger.isWarnEnabled())
|
|
||||||
{
|
|
||||||
logger.warn("could not retrieve version informations");
|
logger.warn("could not retrieve version informations");
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
logger.error("could not read version informations", ex);
|
logger.error("could not read version informations", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param repository
|
|
||||||
* @param directory
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ExtendedCommand buildCreateCommand(Repository repository,
|
protected ExtendedCommand buildCreateCommand(Repository repository,
|
||||||
File directory)
|
File directory) {
|
||||||
{
|
|
||||||
ExtendedCommand cmd = new ExtendedCommand(config.getHgBinary(), "init",
|
ExtendedCommand cmd = new ExtendedCommand(config.getHgBinary(), "init",
|
||||||
directory.getAbsolutePath());
|
directory.getAbsolutePath());
|
||||||
|
|
||||||
@@ -315,13 +197,11 @@ public class HgRepositoryHandler
|
|||||||
*
|
*
|
||||||
* @param repository
|
* @param repository
|
||||||
* @param directory
|
* @param directory
|
||||||
*
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void postCreate(Repository repository, File directory)
|
protected void postCreate(Repository repository, File directory)
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
File hgrcFile = new File(directory, PATH_HGRC);
|
File hgrcFile = new File(directory, PATH_HGRC);
|
||||||
INIConfiguration hgrc = new INIConfiguration();
|
INIConfiguration hgrc = new INIConfiguration();
|
||||||
|
|
||||||
@@ -336,55 +216,30 @@ public class HgRepositoryHandler
|
|||||||
writer.write(hgrc, hgrcFile);
|
writer.write(hgrc, hgrcFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<HgConfig> getConfigClass()
|
protected Class<HgConfig> getConfigClass() {
|
||||||
{
|
|
||||||
return HgConfig.class;
|
return HgConfig.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
private void writePythonScripts(SCMContextProvider context) {
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
private void writePythonScripts(SCMContextProvider context)
|
|
||||||
{
|
|
||||||
IOUtil.mkdirs(HgPythonScript.getScriptDirectory(context));
|
IOUtil.mkdirs(HgPythonScript.getScriptDirectory(context));
|
||||||
|
|
||||||
for (HgPythonScript script : HgPythonScript.values())
|
for (HgPythonScript script : HgPythonScript.values()) {
|
||||||
{
|
if (logger.isDebugEnabled()) {
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("write python script {}", script.getName());
|
logger.debug("write python script {}", script.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream content = null;
|
InputStream content = null;
|
||||||
OutputStream output = null;
|
OutputStream output = null;
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
content = HgRepositoryHandler.class.getResourceAsStream(
|
content = HgRepositoryHandler.class.getResourceAsStream(
|
||||||
script.getResourcePath());
|
script.getResourcePath());
|
||||||
output = new FileOutputStream(script.getFile(context));
|
output = new FileOutputStream(script.getFile(context));
|
||||||
IOUtil.copy(content, output);
|
IOUtil.copy(content, output);
|
||||||
}
|
} catch (IOException ex) {
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
logger.error("could not write script", ex);
|
logger.error("could not write script", ex);
|
||||||
}
|
} finally {
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.close(content);
|
IOUtil.close(content);
|
||||||
IOUtil.close(output);
|
IOUtil.close(output);
|
||||||
}
|
}
|
||||||
@@ -395,13 +250,7 @@ public class HgRepositoryHandler
|
|||||||
return workdirFactory;
|
return workdirFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
public JAXBContext getJaxbContext() {
|
||||||
|
return jaxbContext;
|
||||||
/** Field description */
|
}
|
||||||
private final Provider<HgContext> hgContextProvider;
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private JAXBContext jaxbContext;
|
|
||||||
|
|
||||||
private final HgWorkdirFactory workdirFactory;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,135 +24,16 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
@EqualsAndHashCode
|
||||||
import com.google.common.base.Objects;
|
@ToString
|
||||||
|
@Getter
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
@Setter
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
public class HgVersion {
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
@XmlRootElement(name = "version")
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class HgVersion
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final HgVersion other = (HgVersion) obj;
|
|
||||||
|
|
||||||
return Objects.equal(mercurial, other.mercurial)
|
|
||||||
&& Objects.equal(python, other.python);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(mercurial, python);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
//J-
|
|
||||||
return MoreObjects.toStringHelper(this)
|
|
||||||
.add("mercurial", mercurial)
|
|
||||||
.add("python", python)
|
|
||||||
.toString();
|
|
||||||
//J+
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getMercurial()
|
|
||||||
{
|
|
||||||
return mercurial;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getPython()
|
|
||||||
{
|
|
||||||
return python;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param mercurial
|
|
||||||
*/
|
|
||||||
public void setMercurial(String mercurial)
|
|
||||||
{
|
|
||||||
this.mercurial = mercurial;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param python
|
|
||||||
*/
|
|
||||||
public void setPython(String python)
|
|
||||||
{
|
|
||||||
this.python = python;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private String mercurial;
|
private String mercurial;
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private String python;
|
private String python;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import sonia.scm.repository.HgConfig;
|
|||||||
import sonia.scm.repository.HgContext;
|
import sonia.scm.repository.HgContext;
|
||||||
import sonia.scm.repository.HgRepositoryHandler;
|
import sonia.scm.repository.HgRepositoryHandler;
|
||||||
import sonia.scm.repository.HgTestUtil;
|
import sonia.scm.repository.HgTestUtil;
|
||||||
import sonia.scm.repository.RepositoryPathNotFoundException;
|
|
||||||
import sonia.scm.user.User;
|
import sonia.scm.user.User;
|
||||||
import sonia.scm.user.UserTestData;
|
import sonia.scm.user.UserTestData;
|
||||||
import sonia.scm.util.MockUtil;
|
import sonia.scm.util.MockUtil;
|
||||||
@@ -66,11 +65,10 @@ public abstract class IncomingOutgoingTestBase extends AbstractTestBase
|
|||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Before
|
@Before
|
||||||
public void initHgHandler() throws IOException, RepositoryPathNotFoundException {
|
public void initHgHandler() throws IOException {
|
||||||
HgRepositoryHandler temp = HgTestUtil.createHandler(tempFolder.newFolder());
|
HgRepositoryHandler temp = HgTestUtil.createHandler(tempFolder.newFolder());
|
||||||
|
|
||||||
HgTestUtil.checkForSkip(temp);
|
HgTestUtil.checkForSkip(temp);
|
||||||
|
|||||||
Reference in New Issue
Block a user