~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
    def open(self, path, flags, attr):
154
154
        path = self._realpath(path)
155
155
        try:
156
 
            if hasattr(os, 'O_BINARY'):
157
 
                flags |= os.O_BINARY
 
156
            flags |= getattr(os, 'O_BINARY', 0)
158
157
            if getattr(attr, 'st_mode', None):
159
158
                fd = os.open(path, flags, attr.st_mode)
160
159
            else:
161
 
                fd = os.open(path, flags)
 
160
                # os.open() defaults to 0777 which is
 
161
                # an odd default mode for files
 
162
                fd = os.open(path, flags, 0666)
162
163
        except OSError, e:
163
164
            return SFTPServer.convert_errno(e.errno)
164
165