diff src/com/tmate/hgkit/console/Manifest.java @ 19:40532cdc92fc

Inspector (visitor) for manifest
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 04 Jan 2011 01:01:39 +0100
parents df8c67f3006a
children 603806cd2dc6
line wrap: on
line diff
--- a/src/com/tmate/hgkit/console/Manifest.java	Mon Jan 03 20:42:52 2011 +0100
+++ b/src/com/tmate/hgkit/console/Manifest.java	Tue Jan 04 01:01:39 2011 +0100
@@ -1,10 +1,14 @@
 /*
- * Copyright (c) 2010 Artem Tikhomirov 
+ * Copyright (c) 2010, 2011 Artem Tikhomirov 
  */
 package com.tmate.hgkit.console;
 
+import static com.tmate.hgkit.ll.HgRepository.TIP;
+
 import com.tmate.hgkit.fs.RepositoryLookup;
+import com.tmate.hgkit.ll.HgManifest;
 import com.tmate.hgkit.ll.HgRepository;
+import com.tmate.hgkit.ll.Nodeid;
 
 /**
  *
@@ -21,6 +25,22 @@
 			return;
 		}
 		System.out.println(hgRepo.getLocation());
-		hgRepo.getManifest().dump();
+		HgManifest.Inspector insp = new HgManifest.Inspector() {
+			public boolean begin(int revision, Nodeid nid) {
+				System.out.printf("%d : %s\n", revision, nid);
+				return true;
+			}
+
+			public boolean next(Nodeid nid, String fname, String flags) {
+				System.out.println(nid + "\t" + fname + "\t\t" + flags);
+				return true;
+			}
+
+			public boolean end(int revision) {
+				System.out.println();
+				return true;
+			}
+		};
+		hgRepo.getManifest().walk(0, TIP, insp);
 	}
 }