~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/__init__.py

More tests for abspath and clone behaviour

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        else:
170
170
            # TODO: Don't call this with an array - no magic interfaces
171
171
            relpath_parts = relpath[:]
172
 
        if len(relpath_parts) > 1:
173
 
            if relpath_parts[0] == '':
174
 
                raise ValueError("path %r within branch %r seems to be absolute"
175
 
                                 % (relpath, self._path))
176
 
            if relpath_parts[-1] == '':
 
172
 
 
173
        if relpath.startswith('/'):
 
174
            basepath = []
 
175
        else:
 
176
            # Except for the root, no trailing slashes are allowed
 
177
            if len(relpath_parts) > 1 and relpath_parts[-1] == '':
177
178
                raise ValueError("path %r within branch %r seems to be a directory"
178
179
                                 % (relpath, self._path))
179
 
        basepath = self._path.split('/')
180
 
        if len(basepath) > 0 and basepath[-1] == '':
181
 
            basepath = basepath[:-1]
 
180
            basepath = self._path.split('/')
 
181
            if len(basepath) > 0 and basepath[-1] == '':
 
182
                basepath = basepath[:-1]
 
183
 
182
184
        for p in relpath_parts:
183
185
            if p == '..':
184
186
                if len(basepath) == 0: