diff src/org/tmatesoft/hg/internal/RevlogStream.java @ 621:99ad1e3a4e4d

RevlogStream: be aware of existence (not HgDataFile), facilitate use of an added HgDataFile over a commit; Rollback: be more sensitive about file changes (file size is not enough: write/rollback leaves it intact); tests
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 18 May 2013 22:23:57 +0200
parents 65c01508f002
children 6526d8adbc0f
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RevlogStream.java	Sat May 18 21:55:31 2013 +0200
+++ b/src/org/tmatesoft/hg/internal/RevlogStream.java	Sat May 18 22:23:57 2013 +0200
@@ -85,6 +85,10 @@
 		this.indexFile = indexFile;
 		changeTracker = repo.getRevlogTracker(indexFile);
 	}
+	
+	public boolean exists() {
+		return indexFile.exists();
+	}
 
 	/**
 	 * @param shortRead pass <code>true</code> to indicate intention to read few revisions only (as opposed to reading most of/complete revlog)
@@ -408,6 +412,10 @@
 		}
 		assert revision != null;
 		assert !revision.isNull();
+		// next effort doesn't seem to be of any value at least in case of regular commit
+		// as the next call to #initOutline would recognize the file change and reload complete revlog anyway
+		// OTOH, there might be transaction strategy that doesn't update the file until its completion,
+		// while it's handy to know new revisions meanwhile.
 		int[] baseRevisionsCopy = new int[baseRevisions.length + 1];
 		System.arraycopy(baseRevisions, 0, baseRevisionsCopy, 0, baseRevisions.length);
 		baseRevisionsCopy[baseRevisions.length] = baseRevisionIndex;