Rev 2224: Repositories which don't support tags now give a better message in file:///home/mbp/bzr/Work/tags/
Martin Pool
mbp at sourcefrog.net
Fri Jan 19 08:31:43 GMT 2007
------------------------------------------------------------
revno: 2224
revision-id: mbp at sourcefrog.net-20070119083142-s0ukxl1znp363xfr
parent: mbp at sourcefrog.net-20070119024650-o12ekgnjski2v3ed
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: tags
timestamp: Fri 2007-01-19 19:31:42 +1100
message:
Repositories which don't support tags now give a better message
modified:
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/repository_implementations/test_tags.py test_tags.py-20070114073919-azsbo9l26ph1rr09-1
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2007-01-16 13:21:38 +0000
+++ b/bzrlib/errors.py 2007-01-19 08:31:42 +0000
@@ -1610,3 +1610,12 @@
def __init__(self, tag_name):
self.tag_name = tag_name
+
+
+class TagsNotSupported(BzrError):
+
+ _fmt = "Tags not supported by repository format %(repository_format)s"
+
+ def __init__(self, repository_format):
+ self.repository_format = repository_format
+
=== modified file 'bzrlib/tests/repository_implementations/test_tags.py'
--- a/bzrlib/tests/repository_implementations/test_tags.py 2007-01-19 02:46:50 +0000
+++ b/bzrlib/tests/repository_implementations/test_tags.py 2007-01-19 08:31:42 +0000
@@ -75,3 +75,30 @@
else:
self.fail("didn't get expected exception")
+
+class TestUnsupportedTags(TestCaseWithRepository):
+ """Formats that don't support tags should give reasonable errors."""
+
+ def setUp(self):
+ fmt = self.repository_format
+ supported = getattr(fmt, 'supports_tags')
+ if supported is None:
+ warn("Format %s doesn't declare whether it supports tags or not"
+ % fmt)
+ raise TestSkipped('No tag support at all')
+ if supported():
+ raise TestSkipped("Format %s declares that tags are supported"
+ % fmt)
+ # it's covered by TestRepositoryTags
+ TestCaseWithRepository.setUp(self)
+
+ def test_tag_methods_raise(self):
+ repo = self.make_repository('repo')
+ self.assertRaises(errors.TagsNotSupported,
+ repo.set_tag, 'foo', 'bar')
+ self.assertRaises(errors.TagsNotSupported,
+ repo.lookup_tag, 'foo')
+ self.assertRaises(errors.TagsNotSupported,
+ repo.set_tag, 'foo', 'bar')
+
+
More information about the bazaar-commits
mailing list