org.dstadler.commons.svn.LogEntry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-dost Show documentation
Show all versions of commons-dost Show documentation
Common utilities I find useful in many of my projects.
package org.dstadler.commons.svn;
import java.util.Comparator;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
/**
* Data object for one SVN changelog
*
* @author dominik.stadler
*/
public class LogEntry {
public final static String MORE = "...";
public long revision = 0;
public String author;
public String date;
public String msg;
public SortedSet> paths;
@Override
public String toString() {
// without msg currently...
return "LogEntry [revision=" + revision + ", author=" + author + ", date=" + date + "]";
}
public void addPath(String path, String action) {
if(paths == null) {
paths = new TreeSet<>(new Comparator>() {
@Override
public int compare(Pair o1, Pair o2) {
// sort "..." at the end, otherwise sort alphabetically
String path1 = o1.getLeft();
if(path1 != null && path1.equals(MORE)) {
return 1;
}
String path2 = o2.getLeft();
if(path2 != null && path2.equals(MORE)) {
return -1;
}
return o1.compareTo(o2);
}
});
}
paths.add(ImmutablePair.of(path, action));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy