1
The Transport API in bzrlib provides URL based access to network resources.
5
>>> from bzrlib.osutils import getcwd, dirname
6
>>> from bzrlib.urlutils import local_path_from_url
7
>>> import bzrlib.transport as transport
8
>>> if sys.platform == 'win32':
9
... root = transport.get_transport('file:///C:/')
11
... root = transport.get_transport('file:///')
14
Each Transport instance represents a single logical directory.
16
>>> dir = transport.get_transport(".")
17
>>> local_path_from_url(dir.base) == getcwd() + '/'
20
You can change directories via the clone method:
22
>>> parent = dir.clone('..')
23
>>> local_path_from_url(parent.base) == (dirname(getcwd()).rstrip('/') + '/')