1530.2.1
by Robert Collins
Start tests for api usage. |
1 |
The Transport API in bzrlib provides URL based access to network resources. |
2 |
||
3 |
>>> import os |
|
1685.1.45
by John Arbash Meinel
Moved url functions into bzrlib.urlutils |
4 |
>>> from bzrlib.osutils import getcwd, dirname |
5 |
>>> from bzrlib.urlutils import local_path_from_url |
|
1530.2.1
by Robert Collins
Start tests for api usage. |
6 |
>>> import bzrlib.transport as transport |
7 |
>>> root = transport.get_transport("file:///") |
|
8 |
>>> |
|
9 |
||
10 |
Each Transport instance represents a single logical directory. |
|
11 |
||
12 |
>>> dir = transport.get_transport(".") |
|
1685.1.32
by John Arbash Meinel
When unable to find an appropriate protocol, we now raise InvalidURL rather than always returning LocalTransport |
13 |
>>> local_path_from_url(dir.base) == getcwd() + '/' |
1530.2.1
by Robert Collins
Start tests for api usage. |
14 |
True |
15 |
||
16 |
You can change directories via the clone method: |
|
17 |
||
18 |
>>> parent = dir.clone('..') |
|
1685.1.32
by John Arbash Meinel
When unable to find an appropriate protocol, we now raise InvalidURL rather than always returning LocalTransport |
19 |
>>> local_path_from_url(parent.base) == (dirname(getcwd()).rstrip('/') + '/') |
1530.2.1
by Robert Collins
Start tests for api usage. |
20 |
True |