diff cmdline/org/tmatesoft/hg/console/Main.java @ 463:a0507a9f3da0 smartgit3

Initial support for MqExtension
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 20 Jun 2012 21:16:21 +0200
parents 03fd8d079e9c
children 1a3c18d57a8e
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java	Mon Jun 18 20:26:59 2012 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Main.java	Wed Jun 20 21:16:21 2012 +0200
@@ -65,6 +65,8 @@
 import org.tmatesoft.hg.repo.HgStatusInspector;
 import org.tmatesoft.hg.repo.HgSubrepoLocation;
 import org.tmatesoft.hg.repo.HgSubrepoLocation.Kind;
+import org.tmatesoft.hg.repo.ext.MqManager;
+import org.tmatesoft.hg.repo.ext.MqManager.PatchRecord;
 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector;
 import org.tmatesoft.hg.util.FileWalker;
 import org.tmatesoft.hg.util.LogFacility;
@@ -96,11 +98,10 @@
 
 	public static void main(String[] args) throws Exception {
 		Main m = new Main(args);
+		m.testMqManager();
 //		m.testRevisionDescendants();
-		for (int i : new int[] {1,2,3,4,5}) {
-//			m.dumpPhases();
-			m.buildFileLog();
-		}
+//		m.dumpPhases();
+//		m.buildFileLog();
 //		m.testConsoleLog();
 //		m.testTreeTraversal();
 //		m.testRevisionMap();
@@ -122,6 +123,25 @@
 //		m.bunchOfTests();
 	}
 	
+	
+	// TODO as junit tests in 'default'
+	// -R ${system_property:user.home}/hg/test-mq
+	private void testMqManager() throws Exception {
+		MqManager mqManager = new MqManager(hgRepo);
+		mqManager.refresh();
+		int i = 1;
+		System.out.println("Complete patch queue:");
+		for (PatchRecord pr : mqManager.getAllKnownPatches()) {
+			System.out.printf("#%-3d %s from %s\n", i++, pr.getName(), pr.getPatchLocation());
+		}
+		i = 1;
+		System.out.println("Patches from the queue already applied to the repo:");
+		for (PatchRecord pr : mqManager.getAppliedPatches()) {
+			System.out.printf("#%-3d %s, known as cset:%s\n", i++, pr.getName(), pr.getRevision().shortNotation());
+		}
+	}
+	
+	
 	// -R {junit-test-repos}/branches-1
 	private void testRevisionDescendants() throws Exception {
 		int[] roots = new int[] {0, 1, 2, 3, 4, 5};