[Debtags-commits] [svn] r1550 - in tagcoll/trunk: . debian tools

Enrico Zini enrico at costa.debian.org
Thu Feb 9 16:24:55 UTC 2006


Author: enrico
Date: Thu Feb  9 16:24:54 2006
New Revision: 1550

Modified:
   tagcoll/trunk/   (props changed)
   tagcoll/trunk/README
   tagcoll/trunk/configure.ac
   tagcoll/trunk/debian/changelog
   tagcoll/trunk/tools/tagcoll.cc
Log:
 r7199 at viaza:  enrico | 2006-02-09 17:24:37 +0100
 Implemented tagcoll items


Modified: tagcoll/trunk/README
==============================================================================
--- tagcoll/trunk/README	(original)
+++ tagcoll/trunk/README	Thu Feb  9 16:24:54 2006
@@ -1,4 +1,4 @@
-README for tagcoll 1.5.1, still unreleased
+README for tagcoll 1.5.2, still unreleased
 ==========================================
 
 Functionality
@@ -111,6 +111,12 @@
 
 These are the TODO-list items completed so far::
 
+--- Done in 1.5.2
+ + Internal refactor of the tagcoll utility
+ + Tagcoll can now parse multiple input files, and defaults to stdin if no
+   input file was specified
+ + Added tagcoll grep and tagcoll items
+
 --- Done in 1.5
  + Reverted the 2.0 bump, which wasn't really useful
  + Removed some attempts to preserve clashes, which really don't make sense in

Modified: tagcoll/trunk/configure.ac
==============================================================================
--- tagcoll/trunk/configure.ac	(original)
+++ tagcoll/trunk/configure.ac	Thu Feb  9 16:24:54 2006
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT(tagcoll, 1.5.1, [enrico at debian.org])
+AC_INIT(tagcoll, 1.5.2, [enrico at debian.org])
 AC_CONFIG_SRCDIR([configure.ac])
 AM_CONFIG_HEADER(config.h)
 AM_INIT_AUTOMAKE([foreign])

Modified: tagcoll/trunk/debian/changelog
==============================================================================
--- tagcoll/trunk/debian/changelog	(original)
+++ tagcoll/trunk/debian/changelog	Thu Feb  9 16:24:54 2006
@@ -1,3 +1,10 @@
+tagcoll (1.5.2-1) unstable; urgency=low
+
+  * New upstream version
+     * Added grep and items commands
+
+ -- Enrico Zini <enrico at debian.org>  Thu,  9 Feb 2006 17:23:29 +0100
+
 tagcoll (1.5.1-1) unstable; urgency=low
 
   * New upstream version

Modified: tagcoll/trunk/tools/tagcoll.cc
==============================================================================
--- tagcoll/trunk/tools/tagcoll.cc	(original)
+++ tagcoll/trunk/tools/tagcoll.cc	Thu Feb  9 16:24:54 2006
@@ -223,6 +223,32 @@
 	}
 }
 
+template<typename ITEM, typename TAG>
+class ItemsOnly : public Filter<ITEM, TAG>
+{
+protected:
+	virtual void consumeItemUntagged(const ITEM& item)
+	{
+		this->consumer->consume(item);
+	}
+	virtual void consumeItem(const ITEM& item, const OpSet<TAG>& tags)
+	{
+		this->consumer->consume(item);
+	}
+	virtual void consumeItemsUntagged(const OpSet<ITEM>& items)
+	{
+		this->consumer->consume(items);
+	}
+	virtual void consumeItem(const OpSet<ITEM>& items, const OpSet<TAG>& tags)
+	{
+		this->consumer->consume(items);
+	}
+
+public:
+	ItemsOnly() {}
+	ItemsOnly(Consumer<ITEM, TAG>& cons) : Filter<ITEM, TAG>(cons) {}
+};
+
 class CommandlineParserWithCommand : public CommandlineParser
 {
 protected:
@@ -307,7 +333,7 @@
 	}
 };
 
-enum valid_command { COPY, DIFF, RELATED, IMPLICATIONS, HIERARCHY, CLEANHIERARCHY, REVERSE, FINDSPECIALS, GREP };
+enum valid_command { COPY, DIFF, RELATED, IMPLICATIONS, HIERARCHY, CLEANHIERARCHY, REVERSE, FINDSPECIALS, GREP, ITEMS };
 
 class Reader
 {
@@ -417,14 +443,15 @@
 				"  reverse      \"reverse\" the collection, outputting one with items\n"
 				"               associated to tags\n"
 				"  diff         output a tag patch file with the differences between two files\n"
-				"  related      print a list of items related to the given one\n"
+				"  related <item> print a list of items related to the given one\n"
 				"  implications compute a list of tag implications\n"
 				"  hierarchy    build a smart hierarchy with the collection data\n"
 				"  cleanhierarchy build a cleaned smart hierarchy with the collection data\n"
 				"  findspecials generate a smart hierarchy and print, for each toplevel tag,\n"
 				"               what are the items that make it toplevel instead of going below\n"
 				"               another tag.\n"
-				"  grep <expr>  output the collection of tags that match the given tag expression\n");
+				"  grep <expr>  output the collection of tags that match the given tag expression\n"
+				"  items        output only the items of the input collection\n");
 
 		/*
 		opts.add("hierarchy", 's', "smart-hierarchy", "build a smart hierarchy");
@@ -460,6 +487,7 @@
 		opts.addCommand("cleanhierarchy", (int)CLEANHIERARCHY);
 		opts.addCommand("findspecials", (int)FINDSPECIALS);
 		opts.addCommand("grep", (int)GREP);
+		opts.addCommand("items", (int)ITEMS);
 
 		// Process the commandline
 		valid_command cmd = (valid_command)opts.parse(argc, argv);
@@ -712,6 +740,23 @@
 				}
 				break;
 			}
+			case ITEMS:
+			{
+				ItemsOnly<string, string> filter;
+				Converter<string, string> conv;
+				TextFormat<string, string> writer(conv, conv, stdout);
+				if (opts.get("groupitems").defined())
+				{
+					ItemGrouper<string, string> grouper;
+					filter.setConsumer(grouper);
+					reader.output(args, filter);
+					grouper.output(writer);
+				} else {
+					filter.setConsumer(writer);
+					reader.output(args, filter);
+				}
+				break;
+			}
 		}
 
 		return 0;



More information about the Debtags-commits mailing list