Rev 4945: Adjust errors.py to fix missing references to 'warn'. in http://people.canonical.com/~robertc/baz2.0/integration
Robert Collins
robertc at robertcollins.net
Fri Jan 8 06:33:24 GMT 2010
At http://people.canonical.com/~robertc/baz2.0/integration
------------------------------------------------------------
revno: 4945
revision-id: robertc at robertcollins.net-20100108063305-qxgq2t7prgp0op1j
parent: robertc at robertcollins.net-20100108052817-qt0ubq2sat7f08pt
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Fri 2010-01-08 17:33:05 +1100
message:
Adjust errors.py to fix missing references to 'warn'.
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2010-01-08 05:28:17 +0000
+++ b/bzrlib/errors.py 2010-01-08 06:33:05 +0000
@@ -1247,8 +1247,8 @@
class AmbiguousBase(BzrError):
def __init__(self, bases):
- warn("BzrError AmbiguousBase has been deprecated as of bzrlib 0.8.",
- DeprecationWarning)
+ symbol_versioning.warn("BzrError AmbiguousBase has been deprecated "
+ "as of bzrlib 0.8.", DeprecationWarning, stacklevel=2)
msg = ("The correct base is unclear, because %s are all equally close"
% ", ".join(bases))
BzrError.__init__(self, msg)
@@ -2950,9 +2950,10 @@
_fmt = ("Hook '%(hook_name)s' during %(hook_stage)s failed:\n"
"%(traceback_text)s%(exc_value)s")
- def __init__(self, hook_stage, hook_name, exc_info):
- warn("BzrError HookFailed has been deprecated as of bzrlib 2.1.",
- DeprecationWarning)
+ def __init__(self, hook_stage, hook_name, exc_info, warn=True):
+ if warn:
+ symbol_versioning.warn("BzrError HookFailed has been deprecated "
+ "as of bzrlib 2.1.", DeprecationWarning, stacklevel=2)
import traceback
self.hook_stage = hook_stage
self.hook_name = hook_name
=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py 2009-08-21 02:37:18 +0000
+++ b/bzrlib/tests/test_errors.py 2010-01-08 06:33:05 +0000
@@ -542,7 +542,7 @@
1/0
except ZeroDivisionError:
exc_info = sys.exc_info()
- err = errors.HookFailed('hook stage', 'hook name', exc_info)
+ err = errors.HookFailed('hook stage', 'hook name', exc_info, warn=False)
self.assertStartsWith(
str(err), 'Hook \'hook name\' during hook stage failed:\n')
self.assertEndsWith(
More information about the bazaar-commits
mailing list