Merge lp:~mbp/bzr/892622-feature-api into lp:bzr

Proposed by Martin Pool
Status: Merged
Approved by: Martin Pool
Approved revision: no longer in the source branch.
Merged at revision: 6281
Proposed branch: lp:~mbp/bzr/892622-feature-api
Merge into: lp:bzr
Diff against target: 93 lines (+28/-29)
2 files modified
bzrlib/tests/__init__.py (+26/-5)
bzrlib/tests/features.py (+2/-24)
To merge this branch: bzr merge lp:~mbp/bzr/892622-feature-api
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) code Approve
Review via email: mp+82808@code.launchpad.net

Commit message

restore old api name bzrlib.tests.Features to unbreak some plugins

Description of the change

Moving bzrlib.tests.Feature to bzrlib.tests.features broke some plugins, somewhat unnecessarily.

This restores the old name, deprecated. (Users don't see deprecation warnings.)

This is probably easier than updating all the otherwise-stable plugins.

Thanks to Matt Giuca for reporting this.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I think most plugins have long been fixed, but I guess this is still useful if people happen to have older versions of the plugins installed.

review: Approve (code)
Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/__init__.py'
2--- bzrlib/tests/__init__.py 2011-11-16 15:57:14 +0000
3+++ bzrlib/tests/__init__.py 2011-11-21 00:14:24 +0000
4@@ -100,6 +100,7 @@
5 )
6 from bzrlib.ui import NullProgressView
7 from bzrlib.ui.text import TextUIFactory
8+from bzrlib.tests.features import _CompatabilityThunkFeature
9
10 # Mark this python module as being part of the implementation
11 # of unittest: this gives us better tracebacks where the last
12@@ -4462,8 +4463,28 @@
13 pass
14
15
16-@deprecated_function(deprecated_in((2, 5, 0)))
17-def ModuleAvailableFeature(name):
18- from bzrlib.tests import features
19- return features.ModuleAvailableFeature(name)
20-
21+# API compatibility for old plugins; see bug 892622.
22+for name in [
23+ 'Feature',
24+ 'HTTPServerFeature',
25+ 'ModuleAvailableFeature',
26+ 'HTTPSServerFeature', 'SymlinkFeature', 'HardlinkFeature',
27+ 'OsFifoFeature', 'UnicodeFilenameFeature',
28+ 'ByteStringNamedFilesystem', 'UTF8Filesystem',
29+ 'BreakinFeature', 'CaseInsCasePresFilenameFeature',
30+ 'CaseInsensitiveFilesystemFeature', 'case_sensitive_filesystem_feature',
31+ 'posix_permissions_feature',
32+ ]:
33+ globals()[name] = _CompatabilityThunkFeature(
34+ symbol_versioning.deprecated_in((2, 5, 0)),
35+ 'bzrlib.tests', name,
36+ name, 'bzrlib.tests.features')
37+
38+
39+for (old_name, new_name) in [
40+ ('UnicodeFilename', 'UnicodeFilenameFeature'),
41+ ]:
42+ globals()[name] = _CompatabilityThunkFeature(
43+ symbol_versioning.deprecated_in((2, 5, 0)),
44+ 'bzrlib.tests', old_name,
45+ new_name, 'bzrlib.tests.features')
46
47=== modified file 'bzrlib/tests/features.py'
48--- bzrlib/tests/features.py 2011-08-23 09:29:27 +0000
49+++ bzrlib/tests/features.py 2011-11-21 00:14:24 +0000
50@@ -26,7 +26,6 @@
51 from bzrlib import (
52 osutils,
53 symbol_versioning,
54- tests,
55 )
56
57
58@@ -290,6 +289,8 @@
59 if CaseInsCasePresFilenameFeature.available():
60 return False
61
62+ from bzrlib import tests
63+
64 if tests.TestCaseWithMemoryTransport.TEST_ROOT is None:
65 root = osutils.mkdtemp(prefix='testbzr-', suffix='.tmp')
66 tests.TestCaseWithMemoryTransport.TEST_ROOT = root
67@@ -490,26 +491,3 @@
68
69
70 win32_feature = Win32Feature()
71-
72-
73-for name in ['HTTPServerFeature',
74- 'HTTPSServerFeature', 'SymlinkFeature', 'HardlinkFeature',
75- 'OsFifoFeature', 'UnicodeFilenameFeature',
76- 'ByteStringNamedFilesystem', 'UTF8Filesystem',
77- 'BreakinFeature', 'CaseInsCasePresFilenameFeature',
78- 'CaseInsensitiveFilesystemFeature', 'case_sensitive_filesystem_feature',
79- 'posix_permissions_feature',
80- ]:
81- setattr(tests, name, _CompatabilityThunkFeature(
82- symbol_versioning.deprecated_in((2, 5, 0)),
83- 'bzrlib.tests', name,
84- name, 'bzrlib.tests.features'))
85-
86-
87-for (old_name, new_name) in [
88- ('UnicodeFilename', 'UnicodeFilenameFeature'),
89- ]:
90- setattr(tests, name, _CompatabilityThunkFeature(
91- symbol_versioning.deprecated_in((2, 5, 0)),
92- 'bzrlib.tests', old_name,
93- new_name, 'bzrlib.tests.features'))