From 5da244c60c040f23455c1d18107d1abb5b2140c0 Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Wed, 9 Mar 2005 18:25:15 +0000 Subject: [PATCH] Added support for severity, creator, target --- be | 20 ++++++++++++++++++-- libbe/bugdir.py | 23 ++++++++++++++++++++--- libbe/bugdir.pyc | Bin 5737 -> 6402 bytes 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/be b/be index a93617a..11e8c5c 100755 --- a/be +++ b/be @@ -12,11 +12,27 @@ import sys import os def list_bugs(args): - bugs = [b for b in tree_root(os.getcwd()).list() if b.active] + active = True + status = ("minor", "serious", "critical", "fatal") + def filter(bug): + if active is not None: + if bug.active != active: + return False + if bug.status not in status: + return False + return True + + bugs = [b for b in tree_root(os.getcwd()).list() ] if len(bugs) == 0: print "No matching bugs found" for bug in bugs: - print "%s: %s" % (unique_name(bug, bugs), bug.summary) + target = bug.target + if target is None: + target = "" + else: + target = " target: %s" % target + print "id: %s severity: %s%s\n%s\n" % (unique_name(bug, bugs), + bug.severity, target, bug.summary) diff --git a/libbe/bugdir.py b/libbe/bugdir.py index de3e550..efb392d 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -1,6 +1,8 @@ import os import os.path import cmdutil +import errno + class NoBugDir(cmdutil.UserError): def __init__(self, path): @@ -36,10 +38,15 @@ class BugDir: continue yield Bug(self.bugs_path, uuid) -def file_property(name): +def file_property(name, valid=None): def getter(self): - return self._get_value(name) + value = self._get_value(name) + if valid is not None: + assert value in valid + return value def setter(self, value): + if valid is not None: + assert value in valid return self._set_value(name, value) return property(getter, setter) @@ -59,6 +66,10 @@ class Bug(object): name = file_property("name") summary = file_property("summary") + creator = file_property("creator") + target = file_property("target") + severity = file_property("severity", valid=("wishlist", "minor", "serious", + "critical", "fatal")) def _check_status(status): assert status in ("open", "closed") @@ -80,8 +91,14 @@ class Bug(object): active = property(_get_active) def _get_value(self, name): - return file(self.get_path(name), "rb").read().rstrip("\n") + try: + return file(self.get_path(name), "rb").read().rstrip("\n") + except IOError, e: + if e.errno == errno.EEXIST: + return None def _set_value(self, name, value): + if value is None: + os.unlink(self.get_path(name)) file(self.get_path(name), "wb").write("%s\n" % value) diff --git a/libbe/bugdir.pyc b/libbe/bugdir.pyc index 12480901ab9852ab9f9e9c00c4be01f462e95606..3d8dfc6897403ecd90999c47b151888ceb8b2c49 100644 GIT binary patch delta 1657 zcmah}&2Jl35TDugdOu=&{ShZ2NkL6Q+{oc;Zn>YKLdB1tT z&s}|F?8(3L-b?c*7F)3YGwFSrhPv_T*nK+y7fooG5FmsGL>Xu!1O{9K*adj4VL@QB z(#S%P5y6JQf;K>qJ#=y)bRn?e8bZT^fYbpA;~skCAOKjcdGy)3a(IpxH!nOJC0~Ai z64B9j@IAEm&KtiW7WQ7qIEbTrD^?Bh-o1CTRm4gCiT&ZuF-D!CDT}VvGDu*>rolO> z6Es~%xK7v*J^;949H@q+bFW)8{a zoX{V+UV%T}U)Mi5Pw&jKiOU7(V;)CPl0HBwNKersAxZJ>$jm-6O2^`K2;yP-`zZM{ z`xuWPQ{#Qy1#($XDooNS?k*)soanReaXp;(?~eV{pbFD8O!!PxmL_2Q`i?t0%x5Oq zcbgkW3Zh56@nNX}JN##D!FzmmhWGVC`IetioIa7LMKAerofc`RAN7_sroZ-PcS2&V z&F9x}fn`TzPh?^&adiL!;$|L#0t7y^EposH8H>VoS}KV^4rLJv5c&|(oaZ7oiV#%9 zUJ`pr;+G*96r*2(peoWJys}yw((?m9<72v*`yQXrzvOP=yna9b&CY2C&6xxC>%y#7 zn;RR=WJ|H!O2TFuCsKg4nOq1{A%+Ssg-Mid9XUR(!{tc5)rnLp=8dRJ8zmt5#+yoZ zwrE?_YIc;%r`&F)&5mvszQY#@)3{#nf57FvfnpAEMURwjPp&bZ9!Mb}SD!aN!}jwu zZO!OkOVi7*b{~QaHN?6H@f09Z6C(9o` zdFj;#^iX9^*UObISZb$U5nrgPEfD$NpA<$&*b9K~8y|Alk< zkIKr#|MNkY{E9w1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