IIRC, the only pointer that uses a relative path is 'parent'. We use (Branch.set_parent):
if url is not None:
if isinstance(url, unicode):
try:
url = url.encode('ascii')
except UnicodeEncodeError:
raise errors.InvalidURL(url, "Urls must be 7-bit ascii, " "use bzrlib.urlutils.escape")
url = urlutils.relative_url(self.base, url)
And in Branch.get_parent:
def get_parent(self):
"""See Branch.get_parent."""
parent = self._get_parent_location()
if parent is None:
return parent
# This is an old-format absolute path to a local branch
# turn it into a url
if parent.startswith('/'):
parent = urlutils.local_path_to_url(parent.decode('utf8'))
try:
return urlutils.join(self.base[:-1], parent)
except errors.InvalidURLJoin, e:
raise errors.InaccessibleParent(parent, self.base)
There is a bit of extra handling, because at one point parent could be a filesystem path, rather than a file:/// url. But now it is always a url, often a relative one. (Often it is *too* relative on the local filesystem, as doing:
bzr branch /path/to/one/location /completely/different/path
will still use a "relative" path between them.
)
Anyway, it wouldn't be too hard to duplicate 'urlutils.relative_url()' and 'urlutils.join()' in the stacking code. It technically is incompatible, as older clients wouldn't be able to find the stacked location for a relative url.
IIRC, the only pointer that uses a relative path is 'parent'. We use (Branch. set_parent) : InvalidURL( url,
"Urls must be 7-bit ascii, "
"use bzrlib. urlutils. escape" ) relative_ url(self. base, url)
if url is not None:
if isinstance(url, unicode):
try:
url = url.encode('ascii')
except UnicodeEncodeError:
raise errors.
url = urlutils.
And in Branch.get_parent: get_parent. """ parent_ location( ) startswith( '/'): local_path_ to_url( parent. decode( 'utf8') ) join(self. base[:- 1], parent) InvalidURLJoin, e: InaccessiblePar ent(parent, self.base)
def get_parent(self):
"""See Branch.
parent = self._get_
if parent is None:
return parent
# This is an old-format absolute path to a local branch
# turn it into a url
if parent.
parent = urlutils.
try:
return urlutils.
except errors.
raise errors.
There is a bit of extra handling, because at one point parent could be a filesystem path, rather than a file:/// url. But now it is always a url, often a relative one. (Often it is *too* relative on the local filesystem, as doing: one/location /completely/ different/ path
bzr branch /path/to/
will still use a "relative" path between them.
)
Anyway, it wouldn't be too hard to duplicate 'urlutils. relative_ url()' and 'urlutils.join()' in the stacking code. It technically is incompatible, as older clients wouldn't be able to find the stacked location for a relative url.