From d80720fcad22215cdbd1f2b39434945364ba11d5 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 23 Nov 2008 14:46:51 -0500 Subject: [PATCH] Created bugdir.MultipleBugMatches so bugdir no longer imports cmdutil. --- libbe/bugdir.py | 12 +++++++++--- libbe/rcs.py | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) 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 -- 2.26.2