changeset 249:4c3b9f679412

Deprecated HgLogCommand.FileRevision gone, top-level HgFileRevision is bright and shiny replacement
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 12 Aug 2011 18:58:16 +0200
parents 3fbfce107f94
children 9ef71bd26db1
files cmdline/org/tmatesoft/hg/console/Log.java cmdline/org/tmatesoft/hg/console/Main.java cmdline/org/tmatesoft/hg/console/Manifest.java src/org/tmatesoft/hg/core/HgFileRevision.java src/org/tmatesoft/hg/core/HgLogCommand.java src/org/tmatesoft/hg/core/HgManifestCommand.java src/org/tmatesoft/hg/repo/HgMergeState.java test/org/tmatesoft/hg/test/TestHistory.java test/org/tmatesoft/hg/test/TestManifest.java
diffstat 9 files changed, 16 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Log.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Log.java	Fri Aug 12 18:58:16 2011 +0200
@@ -18,8 +18,8 @@
 
 import java.util.List;
 
+import org.tmatesoft.hg.core.HgFileRevision;
 import org.tmatesoft.hg.core.HgLogCommand;
-import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
 import org.tmatesoft.hg.repo.HgDataFile;
 import org.tmatesoft.hg.repo.HgRepository;
 import org.tmatesoft.hg.util.CancelSupport;
@@ -123,7 +123,7 @@
 			super(hgRepo);
 		}
 		
-		public void copy(FileRevision from, FileRevision to) {
+		public void copy(HgFileRevision from, HgFileRevision to) {
 			System.out.printf("Got notified that %s(%s) was originally known as %s(%s)\n", to.getPath(), to.getRevision(), from.getPath(), from.getRevision());
 		}
 	}
--- a/cmdline/org/tmatesoft/hg/console/Main.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Main.java	Fri Aug 12 18:58:16 2011 +0200
@@ -25,7 +25,6 @@
 
 import org.junit.Assert;
 import org.tmatesoft.hg.core.HgLogCommand;
-import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
 import org.tmatesoft.hg.core.HgCatCommand;
 import org.tmatesoft.hg.core.HgFileInformer;
 import org.tmatesoft.hg.core.HgFileRevision;
@@ -49,7 +48,6 @@
 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
 import org.tmatesoft.hg.util.Pair;
 import org.tmatesoft.hg.util.Path;
-import org.tmatesoft.hg.util.ProgressSupport;
 
 /**
  * Various debug dumps. 
@@ -365,7 +363,7 @@
 			public void dir(Path p) {
 				System.out.println(p);
 			}
-			public void file(FileRevision fileRevision) {
+			public void file(HgFileRevision fileRevision) {
 				System.out.print(fileRevision.getRevision());;
 				System.out.print("   ");
 				System.out.println(fileRevision.getPath());
--- a/cmdline/org/tmatesoft/hg/console/Manifest.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Manifest.java	Fri Aug 12 18:58:16 2011 +0200
@@ -18,7 +18,7 @@
 
 import static org.tmatesoft.hg.repo.HgRepository.TIP;
 
-import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
+import org.tmatesoft.hg.core.HgFileRevision;
 import org.tmatesoft.hg.core.HgManifestCommand;
 import org.tmatesoft.hg.core.Nodeid;
 import org.tmatesoft.hg.repo.HgRepository;
@@ -47,7 +47,7 @@
 			}
 			public void dir(Path p) {
 			}
-			public void file(FileRevision fileRevision) {
+			public void file(HgFileRevision fileRevision) {
 				if (debug) {
 					System.out.print(fileRevision.getRevision());;
 				}
--- a/src/org/tmatesoft/hg/core/HgFileRevision.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/src/org/tmatesoft/hg/core/HgFileRevision.java	Fri Aug 12 18:58:16 2011 +0200
@@ -28,7 +28,7 @@
  * @author Artem Tikhomirov
  * @author TMate Software Ltd.
  */
-public final class HgFileRevision implements HgLogCommand.FileRevision {
+public final class HgFileRevision {
 	private final HgRepository repo;
 	private final Nodeid revision;
 	private final Path path;
--- a/src/org/tmatesoft/hg/core/HgLogCommand.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/src/org/tmatesoft/hg/core/HgLogCommand.java	Fri Aug 12 18:58:16 2011 +0200
@@ -18,7 +18,6 @@
 
 import static org.tmatesoft.hg.repo.HgRepository.TIP;
 
-import java.io.IOException;
 import java.util.Calendar;
 import java.util.Collections;
 import java.util.ConcurrentModificationException;
@@ -31,7 +30,6 @@
 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
 import org.tmatesoft.hg.repo.HgDataFile;
 import org.tmatesoft.hg.repo.HgRepository;
-import org.tmatesoft.hg.util.ByteChannel;
 import org.tmatesoft.hg.util.CancelledException;
 import org.tmatesoft.hg.util.Path;
 import org.tmatesoft.hg.util.ProgressSupport;
@@ -288,11 +286,11 @@
 	
 	/**
 	 * When {@link HgLogCommand} is executed against file, handler passed to {@link HgLogCommand#execute(HgChangesetHandler)} may optionally
-	 * implement this interface to get information about file renames. Method {@link #copy(FileRevision, FileRevision)} would
+	 * implement this interface to get information about file renames. Method {@link #copy(HgFileRevision, HgFileRevision)} would
 	 * get invoked prior any changeset of the original file (if file history being followed) is reported via {@link #next(HgChangeset)}.
 	 * 
 	 * For {@link HgLogCommand#file(Path, boolean)} with renamed file path and follow argument set to false, 
-	 * {@link #copy(FileRevision, FileRevision)} would be invoked for the first copy/rename in the history of the file, but not 
+	 * {@link #copy(HgFileRevision, HgFileRevision)} would be invoked for the first copy/rename in the history of the file, but not 
 	 * followed by any changesets. 
 	 *
 	 * @author Artem Tikhomirov
@@ -300,7 +298,7 @@
 	 */
 	public interface FileHistoryHandler extends HgChangesetHandler {
 		// XXX perhaps, should distinguish copy from rename? And what about merged revisions and following them?
-		void copy(FileRevision from, FileRevision to);
+		void copy(HgFileRevision from, HgFileRevision to);
 	}
 	
 	public static class CollectHandler implements HgChangesetHandler {
@@ -314,14 +312,4 @@
 			result.add(changeset.clone());
 		}
 	}
-
-	/**
-	 * @deprecated pulled up, use {@link HgFileRevision} instead.
-	 */
-	@Deprecated
-	public interface FileRevision {
-		public abstract Path getPath();
-		public abstract Nodeid getRevision();
-		public abstract void putContentTo(ByteChannel sink) throws HgDataStreamException, CancelledException;
-	}
 }
