changeset 50:f1db8610da62

Log to consult (placeholder, for now) class to find out associated tags
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 15 Jan 2011 01:41:49 +0100
parents 26e3eeaa3962
children 9429c7bd1920 30bd38978846
files src/com/tmate/hgkit/console/Log.java src/com/tmate/hgkit/ll/HgRepository.java src/com/tmate/hgkit/ll/HgTags.java src/com/tmate/hgkit/ll/LocalHgRepo.java
diffstat 4 files changed, 49 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/tmate/hgkit/console/Log.java	Sat Jan 15 01:15:38 2011 +0100
+++ b/src/com/tmate/hgkit/console/Log.java	Sat Jan 15 01:41:49 2011 +0100
@@ -151,8 +151,17 @@
 			StringBuilder sb = new StringBuilder();
 			Formatter f = new Formatter(sb);
 			f.format("changeset:   %d:%s\n", revNumber, complete ? csetNodeid : csetNodeid.shortNotation());
-			if (revNumber == tip) {
-				sb.append("tag:        tip\n");
+			if (revNumber == tip || repo.getTags().isTagged(csetNodeid)) {
+				
+				sb.append("tag:         ");
+				for (String t : repo.getTags().tags(csetNodeid)) {
+					sb.append(t);
+					sb.append(' ');
+				}
+				if (revNumber == tip) {
+					sb.append("tip");
+				}
+				sb.append('\n');
 			}
 			if (complete) {
 				if (changelogWalker == null) {
--- a/src/com/tmate/hgkit/ll/HgRepository.java	Sat Jan 15 01:15:38 2011 +0100
+++ b/src/com/tmate/hgkit/ll/HgRepository.java	Sat Jan 15 01:41:49 2011 +0100
@@ -16,9 +16,9 @@
 		return new IllegalStateException("Not implemented");
 	}
 
-	
 	private Changelog changelog;
 	private HgManifest manifest;
+	private HgTags tags;
 
 	private boolean isInvalid = true;
 	
@@ -46,6 +46,15 @@
 		}
 		return this.manifest;
 	}
+	
+	public final HgTags getTags() {
+		if (tags == null) {
+			tags = createTags();
+		}
+		return tags;
+	}
+	
+	protected abstract HgTags createTags();
 
 	public abstract HgDataFile getFileNode(String path);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/tmate/hgkit/ll/HgTags.java	Sat Jan 15 01:41:49 2011 +0100
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2011 Artem Tikhomirov 
+ */
+package com.tmate.hgkit.ll;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * FIXME Place-holder, implement
+ * @author artem
+ */
+public class HgTags {
+
+	public List<String> tags(Nodeid nid) {
+		return Collections.emptyList();
+	}
+
+	public boolean isTagged(Nodeid nid) {
+		// TODO implement
+		return false;
+	}
+}
--- a/src/com/tmate/hgkit/ll/LocalHgRepo.java	Sat Jan 15 01:15:38 2011 +0100
+++ b/src/com/tmate/hgkit/ll/LocalHgRepo.java	Sat Jan 15 01:41:49 2011 +0100
@@ -250,6 +250,11 @@
 		return repoDir;
 	}
 
+	@Override
+	protected HgTags createTags() {
+		return new HgTags();
+	}
+
 	private final HashMap<String, SoftReference<RevlogStream>> streamsCache = new HashMap<String, SoftReference<RevlogStream>>();
 
 	/**