Comment 1 for bug 264975

Revision history for this message
John A Meinel (jameinel) wrote :

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.