/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: Alexander Belchenko
  • Date: 2007-01-28 21:43:32 UTC
  • mto: This revision was merged to the branch mainline in revision 2265.
  • Revision ID: bialix@ukr.net-20070128214332-wgvrj0xkb31ltfbc
win32 UNC path: recursive cloning UNC path to root stops on //HOST, not on //

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        if offset is None:
76
76
            return LocalTransport(self.base)
77
77
        else:
78
 
            return LocalTransport(self.abspath(offset))
 
78
            abspath = self.abspath(offset)
 
79
            if abspath == 'file://':
 
80
                # fix upwalk for UNC path
 
81
                # when clone from //HOST/path updir recursively
 
82
                # we should stop at least at //HOST part
 
83
                abspath = self.base
 
84
            return LocalTransport(abspath)
79
85
 
80
86
    def _abspath(self, relative_reference):
81
87
        """Return a path for use in os calls.
474
480
            return True
475
481
 
476
482
 
 
483
class Win32LocalTransport(LocalTransport):
 
484
    """Special transport for testing Win32 [UNC] paths on non-windows"""
 
485
 
 
486
    def __init__(self, base):
 
487
        if base[-1] != '/':
 
488
            base = base + '/'
 
489
        super(LocalTransport, self).__init__(base)
 
490
        self._local_base = urlutils._win32_local_path_from_url(base)
 
491
 
 
492
    def abspath(self, relpath):
 
493
        assert isinstance(relpath, basestring), (type(relpath), relpath)
 
494
        path = osutils.normpath(osutils.pathjoin(
 
495
                    self._local_base, urlutils.unescape(relpath)))
 
496
        return urlutils._win32_local_path_to_url(path)
 
497
 
 
498
 
477
499
class LocalURLServer(Server):
478
500
    """A pretend server for local transports, using file:// urls.
479
501