diff src/org/tmatesoft/hg/repo/Revlog.java @ 80:4222b04f34ee

Follow history of a file
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 25 Jan 2011 03:54:32 +0100
parents c677e1593919
children 61eedab3eb3e
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/Revlog.java	Tue Jan 25 02:26:06 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/Revlog.java	Tue Jan 25 03:54:32 2011 +0100
@@ -16,6 +16,7 @@
  */
 package org.tmatesoft.hg.repo;
 
+import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION;
 import static org.tmatesoft.hg.repo.HgRepository.TIP;
 
 import java.util.Arrays;
@@ -58,10 +59,15 @@
 	public int getRevisionCount() {
 		return content.revisionCount();
 	}
+	
+	public Nodeid getRevisionNumber(int revision) {
+		// XXX cache nodeids?
+		return Nodeid.fromBinary(content.nodeid(revision), 0);
+	}
 
 	public int getLocalRevisionNumber(Nodeid nid) {
 		int revision = content.findLocalRevisionNumber(nid);
-		if (revision == Integer.MIN_VALUE) {
+		if (revision == BAD_REVISION) {
 			throw new IllegalArgumentException(String.format("%s doesn't represent a revision of %s", nid.toString(), this /*XXX HgDataFile.getPath might be more suitable here*/));
 		}
 		return revision;