diff src/org/tmatesoft/hg/internal/ManifestRevision.java @ 415:ee8264d80747

Explicit constant for regular file flags, access to flags for a given file revision
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 22 Mar 2012 18:54:11 +0100
parents 6dbbc53fc46d
children 9c9c442b5f2e
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/ManifestRevision.java	Wed Mar 21 20:51:12 2012 +0100
+++ b/src/org/tmatesoft/hg/internal/ManifestRevision.java	Thu Mar 22 18:54:11 2012 +0100
@@ -57,7 +57,8 @@
 	}
 
 	public HgManifest.Flags flags(Path fname) {
-		return flagsMap.get(fname);
+		HgManifest.Flags f = flagsMap.get(fname);
+		return f == null ? HgManifest.Flags.RegularFile : f;
 	}
 
 	/**
@@ -85,8 +86,9 @@
 			nid = idsPool.unify(nid);
 		}
 		idsMap.put(fname, nid);
-		if (flags != null) {
-			// TreeMap$Entry takes 32 bytes. No reason to keep null for such price
+		if (flags != HgManifest.Flags.RegularFile) {
+			// TreeMap$Entry takes 32 bytes. No reason to keep regular file attribute (in fact, no flags state) 
+			// for such price
 			// Alternatively, Map<Path, Pair<Nodeid, Flags>> might come as a solution
 			// however, with low rate of elements with flags this would consume more memory
 			// than two distinct maps (sizeof(Pair) == 16).