diff src/org/tmatesoft/hg/repo/Revlog.java @ 135:3959bffb14e9

explicit op name instead math op to get last rev number
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 16 Feb 2011 22:00:39 +0100
parents c0cc2535462c
children d5268ca7715b
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/Revlog.java	Wed Feb 16 21:51:32 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/Revlog.java	Wed Feb 16 22:00:39 2011 +0100
@@ -62,16 +62,20 @@
 		return repo;
 	}
 
-	public int getRevisionCount() {
+	public final int getRevisionCount() {
 		return content.revisionCount();
 	}
 	
-	public Nodeid getRevision(int revision) {
+	public final int getLastRevision() {
+		return content.revisionCount() - 1;
+	}
+	
+	public final Nodeid getRevision(int revision) {
 		// XXX cache nodeids?
 		return Nodeid.fromBinary(content.nodeid(revision), 0);
 	}
 
-	public int getLocalRevision(Nodeid nid) {
+	public final int getLocalRevision(Nodeid nid) {
 		int revision = content.findLocalRevisionNumber(nid);
 		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*/));
@@ -80,7 +84,7 @@
 	}
 
 	// Till now, i follow approach that NULL nodeid is never part of revlog
-	public boolean isKnown(Nodeid nodeid) {
+	public final boolean isKnown(Nodeid nodeid) {
 		final int rn = content.findLocalRevisionNumber(nodeid);
 		if (Integer.MIN_VALUE == rn) {
 			return false;