~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-27 18:41:20 UTC
  • mto: This revision was merged to the branch mainline in revision 6449.
  • Revision ID: jelmer@samba.org-20120127184120-osvbbiwijy58hsah
remove unnecessary code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2012, 2016 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
52
52
    def __init__(self, base):
53
53
        """Set the base path where files will be stored."""
54
54
        if not base.startswith('file://'):
55
 
            raise AssertionError("not a file:// url: %r" % base)
 
55
            symbol_versioning.warn(
 
56
                "Instantiating LocalTransport with a filesystem path"
 
57
                " is deprecated as of bzr 0.8."
 
58
                " Please use bzrlib.transport.get_transport()"
 
59
                " or pass in a file:// url.",
 
60
                 DeprecationWarning,
 
61
                 stacklevel=2
 
62
                 )
 
63
            base = urlutils.local_path_to_url(base)
56
64
        if base[-1] != '/':
57
65
            base = base + '/'
58
66
 
184
192
            fp.close()
185
193
        return length
186
194
 
187
 
    def put_bytes(self, relpath, raw_bytes, mode=None):
 
195
    def put_bytes(self, relpath, bytes, mode=None):
188
196
        """Copy the string into the location.
189
197
 
190
198
        :param relpath: Location to put the contents, relative to base.
191
 
        :param raw_bytes:   String
 
199
        :param bytes:   String
192
200
        """
193
 
        if not isinstance(raw_bytes, str):
194
 
            raise TypeError(
195
 
                'raw_bytes must be a plain string, not %s' % type(raw_bytes))
 
201
 
196
202
        path = relpath
197
203
        try:
198
204
            path = self._abspath(relpath)
202
208
            self._translate_error(e, path)
203
209
        try:
204
210
            if bytes:
205
 
                fp.write(raw_bytes)
 
211
                fp.write(bytes)
206
212
            fp.commit()
207
213
        finally:
208
214
            fp.close()