From: W. Trevor King Date: Sun, 23 Nov 2008 19:46:51 +0000 (-0500) Subject: Created bugdir.MultipleBugMatches so bugdir no longer imports cmdutil. X-Git-Tag: 1.0.0~120 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d80720fcad22215cdbd1f2b39434945364ba11d5;p=be.git Created bugdir.MultipleBugMatches so bugdir no longer imports cmdutil. --- diff --git a/libbe/bugdir.py b/libbe/bugdir.py index 0a3e164..e134a2c 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -24,7 +24,6 @@ import doctest import mapfile import bug -import cmdutil import utility from rcs import rcs_by_name, detect_rcs, installed_rcs, PathNotInRoot @@ -52,6 +51,14 @@ class InvalidValue(ValueError): self.name = name self.value = value +class MultipleBugMatches(ValueError): + def __init__(self, shortname, matches): + msg = ("More than one bug matches %s. " + "Please be more specific.\n%s" % shortname, matches) + ValueError.__init__(self, msg) + self.shortname = shortnamename + self.matches = matches + TREE_VERSION_STRING = "Bugs Everywhere Tree 1 0\n" @@ -356,8 +363,7 @@ class BugDir (list): if uuid.startswith(shortname): matches.append(uuid) if len(matches) > 1: - raise cmdutil.UserError("More than one bug matches %s. " - "Please be more specific." % shortname) + raise MultipleBugMatches(shortname, matches) if len(matches) == 1: return self.bug_from_uuid(matches[0]) raise KeyError("No bug matches %s" % shortname) diff --git a/libbe/rcs.py b/libbe/rcs.py index e467943..f222795 100644 --- a/libbe/rcs.py +++ b/libbe/rcs.py @@ -25,7 +25,6 @@ import shutil import unittest import doctest - from utility import Dir, search_parent_directories