All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dstadler.commons.svn.LogEntry Maven / Gradle / Ivy

There is a newer version: 1.3.4
Show newest version
package org.dstadler.commons.svn;

import java.util.Comparator;
import java.util.SortedSet;
import java.util.TreeSet;

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(Pair.of(path, action));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy