~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_permissions.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:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
33
33
import os
34
34
import sys
35
35
import stat
36
 
from StringIO import StringIO
 
36
from cStringIO import StringIO
 
37
import urllib
37
38
 
38
39
from bzrlib.branch import Branch
39
40
from bzrlib.bzrdir import BzrDir
72
73
        test.assertTransportMode(t, base, dir_mode)
73
74
    for root, dirs, files in os.walk(base):
74
75
        for d in dirs:
75
 
            p = os.path.join(root, d)
 
76
            p = '/'.join([urllib.quote(x) for x in root.split('/\\') + [d]])
76
77
            test.assertTransportMode(t, p, dir_mode)
77
78
        for f in files:
78
79
            p = os.path.join(root, f)
 
80
            p = '/'.join([urllib.quote(x) for x in root.split('/\\') + [f]])
79
81
            test.assertTransportMode(t, p, file_mode)
80
82
 
81
83
 
88
90
        t = self.make_branch_and_tree('.')
89
91
        b = t.branch
90
92
        open('a', 'wb').write('foo\n')
91
 
        t.add('a')
 
93
        # ensure check_mode_r works with capital-letter file-ids like TREE_ROOT
 
94
        t.add('a', 'CAPS-ID')
92
95
        t.commit('foo')
93
96
 
94
97
        chmod_r('.bzr', 0644, 0755)
156
159
        #                    extra chmod calls aren't being made
157
160
        try:
158
161
            transport = get_transport(self.get_url())
159
 
            transport.put('my-lock', StringIO(''))
 
162
            transport.put_bytes('my-lock', '')
160
163
            lockable = LockableFiles(transport, 'my-lock', TransportLock)
161
164
            self.assertNotEqual(None, lockable._dir_mode)
162
165
            self.assertNotEqual(None, lockable._file_mode)
276
279
            self.assertTransportMode(t, 'a', 0666 &~umask)
277
280
 
278
281
            # but Transport overrides umask
279
 
            t.put('b', 'txt', mode=0666)
 
282
            t.put_bytes('b', 'txt', mode=0666)
280
283
            self.assertTransportMode(t, 'b', 0666)
281
284
 
282
285
            t._sftp.mkdir('c', mode=0777)