changeset 537:5a455624be4f

Update javadoc for HgManifest.Inspector and fix erroneous internal API
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 05 Feb 2013 20:06:22 +0100
parents 2813a26b8999
children dd4f6311af52
files src/org/tmatesoft/hg/internal/ManifestRevision.java src/org/tmatesoft/hg/repo/HgManifest.java src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java
diffstat 3 files changed, 46 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/ManifestRevision.java	Tue Feb 05 16:36:58 2013 +0100
+++ b/src/org/tmatesoft/hg/internal/ManifestRevision.java	Tue Feb 05 20:06:22 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012 TMate Software Ltd
+ * Copyright (c) 2011-2013 TMate Software Ltd
  *  
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
 
 /**
  * Specific revision of the manifest. 
- * Note, suited to keep single revision only ({@link #changeset()}).
+ * Note, suited to keep single revision only ({@link #revision()}), which is linked to changeset {@link #changesetRevisionIndex()}.
  *
  * @author Artem Tikhomirov
  * @author TMate Software Ltd.
@@ -36,8 +36,8 @@
 	private final TreeMap<Path, HgManifest.Flags> flagsMap;
 	private final Convertor<Nodeid> idsPool;
 	private final Convertor<Path> namesPool;
-	private Nodeid changeset;
-	private int changelogRev; 
+	private Nodeid manifestRev;
+	private int changelogRevIndex, manifestRevIndex;
 
 	// optional pools for effective management of nodeids and filenames (they are likely
 	// to be duplicated among different manifest revisions
@@ -62,14 +62,21 @@
 	}
 
 	/**
-	 * @return identifier of the changeset this manifest revision corresponds to.
+	 * @return identifier of this manifest revision
 	 */
-	public Nodeid changeset() {
-		return changeset;
+	public Nodeid revision() {
+		return manifestRev;
 	}
 	
-	public int changesetLocalRev() {
-		return changelogRev;
+	public int revisionIndex() {
+		return manifestRevIndex;
+	}
+	
+	/**
+	 * @return revision index for the changelog this manifest revision is linked to
+	 */
+	public int changesetRevisionIndex() {
+		return changelogRevIndex;
 	}
 	
 	//
@@ -100,13 +107,14 @@
 		return false; 
 	}
 
-	public boolean begin(int revision, Nodeid nid, int changelogRevision) {
-		if (changeset != null) {
+	public boolean begin(int revisionIndex, Nodeid revision, int changelogRevisionIndex) {
+		if (manifestRev != null) {
 			idsMap.clear();
 			flagsMap.clear();
 		}
-		changeset = nid;
-		changelogRev = changelogRevision;
+		manifestRev = revision;
+		manifestRevIndex = revisionIndex;
+		changelogRevIndex = changelogRevisionIndex;
 		return true;
 	}
 }
\ No newline at end of file
--- a/src/org/tmatesoft/hg/repo/HgManifest.java	Tue Feb 05 16:36:58 2013 +0100
+++ b/src/org/tmatesoft/hg/repo/HgManifest.java	Tue Feb 05 20:06:22 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2012 TMate Software Ltd
+ * Copyright (c) 2010-2013 TMate Software Ltd
  *  
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -354,15 +354,35 @@
 
 	@Callback
 	public interface Inspector {
-		boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision);
 		/**
+		 * Denotes entering specific manifest revision, separate entries are
+		 * reported with subsequence {@link #next(Nodeid, Path, Flags)} calls.
+		 * 
+		 * @param mainfestRevisionIndex  local revision index of the inspected revision
+		 * @param manifestRevision revision of the manifest we're about to iterate through
+		 * @param changelogRevisionIndex local revision index of changelog this manifest points to 
+		 * @return <code>true</code> to continue iteration, <code>false</code> to stop
+		 */
+		boolean begin(int mainfestRevisionIndex, Nodeid manifestRevision, int changelogRevisionIndex);
+
+		
+		/**
+		 * Reports each manifest entry
+		 *  
 		 * @param nid file revision
 		 * @param fname file name
 		 * @param flags one of {@link HgManifest.Flags} constants, not <code>null</code>
 		 * @return <code>true</code> to continue iteration, <code>false</code> to stop
 		 */
 		boolean next(Nodeid nid, Path fname, Flags flags);
-		boolean end(int manifestRevision);
+
+		/**
+		 * Denotes leaving specific manifest revision, after all entries were reported using {@link #next(Nodeid, Path, Flags)}
+		 *   
+		 * @param manifestRevisionIndex indicates manifest revision, corresponds to opening {@link #begin(int, Nodeid, int)}
+		 * @return <code>true</code> to continue iteration, <code>false</code> to stop
+		 */
+		boolean end(int manifestRevisionIndex);
 	}
 	
 	/**
--- a/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Tue Feb 05 16:36:58 2013 +0100
+++ b/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Tue Feb 05 20:06:22 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012 TMate Software Ltd
+ * Copyright (c) 2011-2013 TMate Software Ltd
  *  
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -198,7 +198,7 @@
 			// as long as no nodeids can be provided for WC, seems reasonable to report
 			// latest known nodeid change (although at the moment this is not used and
 			// is done mostly not to leave stale initialization in the Record)
-			int rev1,rev2 = getDirstateParentManifest().changesetLocalRev();
+			int rev1,rev2 = getDirstateParentManifest().changesetRevisionIndex();
 			if (baseRevision == TIP || baseRevision == WORKING_COPY) {
 				rev1 = rev2 - 1; // just use revision prior to dirstate's parent
 			} else {