changeset 154:ba2bf656f00f

Changeset => RawChangeset
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 24 Feb 2011 22:16:19 +0100
parents ab7ea2ac21cb
children a4ec5e087017
files src/org/tmatesoft/hg/core/HgChangeset.java src/org/tmatesoft/hg/core/HgLogCommand.java src/org/tmatesoft/hg/core/HgStatus.java src/org/tmatesoft/hg/internal/ChangelogHelper.java src/org/tmatesoft/hg/internal/KeywordFilter.java src/org/tmatesoft/hg/repo/HgBundle.java src/org/tmatesoft/hg/repo/HgChangelog.java
diffstat 7 files changed, 30 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgChangeset.java	Thu Feb 24 21:38:46 2011 +0100
+++ b/src/org/tmatesoft/hg/core/HgChangeset.java	Thu Feb 24 22:16:19 2011 +0100
@@ -21,7 +21,7 @@
 import java.util.List;
 
 import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
-import org.tmatesoft.hg.repo.HgChangelog.Changeset;
+import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
 import org.tmatesoft.hg.repo.HgRepository;
 import org.tmatesoft.hg.repo.HgStatusCollector;
 import org.tmatesoft.hg.util.Path;
@@ -40,7 +40,7 @@
 	private final Path.Source pathHelper;
 
 	//
-	private Changeset changeset;
+	private RawChangeset changeset;
 	private Nodeid nodeid;
 
 	//
@@ -56,7 +56,7 @@
 	}
 	
 	/*package-local*/
