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
=== modified file 'NEWS'
--- NEWS 2009-06-09 06:47:54 +0000
+++ NEWS 2009-06-09 21:35:10 +0000
@@ -55,8 +55,8 @@
55 (Ian Clatworthy)55 (Ian Clatworthy)
5656
57* Pyrex version of ``bencode`` support. This provides optimized support57* Pyrex version of ``bencode`` support. This provides optimized support
58 for both encoding and decoding, and is now found at ``bzrlib.bencode``,58 for both encoding and decoding, and is now found at ``bzrlib.bencode``.
59 rather than ``bzrlib.utils.bencode``.59 ``bzrlib.utils.bencode`` is now deprecated.
60 (Alexander Belchenko, Jelmer Vernooij, John Arbash Meinel)60 (Alexander Belchenko, Jelmer Vernooij, John Arbash Meinel)
6161
6262
6363
=== added file 'bzrlib/util/bencode.py'
--- bzrlib/util/bencode.py 1970-01-01 00:00:00 +0000
+++ bzrlib/util/bencode.py 2009-06-09 21:35:10 +0000
@@ -0,0 +1,24 @@
1# Copyright (C) 2009 Canonical Ltd
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
17from bzrlib import symbol_versioning
18
19dep_warning = symbol_versioning.deprecated_in((1, 16, 0)) % (
20 'bzrlib.util.bencode',) + '\n Use bzrlib.bencode instead'
21
22symbol_versioning.warn(dep_warning, DeprecationWarning)
23
24from bzrlib.bencode import *