aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/cmdutil.py
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2005-03-09 19:32:17 +0000
committerAaron Bentley <abentley@panoramicfeedback.com>2005-03-09 19:32:17 +0000
commit006b0cb118041cac8081032ad2d401fdd69fe6ae (patch)
treee8dd9b0d65d0ce3ca842cd279ba3edc724416e8e /libbe/cmdutil.py
parent6ade356915dc78cae448b8b48028659ee0528244 (diff)
downloadbugseverywhere-006b0cb118041cac8081032ad2d401fdd69fe6ae.tar.gz
Added ability to create, close, open bugs
Diffstat (limited to 'libbe/cmdutil.py')
-rw-r--r--libbe/cmdutil.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py
index 4cc7d12..560c78d 100644
--- a/libbe/cmdutil.py
+++ b/libbe/cmdutil.py
@@ -4,3 +4,19 @@ def unique_name(bug, bugs):
class UserError(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
+
+def get_bug(spec, bug_dir):
+ bugs = list(bug_dir.list())
+ for bug in bugs:
+ if bug.uuid == spec:
+ return bug
+ matches = []
+ for bug in bugs:
+ if bug.name == spec:
+ matches.append(bug)
+ if len(matches) > 1:
+ raise UserError("More than one bug has the name %s. Please use the"
+ " uuid." % spec)
+ if len(matches) == 0:
+ raise UserError("No bug has the name %s" % spec)
+ return matches[0]