diff cmdline/org/tmatesoft/hg/console/Main.java @ 445:d0e5dc3cae6e smartgit3

Support for phases functionality from Mercurial 2.1
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 05 Jun 2012 20:50:06 +0200
parents 2fadf8695f8a
children 5787e912f60e
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java	Wed Mar 21 14:54:02 2012 +0100
+++ b/cmdline/org/tmatesoft/hg/console/Main.java	Tue Jun 05 20:50:06 2012 +0200
@@ -43,6 +43,7 @@
 import org.tmatesoft.hg.internal.ByteArrayChannel;
 import org.tmatesoft.hg.internal.DigestHelper;
 import org.tmatesoft.hg.internal.PathGlobMatcher;
+import org.tmatesoft.hg.internal.PhasesHelper;
 import org.tmatesoft.hg.internal.RelativePathRewrite;
 import org.tmatesoft.hg.internal.StreamLogFacility;
 import org.tmatesoft.hg.repo.HgBranches;
@@ -57,6 +58,7 @@
 import org.tmatesoft.hg.repo.HgManifest;
 import org.tmatesoft.hg.repo.HgManifest.Flags;
 import org.tmatesoft.hg.repo.HgMergeState;
+import org.tmatesoft.hg.repo.HgPhase;
 import org.tmatesoft.hg.repo.HgRepository;
 import org.tmatesoft.hg.repo.HgStatusCollector;
 import org.tmatesoft.hg.repo.HgStatusInspector;
@@ -93,6 +95,7 @@
 
 	public static void main(String[] args) throws Exception {
 		Main m = new Main(args);
+		m.dumpPhases();
 //		m.buildFileLog();
 //		m.testConsoleLog();
 //		m.testTreeTraversal();
@@ -111,9 +114,28 @@
 //		m.testStatusInternals();
 //		m.catCompleteHistory();
 //		m.dumpCompleteManifestLow();
-		m.dumpCompleteManifestHigh();
+//		m.dumpCompleteManifestHigh();
 //		m.bunchOfTests();
 	}
+	
+	// hg/test-phases
+	// TODO as junit test
+	private void dumpPhases() throws Exception {
+		HgChangelog.ParentWalker pw = hgRepo.getChangelog().new ParentWalker();
+		pw.init();
+		PhasesHelper ph = new PhasesHelper(hgRepo, pw);
+		System.out.println("With ParentWalker(simulates HgChangeset case)");
+		for (int i = 0, l = hgRepo.getChangelog().getLastRevision(); i <= l; i++) {
+			HgPhase phase = ph.getPhase(i, null);
+			System.out.printf("rev:%3d, phase:%s\n", i, phase);
+		}
+		ph = new PhasesHelper(hgRepo);
+		System.out.println("Without ParentWalker");
+		for (int i = 0, l = hgRepo.getChangelog().getLastRevision(); i <= l; i++) {
+			HgPhase phase = ph.getPhase(i, null);
+			System.out.printf("rev:%3d, phase:%s\n", i, phase);
+		}
+	}
 
 	private void buildFileLog() throws Exception {
 		HgLogCommand cmd = new HgLogCommand(hgRepo);