~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_permissions.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-02-01 23:48:08 UTC
  • mfrom: (2225.1.6 revert)
  • Revision ID: pqm@pqm.ubuntu.com-20070201234808-3b1302d73474bd8c
Display changes made by revert

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)