diff cmdline/org/tmatesoft/hg/console/Main.java @ 484:ae4d6604debd

Bookmarks support added
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 08 Aug 2012 14:41:44 +0200
parents e31e85cf4d4c
children b3c16d1aede0
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java	Tue Aug 07 19:14:53 2012 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Main.java	Wed Aug 08 14:41:44 2012 +0200
@@ -53,6 +53,7 @@
 import org.tmatesoft.hg.internal.RelativePathRewrite;
 import org.tmatesoft.hg.internal.RevisionDescendants;
 import org.tmatesoft.hg.internal.StreamLogFacility;
+import org.tmatesoft.hg.repo.HgBookmarks;
 import org.tmatesoft.hg.repo.HgBranches;
 import org.tmatesoft.hg.repo.HgChangelog;
 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
@@ -111,7 +112,8 @@
 
 	public static void main(String[] args) throws Exception {
 		Main m = new Main(args);
-		m.readConfigFile();
+		m.dumpBookmarks();
+//		m.readConfigFile();
 //		m.dumpCommitLastMessage();
 //		m.buildFileLog();
 //		m.testConsoleLog();
@@ -133,6 +135,22 @@
 //		m.dumpCompleteManifestHigh();
 //		m.bunchOfTests();
 	}
+	
+	// TODO as test
+	private void dumpBookmarks() throws Exception {
+		HgBookmarks bm = hgRepo.getBookmarks();
+		String active = bm.getActiveBookmarkName();
+		ArrayList<String> all = new ArrayList(bm.getAllBookmarks());
+		Collections.sort(all);
+		for (String bmname : all) {
+			if (bmname.equals(active)) {
+				System.out.print(" * ");
+			} else {
+				System.out.print("   ");
+			}
+			System.out.printf("%-26s (%s)\n", bmname, bm.getRevision(bmname).shortNotation());
+		}
+	}
 
 	// TODO as test
 	private void readConfigFile() throws Exception {