diff cmdline/org/tmatesoft/hg/console/Main.java @ 501:d2f6ab541330

Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 29 Oct 2012 19:04:13 +0100
parents b3c16d1aede0
children 27398bbfd543
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java	Mon Oct 29 18:16:21 2012 +0100
+++ b/cmdline/org/tmatesoft/hg/console/Main.java	Mon Oct 29 19:04:13 2012 +0100
@@ -74,7 +74,10 @@
 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.HgExtensionsManager;
+import org.tmatesoft.hg.repo.ext.HgExtensionsManager.HgExt;
 import org.tmatesoft.hg.repo.ext.MqManager;
+import org.tmatesoft.hg.repo.ext.Rebase;
 import org.tmatesoft.hg.repo.ext.MqManager.PatchRecord;
 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector;
 import org.tmatesoft.hg.repo.HgRevisionMap;
@@ -112,7 +115,8 @@
 
 	public static void main(String[] args) throws Exception {
 		Main m = new Main(args);
-		m.dumpBookmarks();
+		m.tryExtensions();
+//		m.dumpBookmarks();
 //		m.readConfigFile();
 //		m.dumpCommitLastMessage();
 //		m.buildFileLog();
@@ -136,6 +140,21 @@
 //		m.bunchOfTests();
 	}
 	
+	private void tryExtensions() throws Exception {
+		HgExtensionsManager em = hgRepo.getExtensions();
+		if (!em.isEnabled(HgExt.Rebase)) {
+			System.out.println("Rebase is not enabled");
+			return;
+		}
+		Rebase re = em.getRebaseExtension();
+		if (!re.refresh().isRebaseInProgress()) {
+			System.out.println("No rebase is in progress");
+			return;
+		}
+		System.out.printf("%s %s %s\n", re.getWorkingDirParent().shortNotation(), re.getTarget().shortNotation(), re.getExternalParent().shortNotation());
+		System.out.printf("collapse:%b, keep:%b, keepbranches:%b\n", re.isCollapse(), re.isKeepOriginalRevisions(), re.isKeepBranchNames());
+	}
+	
 	// TODO as test
 	private void dumpBookmarks() throws Exception {
 		HgBookmarks bm = hgRepo.getBookmarks();