--- a/src/org/tmatesoft/hg/core/HgManifestCommand.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/src/org/tmatesoft/hg/core/HgManifestCommand.java	Fri Aug 12 18:58:16 2011 +0200
@@ -123,7 +123,7 @@
 	public interface Handler {
 		void begin(Nodeid manifestRevision);
 		void dir(Path p); // optionally invoked (if walker was configured to spit out directories) prior to any files from this dir and subdirs
-		void file(HgLogCommand.FileRevision fileRevision); // XXX allow to check p is invalid (df.exists())
+		void file(HgFileRevision fileRevision); // XXX allow to check p is invalid (df.exists())
 		void end(Nodeid manifestRevision);
 	}
 
--- a/src/org/tmatesoft/hg/repo/HgMergeState.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgMergeState.java	Fri Aug 12 18:58:16 2011 +0200
@@ -27,7 +27,6 @@
 
 import org.tmatesoft.hg.core.HgBadStateException;
 import org.tmatesoft.hg.core.HgFileRevision;
-import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
 import org.tmatesoft.hg.core.Nodeid;
 import org.tmatesoft.hg.internal.ManifestRevision;
 import org.tmatesoft.hg.internal.Pool;
--- a/test/org/tmatesoft/hg/test/TestHistory.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/test/org/tmatesoft/hg/test/TestHistory.java	Fri Aug 12 18:58:16 2011 +0200
@@ -31,10 +31,10 @@
 import org.junit.Rule;
 import org.junit.Test;
 import org.tmatesoft.hg.core.HgChangeset;
+import org.tmatesoft.hg.core.HgFileRevision;
 import org.tmatesoft.hg.core.HgLogCommand;
 import org.tmatesoft.hg.core.HgLogCommand.CollectHandler;
 import org.tmatesoft.hg.core.HgLogCommand.FileHistoryHandler;
-import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
 import org.tmatesoft.hg.repo.HgLookup;
 import org.tmatesoft.hg.repo.HgRepository;
 import org.tmatesoft.hg.test.LogOutputParser.Record;
@@ -97,7 +97,7 @@
 		class H extends CollectHandler implements FileHistoryHandler {
 			boolean copyReported = false;
 			boolean fromMatched = false;
-			public void copy(FileRevision from, FileRevision to) {
+			public void copy(HgFileRevision from, HgFileRevision to) {
 				copyReported = true;
 				fromMatched = "src/com/tmate/hgkit/console/Remote.java".equals(from.getPath().toString());
 			}
--- a/test/org/tmatesoft/hg/test/TestManifest.java	Fri Aug 12 18:48:57 2011 +0200
+++ b/test/org/tmatesoft/hg/test/TestManifest.java	Fri Aug 12 18:58:16 2011 +0200
@@ -28,7 +28,7 @@
 
 import org.junit.Rule;
 import org.junit.Test;
-import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
+import org.tmatesoft.hg.core.HgFileRevision;
 import org.tmatesoft.hg.core.HgManifestCommand;
 import org.tmatesoft.hg.core.Nodeid;
 import org.tmatesoft.hg.repo.HgLookup;
@@ -49,10 +49,10 @@
 	private final HgRepository repo;
 	private ManifestOutputParser manifestParser;
 	private ExecHelper eh;
-	final LinkedList<FileRevision> revisions = new LinkedList<FileRevision>();
+	final LinkedList<HgFileRevision> revisions = new LinkedList<HgFileRevision>();
 	private HgManifestCommand.Handler handler  = new HgManifestCommand.Handler() {
 		
-		public void file(FileRevision fileRevision) {
+		public void file(HgFileRevision fileRevision) {
 			revisions.add(fileRevision);
 		}
 		
@@ -108,7 +108,7 @@
 
 	private void report(String what) throws Exception {
 		final Map<Path, Nodeid> cmdLineResult = new LinkedHashMap<Path, Nodeid>(manifestParser.getResult());
-		for (FileRevision fr : revisions) {
+		for (HgFileRevision fr : revisions) {
 			Nodeid nid = cmdLineResult.remove(fr.getPath());
 			errorCollector.checkThat("Extra " + fr.getPath() + " in Java result", nid, notNullValue());
 			if (nid != null) {