Merge lp:~bialix/bzr/deprecate into lp:bzr

Proposed by Alexander Belchenko
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 5392
Proposed branch: lp:~bialix/bzr/deprecate
Merge into: lp:bzr
Diff against target: 88 lines (+25/-3)
3 files modified
NEWS (+3/-0)
bzrlib/transport/ftp/__init__.py (+11/-2)
bzrlib/transport/gio_transport.py (+11/-1)
To merge this branch: bzr merge lp:~bialix/bzr/deprecate
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+33624@code.launchpad.net

Commit message

`decode` parameter to get() method in FtpTransport and GioTransport classes is deprecated.

Description of the change

this patch fixes todo in FtpTransport.get() about decode parameter. That parameter is not used actually. While fixing this I found that GioTransport has the same parameter (I smell copy-paste ;-). So I've deprecated decode there as well.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/25/2010 5:26 AM, Alexander Belchenko wrote:
> Alexander Belchenko has proposed merging lp:~bialix/bzr/deprecate into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
>
> this patch fixes todo in FtpTransport.get() about decode parameter. That parameter is not used actually. While fixing this I found that GioTransport has the same parameter (I smell copy-paste ;-). So I've deprecated decode there as well.

I really don't know what 'decode' was meant to be doing, as at present
there are no calls *to* get that pass decode.

We should check that it isn't used by bzr-upload or something like that.
Otherwise, looks good to me.

 merge: approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx1HuIACgkQJdeBCYSNAANFpQCgyPeWt9BuEXVIGTGy4ken6fzD
JngAoIvoHHCse4WFMTqe7OBH4yJJ2Srf
=Yr01
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Alexander Belchenko (bialix) wrote :

I've checked upload plugin sources, and as I can see there is no use of transport.get, only transport.get_bytes.

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> John A Meinel <email address hidden> writes:

    > Review: Approve
    > On 8/25/2010 5:26 AM, Alexander Belchenko wrote:
    >> Alexander Belchenko has proposed merging lp:~bialix/bzr/deprecate into lp:bzr.
    >>
    >> Requested reviews:
    >> bzr-core (bzr-core)
    >>
    >>
    >> this patch fixes todo in FtpTransport.get() about decode parameter. That parameter is not used actually. While fixing this I found that GioTransport has the same parameter (I smell copy-paste ;-). So I've deprecated decode there as well.

    > I really don't know what 'decode' was meant to be doing, as at present
    > there are no calls *to* get that pass decode.

    > We should check that it isn't used by bzr-upload or something like that.

Nope. No idea what it means (though I could guess ;)

Revision history for this message
John A Meinel (jameinel) 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 'NEWS'
2--- NEWS 2010-08-24 23:20:14 +0000
3+++ NEWS 2010-08-25 10:25:58 +0000
4@@ -20,6 +20,9 @@
5 is now named "msg" instead of earlier "message".
6 (Parth Malwankar, #603461)
7
8+* `decode` parameter to get() method in FtpTransport and GioTransport classes
9+ is deprecated. (Alexander Belchenko)
10+
11 * `FileInWrongBranch` is deprecated in favour of `PathNotChild` and no
12 longer raised.
13 (Martin Pool)
14
15=== modified file 'bzrlib/transport/ftp/__init__.py'
16--- bzrlib/transport/ftp/__init__.py 2010-08-18 01:29:12 +0000
17+++ bzrlib/transport/ftp/__init__.py 2010-08-25 10:25:58 +0000
18@@ -40,6 +40,12 @@
19 osutils,
20 urlutils,
21 )
22+from bzrlib.symbol_versioning import (
23+ DEPRECATED_PARAMETER,
24+ deprecated_in,
25+ deprecated_passed,
26+ warn,
27+ )
28 from bzrlib.trace import mutter, warning
29 from bzrlib.transport import (
30 AppendBasedFileStream,
31@@ -235,7 +241,7 @@
32 mutter("FTP has not: %s: %s", abspath, e)
33 return False
34
35- def get(self, relpath, decode=False, retries=0):
36+ def get(self, relpath, decode=DEPRECATED_PARAMETER, retries=0):
37 """Get the file at the given relative path.
38
39 :param relpath: The relative path to the file
40@@ -245,7 +251,10 @@
41 We're meant to return a file-like object which bzr will
42 then read from. For now we do this via the magic of StringIO
43 """
44- # TODO: decode should be deprecated
45+ if deprecated_passed(decode):
46+ warn(deprecated_in((2,3,0)) %
47+ '"decode" parameter to FtpTransport.get()',
48+ DeprecationWarning, stacklevel=2)
49 try:
50 mutter("FTP get: %s", self._remote_path(relpath))
51 f = self._get_FTP()
52
53=== modified file 'bzrlib/transport/gio_transport.py'
54--- bzrlib/transport/gio_transport.py 2010-05-28 18:52:03 +0000
55+++ bzrlib/transport/gio_transport.py 2010-08-25 10:25:58 +0000
56@@ -43,6 +43,12 @@
57 debug,
58 ui,
59 )
60+from bzrlib.symbol_versioning import (
61+ DEPRECATED_PARAMETER,
62+ deprecated_in,
63+ deprecated_passed,
64+ warn,
65+ )
66 from bzrlib.trace import mutter, warning
67 from bzrlib.transport import (
68 FileStream,
69@@ -262,7 +268,7 @@
70 else:
71 self._translate_gio_error(e, relpath)
72
73- def get(self, relpath, decode=False, retries=0):
74+ def get(self, relpath, decode=DEPRECATED_PARAMETER, retries=0):
75 """Get the file at the given relative path.
76
77 :param relpath: The relative path to the file
78@@ -272,6 +278,10 @@
79 We're meant to return a file-like object which bzr will
80 then read from. For now we do this via the magic of StringIO
81 """
82+ if deprecated_passed(decode):
83+ warn(deprecated_in((2,3,0)) %
84+ '"decode" parameter to GioTransport.get()',
85+ DeprecationWarning, stacklevel=2)
86 try:
87 if 'gio' in debug.debug_flags:
88 mutter("GIO get: %s" % relpath)