diff src/org/tmatesoft/hg/core/LogCommand.java @ 77:c677e1593919

Moved RevlogStream implementation into .internal
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 24 Jan 2011 05:33:47 +0100
parents 6f1b88693d48
children 4222b04f34ee
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/LogCommand.java	Mon Jan 24 04:38:09 2011 +0100
+++ b/src/org/tmatesoft/hg/core/LogCommand.java	Mon Jan 24 05:33:47 2011 +0100
@@ -50,6 +50,7 @@
 	private int startRev = 0, endRev = TIP;
 	private Handler delegate;
 	private Calendar date;
+	private Path file;
 	private Cset changeset;
 
 	public LogCommand(HgRepository hgRepo) {
@@ -129,10 +130,15 @@
 		return this;
 	}
 	
-	// multiple? Bad idea, would need to include extra method into Handler to tell start of next file
+	/**
+	 * Visit history of a given file only.
+	 * @param file path relative to repository root. Pass <code>null</code> to reset.
+	 */
 	public LogCommand file(Path file) {
+		// multiple? Bad idea, would need to include extra method into Handler to tell start of next file
 		// implicit --follow in this case
-		throw HgRepository.notImplemented();
+		this.file = file;
+		return this;
 	}
 
 	/**
@@ -161,7 +167,11 @@
 			delegate = handler;
 			count = 0;
 			changeset = new Cset(new StatusCollector(repo), new PathPool(repo.getPathHelper()));
-			repo.getChangelog().range(startRev, endRev, this);
+			if (file == null) {
+				repo.getChangelog().range(startRev, endRev, this);
+			} else {
+				repo.getFileNode(file).history(startRev, endRev, this);
+			}
 		} finally {
 			delegate = null;
 			changeset = null;