[MERGE] Development1 format (StackedBranches)

Ian Clatworthy ian.clatworthy at canonical.com
Thu Jun 5 09:07:41 BST 2008


Attached in the next patch in the stacked branches work.
I've reviewed Robert's code and I'm happy with it bar
some minor tweaks (I've made) and a question I raised on IRC.

Firstly, the tweaks:

1. Changed the format strings to say "introduced in 1.6"
   and "keep until 1.5 + 2" as Robert and I agreed on IRC.

2. Backed out an unneeded change to check.py. Instead of
   list(repo.all_revision_ids()), the code is back to
   repo.all_revision_ids(). This passes the full test
   suite (and I could see no evidence on digging that the
   API had changed to require this).

My only question is related to whether RemoteRepository
ought to be checking for format compatibility just like
Repository does. I realise RemoteRepository is a proxy
object (and doesn't inherit from Repository) but the
proxy doesn't seem to delegate the call to a real one
in this case so I feel it ought to make the compatibility
check itself. Comments?

For those interested, here's the Repository code for the method:

def add_fallback_repository(self, repository):
    """Add a repository to use for looking up data not held locally.

    :param repository: A repository.
    """
    if not self._format.supports_external_lookups:
        raise errors.UnstackableRepositoryFormat(self._format, self.base)
    if not self._add_fallback_repository_check(repository):
        raise errors.IncompatibleRepositories(self, repository)
    self._fallback_repositories.append(repository)

def _add_fallback_repository_check(self, repository):
    """Check that this repository can fallback to repository safely.

    :param repository: A repository to fallback to.
    :return: True if the repositories can stack ok.
    """
    return InterRepository._same_model(self, repository)

And here's the RemoteRepository code:

def add_fallback_repository(self, repository):
    """Add a repository to use for looking up data not held locally.

    :param repository: A repository.
    """
    if not self._format.supports_external_lookups:
        raise errors.UnstackableRepositoryFormat(self._format, self.base)
    # We need to accumulate additional repositories here, to pass them in
    # on various RPC's.
    self._fallback_repositories.append(repository)

Once this issue is sorted, I feel the code is ready to merge.

FWIW, I did consider making/requesting some other things as well:

1. There's a new pattern in pack_repo.py where checking for local
   packs is necessary. It might be worth adding a local=True option
   to all_packs() instead of doing the 'if collection is self' bit.
   That can come later - it seemed even money either way.

2. A comment in BzrBranchFormat6 explaining the need for the new
   __init__ method wouldn't hurt. In particular, having BzrBranchFormat6
   referencing a development format feels like an inversion of
   stability issue. Robert assures me it's all good though
   and, in this case at least, I believe him. :-)

Ian C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: development1-format.patch
Type: text/x-diff
Size: 45379 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080605/f4b1193c/attachment-0001.bin 


More information about the bazaar mailing list