aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.bzrignore9
-rw-r--r--Makefile15
-rwxr-xr-xbe4
-rw-r--r--becommands/list.py12
-rw-r--r--becommands/tag.py3
-rw-r--r--libbe/bug.py3
-rwxr-xr-xxml/be-xml-to-mbox27
7 files changed, 51 insertions, 22 deletions
diff --git a/.bzrignore b/.bzrignore
index c0fddb1..7f19077 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1,11 +1,12 @@
-Bugs-Everywhere-Web/beweb/config.py
./build
-Bugs-Everywhere-Web/beweb/database.sqlite
-Bugs-Everywhere-Web/beweb/catwalk-session
+libbe/_version.py
+./doc/*.1
*.pyc
*.sw[pon]
fte.dsk
*~
./.shelf
Bugs-Everywhere-Web/devdata.sqlite
-./doc/*.1
+Bugs-Everywhere-Web/beweb/config.py
+Bugs-Everywhere-Web/beweb/database.sqlite
+Bugs-Everywhere-Web/beweb/catwalk-session
diff --git a/Makefile b/Makefile
index 47fbbfd..2057c8e 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ PATH = /usr/bin:/bin
DOC_DIR := doc
# Variables that will be extended by module include files
-GENERATED_FILES :=
+GENERATED_FILES := libbe/_version.py build
CODE_MODULES :=
CODE_PROGRAMS :=
@@ -27,6 +27,9 @@ MODULES += ${DOC_DIR}
RM = rm
+PREFIX = ${HOME}
+INSTALL_OPTIONS = "--prefix=${PREFIX}"
+
.PHONY: all
all: build
@@ -36,12 +39,18 @@ include $(patsubst %,%/module.mk,${MODULES})
.PHONY: build
-build:
+build: libbe/_version.py
+ python setup.py build
.PHONY: install
-install:
+install: doc build
+ python setup.py install ${INSTALL_OPTIONS}
+ cp -v xml/* ${PREFIX}/bin
.PHONY: clean
clean:
$(RM) -rf ${GENERATED_FILES}
+
+libbe/_version.py:
+ bzr version-info --format python > $@
diff --git a/be b/be
index 35dab69..fbe964f 100755
--- a/be
+++ b/be
@@ -18,7 +18,7 @@
import sys
-from libbe import cmdutil
+from libbe import cmdutil, _version
__doc__ == cmdutil.help()
@@ -28,6 +28,8 @@ elif sys.argv[1] == '--complete':
for command, module in cmdutil.iter_commands():
print command
print '\n'.join(["--help","--complete","--options"])
+elif sys.argv[1] == '--version':
+ print _version.version_info["revision_id"]
else:
try:
try:
diff --git a/becommands/list.py b/becommands/list.py
index fa2f592..c397024 100644
--- a/becommands/list.py
+++ b/becommands/list.py
@@ -17,6 +17,7 @@
"""List bugs"""
from libbe import cmdutil, bugdir, bug
import os
+import re
__desc__ = __doc__
# get a list of * for cmp_*() comparing two bugs.
@@ -110,8 +111,8 @@ def execute(args, test=False):
if target == []: # set the default value
target = "all"
if options.extra_strings != None:
- required_extra_strings = options.extra_strings.split(',')
-
+ extra_string_regexps = [re.compile(x) for x in options.extra_strings.split(',')]
+
def filter(bug):
if status != "all" and not bug.status in status:
return False
@@ -122,9 +123,12 @@ def execute(args, test=False):
if target != "all" and not bug.target in target:
return False
if options.extra_strings != None:
+ if len(bug.extra_strings) == 0 and len(extra_string_regexps) > 0:
+ return False
for string in bug.extra_strings:
- if string not in required_extra_strings:
- return False
+ for regexp in extra_string_regexps:
+ if not regexp.match(string):
+ return False
return True
bugs = [b for b in bd if filter(b) ]
diff --git a/becommands/tag.py b/becommands/tag.py
index 2394284..5a18a7c 100644
--- a/becommands/tag.py
+++ b/becommands/tag.py
@@ -89,7 +89,8 @@ def execute(args, test=False):
if tag not in tags:
tags.append(tag)
tags.sort()
- print '\n'.join(tags)
+ if len(tags) > 0:
+ print '\n'.join(tags)
return
bug = bd.bug_from_shortname(args[0])
if len(args) == 2:
diff --git a/libbe/bug.py b/libbe/bug.py
index 7418933..28f5253 100644
--- a/libbe/bug.py
+++ b/libbe/bug.py
@@ -283,7 +283,8 @@ class Bug(settings_object.SavedSettingsObject):
for (k,v) in info:
if v is not settings_object.EMPTY:
ret += ' <%s>%s</%s>\n' % (k,xml.sax.saxutils.escape(v),k)
-
+ for estr in self.extra_strings:
+ ret += ' <extra-string>%s</extra-string>\n' % estr
if show_comments == True:
comout = self.comment_root.xml_thread(auto_name_map=True,
bug_shortname=shortname)
diff --git a/xml/be-xml-to-mbox b/xml/be-xml-to-mbox
index 7d07bac..b0a4cba 100755
--- a/xml/be-xml-to-mbox
+++ b/xml/be-xml-to-mbox
@@ -81,7 +81,8 @@ class Bug (LimitedAttrDict):
u"creator",
u"created",
u"summary",
- u"comments"]
+ u"comments",
+ u"extra_strings"]
def print_to_mbox(self):
name,addr = email.utils.parseaddr(self["creator"])
print "From %s %s" % (addr, rfc2822_to_asctime(self["created"]))
@@ -94,8 +95,12 @@ class Bug (LimitedAttrDict):
print ""
print self["summary"]
print ""
+ if len(self["extra_strings"]) > 0:
+ print "extra strings:\n ",
+ print '\n '.join(self["extra_strings"])
+ print ""
for comment in self["comments"]:
- comment.print_to_mbox(self)
+ comment.print_to_mbox(self)
class Comment (LimitedAttrDict):
_attrs = [u"uuid",
@@ -128,6 +133,7 @@ class BE_list_handler (ContentHandler):
def reset(self):
self.bug = None
self.comment = None
+ self.extra_strings = None
self.text_field = None
def startElement(self, name, attributes):
@@ -135,16 +141,16 @@ class BE_list_handler (ContentHandler):
assert self.bug == None, "Nested bugs?!"
assert self.comment == None
assert self.text_field == None
- self.bug = Bug(comments=[])
+ self.bug = Bug(comments=[], extra_strings=[])
elif name == "comment":
assert self.bug != None, "<comment> not in <bug>?"
+ assert self.comment == None, "Nested comments?!"
assert self.text_field == None, "<comment> in text field %s?" % self.text_field
self.comment = Comment()
elif self.bug != None and self.comment == None:
# parse bug text field
- if name != "comment":
- self.text_field = name
- self.text_data = ""
+ self.text_field = name
+ self.text_data = ""
elif self.bug != None and self.comment != None:
# parse comment text field
self.text_field = name
@@ -153,18 +159,23 @@ class BE_list_handler (ContentHandler):
def endElement(self, name):
if name == "bug":
assert self.bug != None, "Invalid XML?"
+ assert self.comment == None, "Invalid XML?"
+ assert self.text_field == None, "Invalid XML?"
self.bug.print_to_mbox()
self.bug = None
elif name == "comment":
assert self.bug != None, "<comment> not in <bug>?"
- assert self.text_field == None, "<comment> in text field %s?" % self.text_field
assert self.comment != None, "Invalid XML?"
+ assert self.text_field == None, "<comment> in text field %s?" % self.text_field
self.bug["comments"].append(self.comment)
# comments printed by bug.print_to_mbox()
self.comment = None
elif self.bug != None and self.comment == None:
# parse bug text field
- self.bug[self.text_field] = unescape(self.text_data.strip())
+ if self.text_field == "extra-string":
+ self.bug["extra_strings"].append(unescape(self.text_data.strip()))
+ else:
+ self.bug[self.text_field] = unescape(self.text_data.strip())
self.text_field = None
self.text_data = None
elif self.bug != None and self.comment != None: