~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

  • Committer: Mark Hammond
  • Date: 2008-08-10 11:16:39 UTC
  • mto: (3606.5.3 1.6)
  • mto: This revision was merged to the branch mainline in revision 3626.
  • Revision ID: mhammond@skippinet.com.au-20080810111639-9upz1wig1s8lvz62
install all files with 'restartreplace uninsrestartdelete' and close
tbzrcache at uninstall time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""
18
18
A stub SFTP server for loopback SFTP testing.
83
83
    def _realpath(self, path):
84
84
        # paths returned from self.canonicalize() always start with
85
85
        # a path separator. So if 'root' is just '/', this would cause
86
 
        # a double slash at the beginning '//home/dir'.
 
86
        # a double slash at the beginning '//home/dir'. 
87
87
        if self.root == '/':
88
88
            return self.canonicalize(path)
89
89
        return self.root + self.canonicalize(path)
96
96
            #     /h:/foo/bar
97
97
            # and relative paths stay the same:
98
98
            #     foo/bar
99
 
            # win32 needs to use the Unicode APIs. so we require the
 
99
            # win32 needs to use the Unicode APIs. so we require the 
100
100
            # paths to be utf8 (Linux just uses bytestreams)
101
101
            thispath = path.decode('utf8')
102
102
            if path.startswith('/'):
124
124
            out = [ ]
125
125
            # TODO: win32 incorrectly lists paths with non-ascii if path is not
126
126
            # unicode. However on Linux the server should only deal with
127
 
            # bytestreams and posix.listdir does the right thing
 
127
            # bytestreams and posix.listdir does the right thing 
128
128
            if sys.platform == 'win32':
129
129
                flist = [f.encode('utf8') for f in os.listdir(path)]
130
130
            else: