/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

  • Committer: Martin Pool
  • Date: 2006-04-20 02:42:17 UTC
  • mfrom: (1674 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1675.
  • Revision ID: mbp@sourcefrog.net-20060420024217-e7530e10e384d5dd
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
 
68
68
# don't use prefetch unless paramiko version >= 1.5.2 (there were bugs earlier)
69
69
_default_do_prefetch = False
70
 
if getattr(paramiko, '__version_info__', (0, 0, 0)) >= (1, 5, 2):
 
70
if getattr(paramiko, '__version_info__', (0, 0, 0)) >= (1, 5, 5):
71
71
    _default_do_prefetch = True
72
72
 
73
73
 
193
193
# X seconds. But that requires a lot more fanciness.
194
194
_connected_hosts = weakref.WeakValueDictionary()
195
195
 
 
196
def clear_connection_cache():
 
197
    """Remove all hosts from the SFTP connection cache.
 
198
 
 
199
    Primarily useful for test cases wanting to force garbage collection.
 
200
    """
 
201
    _connected_hosts.clear()
 
202
 
196
203
 
197
204
def load_host_keys():
198
205
    """
503
510
            mutter('Raising exception with errno %s', e.errno)
504
511
        raise e
505
512
 
506
 
    def append(self, relpath, f):
 
513
    def append(self, relpath, f, mode=None):
507
514
        """
508
515
        Append the text in the file-like object into the final
509
516
        location.
511
518
        try:
512
519
            path = self._remote_path(relpath)
513
520
            fout = self._sftp.file(path, 'ab')
 
521
            if mode is not None:
 
522
                self._sftp.chmod(path, mode)
514
523
            result = fout.tell()
515
524
            self._pump(f, fout)
516
525
            return result