branch --stacked records the absolute url

Bug #264975 reported by Martin Pool
2
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned
Breezy
Triaged
Medium
Unassigned

Bug Description

Following on from bug 261315, it looks like 'bzr branch --stacked' saves the absolute url of the stacked-on branch. This works poorly if you later access the branch over a different protocol.

This might be similar to bug 250418.

Tags: stacking
Martin Pool (mbp)
Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
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.

Revision history for this message
Aaron Bentley (abentley) wrote :

I implemented relative path support in stacking, so I'm confident that relative paths do work, even if they're not being created by default. There is also already code to support determining a suitable relative path. Let's not make this more complicated than it needs to be.

Jelmer Vernooij (jelmer)
tags: added: stacking
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.