Merge lp:~jameinel/bzr/1.16-bencode-compat-385212 into lp:~bzr/bzr/trunk-old

Proposed by John A Meinel
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jameinel/bzr/1.16-bencode-compat-385212
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 43 lines
To merge this branch: bzr merge lp:~jameinel/bzr/1.16-bencode-compat-385212
Reviewer Review Type Date Requested Status
Andrew Bennetts Approve
Review via email: mp+7238@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

This adds a backwards compatibility code with deprecation for "bzrlib.util.bencode"

It is a small helper for both bzr-gtk and the MySQL plugin that used bzrlib.util.bencode directly.

Importing the function raises the deprecation warning. The other possibility was to manually wrap all the imported objects with deprecations, but I thought this would be easier.

Revision history for this message
Andrew Bennetts (spiv) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-06-09 06:47:54 +0000
3+++ NEWS 2009-06-09 21:35:10 +0000
4@@ -55,8 +55,8 @@
5 (Ian Clatworthy)
6
7 * Pyrex version of ``bencode`` support. This provides optimized support
8- for both encoding and decoding, and is now found at ``bzrlib.bencode``,
9- rather than ``bzrlib.utils.bencode``.
10+ for both encoding and decoding, and is now found at ``bzrlib.bencode``.
11+ ``bzrlib.utils.bencode`` is now deprecated.
12 (Alexander Belchenko, Jelmer Vernooij, John Arbash Meinel)
13
14
15
16=== added file 'bzrlib/util/bencode.py'
17--- bzrlib/util/bencode.py 1970-01-01 00:00:00 +0000
18+++ bzrlib/util/bencode.py 2009-06-09 21:35:10 +0000
19@@ -0,0 +1,24 @@
20+# Copyright (C) 2009 Canonical Ltd
21+#
22+# This program is free software; you can redistribute it and/or modify
23+# it under the terms of the GNU General Public License as published by
24+# the Free Software Foundation; either version 2 of the License, or
25+# (at your option) any later version.
26+#
27+# This program is distributed in the hope that it will be useful,
28+# but WITHOUT ANY WARRANTY; without even the implied warranty of
29+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30+# GNU General Public License for more details.
31+#
32+# You should have received a copy of the GNU General Public License
33+# along with this program; if not, write to the Free Software
34+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
35+
36+from bzrlib import symbol_versioning
37+
38+dep_warning = symbol_versioning.deprecated_in((1, 16, 0)) % (
39+ 'bzrlib.util.bencode',) + '\n Use bzrlib.bencode instead'
40+
41+symbol_versioning.warn(dep_warning, DeprecationWarning)
42+
43+from bzrlib.bencode import *