aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bugdir.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-06-23 11:35:23 -0400
committerW. Trevor King <wking@drexel.edu>2009-06-23 11:35:23 -0400
commit83e06581ad007e1a1f27f311ccb3a747f0a81ade (patch)
treeda64348e2f7a638e6f0664d5277aa24f1500e3c5 /libbe/bugdir.py
parent37195a33108299504f8d37042dec06df0540d0d2 (diff)
downloadbugseverywhere-83e06581ad007e1a1f27f311ccb3a747f0a81ade.tar.gz
Added Bug.extra_strings to support add-on functionality, e.g. `be tag`.
Versioned properties whose data is a mutable type are tricky, since the simple comparisons we'd been using in libbe.properties.change_hook_property don't work for mutables. For now, we avoid that problem by assuming a change happened whenever a mutable property is set. change_hook_property is a bit untidy at the moment while I work out how to deal with mutables. As an example of using Bug.extra_strings to patch on some useful functionality, I've written becommands/tag.py. I'd suggest future add-ons (e.g. becommands/depend.py?) use the "<LABEL>:<value>" string format to keep it easy to sort out which strings belong to which add-ons. tag.py is still missing command line tag-removal and tag-searching for `be list'. Perhaps something like be list --extra-strings TAG:<your-tag>,TAG:<another-tag>,DEPEND:<bug-id> would be good, although it would requre escaping commas from the tags, or refusing to allow commas in the tags... libbe.properties.ValueCheckError also got a minor update so the printed error message makes sense when raised with allowed being an iterable (i.e. check_property) or a function (e.g. fn_checked_property). All of this digging around turned up a really buggy libbe.bugdir.MultipleBugMatches. Obviously I had never actually called it before :p. Should be fixed now. libbe.comment._set_comment_body has also been normalized to match the suggested change_hook interface: change_hook(self, old, new). Although, I'm not sure why it hadn't been causing obvious problems before, so maybe I'm misunderstanding something about that.
Diffstat (limited to 'libbe/bugdir.py')
-rw-r--r--libbe/bugdir.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index a9ec42e..3c2c247 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -54,9 +54,9 @@ class AlreadyInitialized(Exception):
class MultipleBugMatches(ValueError):
def __init__(self, shortname, matches):
msg = ("More than one bug matches %s. "
- "Please be more specific.\n%s" % shortname, matches)
+ "Please be more specific.\n%s" % (shortname, matches))
ValueError.__init__(self, msg)
- self.shortname = shortnamename
+ self.shortname = shortname
self.matches = matches