-	void init(int localRevNumber, Nodeid nid, Changeset rawChangeset) {
+	void init(int localRevNumber, Nodeid nid, RawChangeset rawChangeset) {
 		revNumber = localRevNumber;
 		nodeid = nid;
 		changeset = rawChangeset;
--- a/src/org/tmatesoft/hg/core/HgLogCommand.java	Thu Feb 24 21:38:46 2011 +0100
+++ b/src/org/tmatesoft/hg/core/HgLogCommand.java	Thu Feb 24 22:16:19 2011 +0100
@@ -26,7 +26,7 @@
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.tmatesoft.hg.repo.HgChangelog.Changeset;
+import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
 import org.tmatesoft.hg.repo.HgChangelog;
 import org.tmatesoft.hg.repo.HgDataFile;
 import org.tmatesoft.hg.repo.HgRepository;
@@ -162,7 +162,7 @@
 	}
 
 	/**
-	 * Similar to {@link #execute(org.tmatesoft.hg.repo.Changeset.Inspector)}, collects and return result as a list.
+	 * Similar to {@link #execute(org.tmatesoft.hg.repo.RawChangeset.Inspector)}, collects and return result as a list.
 	 */
 	public List<HgChangeset> execute() {
 		CollectHandler collector = new CollectHandler();
@@ -224,7 +224,7 @@
 
 	//
 	
-	public void next(int revisionNumber, Nodeid nodeid, Changeset cset) {
+	public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) {
 		if (limit > 0 && count >= limit) {
 			return;
 		}
--- a/src/org/tmatesoft/hg/core/HgStatus.java	Thu Feb 24 21:38:46 2011 +0100
+++ b/src/org/tmatesoft/hg/core/HgStatus.java	Thu Feb 24 22:16:19 2011 +0100
@@ -19,7 +19,7 @@
 import java.util.Date;
 
 import org.tmatesoft.hg.internal.ChangelogHelper;
-import org.tmatesoft.hg.repo.HgChangelog.Changeset;
+import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
 import org.tmatesoft.hg.util.Path;
 
 /**
@@ -71,7 +71,7 @@
 	 * @return <code>null</code> if author for the change can't be deduced (e.g. for clean files it's senseless)
 	 */
 	public String getModificationAuthor() {
-		Changeset cset = logHelper.findLatestChangeWith(path);
+		RawChangeset cset = logHelper.findLatestChangeWith(path);
 		if (cset == null) {
 			if (kind == Kind.Modified || kind == Kind.Added || kind == Kind.Removed /*&& RightBoundary is TIP*/) {
 				// perhaps, also for Kind.Missing?
@@ -84,7 +84,7 @@
 	}
 
 	public Date getModificationDate() {
-		Changeset cset = logHelper.findLatestChangeWith(path);
+		RawChangeset cset = logHelper.findLatestChangeWith(path);
 		if (cset == null) {
 			// FIXME check dirstate and/or local file for tstamp
 			return new Date(); // what's correct 
--- a/src/org/tmatesoft/hg/internal/ChangelogHelper.java	Thu Feb 24 21:38:46 2011 +0100
+++ b/src/org/tmatesoft/hg/internal/ChangelogHelper.java	Thu Feb 24 22:16:19 2011 +0100
@@ -18,7 +18,7 @@
 
 import java.util.TreeMap;
 
-import org.tmatesoft.hg.repo.HgChangelog.Changeset;
+import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
 import org.tmatesoft.hg.repo.HgDataFile;
 import org.tmatesoft.hg.repo.HgInternals;
 import org.tmatesoft.hg.repo.HgRepository;
@@ -32,7 +32,7 @@
 public class ChangelogHelper {
 	private final int leftBoundary;
 	private final HgRepository repo;
-	private final TreeMap<Integer, Changeset> cache = new TreeMap<Integer, Changeset>();
+	private final TreeMap<Integer, RawChangeset> cache = new TreeMap<Integer, RawChangeset>();
 	private String nextCommitAuthor;
 
 	/**
@@ -58,13 +58,13 @@
 	 * @return changeset where specified file is mentioned among affected files, or 
 	 * <code>null</code> if none found up to leftBoundary 
 	 */
-	public Changeset findLatestChangeWith(Path file) {
+	public RawChangeset findLatestChangeWith(Path file) {
 		HgDataFile df = repo.getFileNode(file);
 		int changelogRev = df.getChangesetLocalRevision(HgRepository.TIP);
 		if (changelogRev >= leftBoundary) {
 			// the method is likely to be invoked for different files, 
 			// while changesets might be the same. Cache 'em not to read too much. 
-			Changeset cs = cache.get(changelogRev);
+			RawChangeset cs = cache.get(changelogRev);
 			if (cs == null) {
 				cs = repo.getChangelog().range(changelogRev, changelogRev).get(0);
 				cache.put(changelogRev, cs);
--- a/src/org/tmatesoft/hg/internal/KeywordFilter.java	Thu Feb 24 21:38:46 2011 +0100
+++ b/src/org/tmatesoft/hg/internal/KeywordFilter.java	Thu Feb 24 22:16:19 2011 +0100
@@ -21,7 +21,7 @@
 import java.util.Map;
 import java.util.TreeMap;
 
-import org.tmatesoft.hg.repo.HgChangelog.Changeset;
+import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
 import org.tmatesoft.hg.repo.HgRepository;
 import org.tmatesoft.hg.util.Path;
 
@@ -37,7 +37,7 @@
 	private final TreeMap<String,String> keywords;
 	private final int minBufferLen;
 	private final Path path;
-	private Changeset latestFileCset;
+	private RawChangeset latestFileCset;
 
 	/**
 	 * 
@@ -266,7 +266,7 @@
 		return String.format("%tY/%<tm/%<td %<tH:%<tM:%<tS", getChangeset().date());
 	}
 	
-	private Changeset getChangeset() {
+	private RawChangeset getChangeset() {
 		if (latestFileCset == null) {
 			// XXX consider use of ChangelogHelper
 			int csetRev = repo.getFileNode(path).getChangesetLocalRevision(HgRepository.TIP);
--- a/src/org/tmatesoft/hg/repo/HgBundle.java	Thu Feb 24 21:38:46 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgBundle.java	Thu Feb 24 22:16:19 2011 +0100
@@ -26,7 +26,7 @@
 import org.tmatesoft.hg.internal.DataAccessProvider;
 import org.tmatesoft.hg.internal.DigestHelper;
 import org.tmatesoft.hg.internal.RevlogStream;
-import org.tmatesoft.hg.repo.HgChangelog.Changeset;
+import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
 
 
 /**
@@ -69,7 +69,7 @@
 				if (!ge.node().equalsTo(dh.asBinary())) {
 					throw new IllegalStateException("Integrity check failed on " + bundleFile + ", node:" + ge.node());
 				}
-				Changeset cs = Changeset.parse(csetContent, 0, csetContent.length);
+				RawChangeset cs = RawChangeset.parse(csetContent, 0, csetContent.length);
 				System.out.println(cs.toString());
 				baseRevContent = csetContent;
 			}
--- a/src/org/tmatesoft/hg/repo/HgChangelog.java	Thu Feb 24 21:38:46 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgChangelog.java	Thu Feb 24 22:16:19 2011 +0100
@@ -52,7 +52,7 @@
 		RevlogStream.Inspector i = new RevlogStream.Inspector() {
 
 			public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) {
-				Changeset cset = Changeset.parse(data, 0, data.length);
+				RawChangeset cset = RawChangeset.parse(data, 0, data.length);
 				// XXX there's no guarantee for Changeset.Callback that distinct instance comes each time, consider instance reuse
 				inspector.next(revisionNumber, Nodeid.fromBinary(nodeid, 0), cset);
 			}
@@ -60,12 +60,12 @@
 		content.iterate(start, end, true, i);
 	}
 
-	public List<Changeset> range(int start, int end) {
-		final ArrayList<Changeset> rv = new ArrayList<Changeset>(end - start + 1);
+	public List<RawChangeset> range(int start, int end) {
+		final ArrayList<RawChangeset> rv = new ArrayList<RawChangeset>(end - start + 1);
 		RevlogStream.Inspector i = new RevlogStream.Inspector() {
 
 			public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) {
-				Changeset cset = Changeset.parse(data, 0, data.length);
+				RawChangeset cset = RawChangeset.parse(data, 0, data.length);
 				rv.add(cset);
 			}
 		};
@@ -81,7 +81,7 @@
 
 			public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) {
 				if (Arrays.binarySearch(revisions, revisionNumber) >= 0) {
-					Changeset cset = Changeset.parse(data, 0, data.length);
+					RawChangeset cset = RawChangeset.parse(data, 0, data.length);
 					inspector.next(revisionNumber, Nodeid.fromBinary(nodeid, 0), cset);
 				}
 			}
@@ -92,13 +92,13 @@
 
 	public interface Inspector {
 		// TODO describe whether cset is new instance each time
-		void next(int revisionNumber, Nodeid nodeid, Changeset cset);
+		void next(int revisionNumber, Nodeid nodeid, RawChangeset cset);
 	}
 
 	/**
 	 * Entry in the Changelog
 	 */
-	public static class Changeset implements Cloneable /* for those that would like to keep a copy */{
+	public static class RawChangeset implements Cloneable /* for those that would like to keep a copy */{
 		// TODO immutable
 		private/* final */Nodeid manifest;
 		private String user;
@@ -124,7 +124,7 @@
 		 *         changelog v0 doesn't use extra
 		 * </pre>
 		 */
-		private Changeset() {
+		private RawChangeset() {
 		}
 
 		public Nodeid manifest() {
@@ -190,16 +190,16 @@
 		}
 
 		@Override
-		public Changeset clone() {
+		public RawChangeset clone() {
 			try {
-				return (Changeset) super.clone();
+				return (RawChangeset) super.clone();
 			} catch (CloneNotSupportedException ex) {
 				throw new InternalError(ex.toString());
 			}
 		}
 
-		public static Changeset parse(byte[] data, int offset, int length) {
-			Changeset rv = new Changeset();
+		public static RawChangeset parse(byte[] data, int offset, int length) {
+			RawChangeset rv = new RawChangeset();
 			rv.init(data, offset, length);
 			return rv;
 		}