Code review comment for lp:~nmb/bzr/893470-dedupe-list-branches

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Am 08/12/11 07:02, schrieb Neil Martinsen-Burrell:
> I agree that we should add a new method and not change the semantics of list_branches. I think a dictionary is a natural object to return. How would the dictionary deal with branch references? That seems like it would give multiple branch objects with the same key. Should the items in the dictionary be lists when this occurs? Should they all be lists, or just those items with multiple objects with that name? For example, what should be the result for the following test:
>
> def test_get_branches(self):
> # Create a branch branch-1 that initially is a checkout of 'foo'
> # Use switch to create 'anotherbranch' which derives from that
> repo = self.make_repository('branch-1', format='development-colo')
> target_branch = repo.bzrdir.create_branch(name='foo')
> branch.BranchReferenceFormat().initialize(
> repo.bzrdir, target_branch=target_branch)
> tree = repo.bzrdir.create_workingtree()
>
> repo.bzrdir.get_branches() -> {'foo':???}
{'foo': Branch("/path/to/bzrdir,branch=foo"), None:
Branch("/path/to/bzrdir,branch=foo")}

IOW, I think we should just open the branch as .open_branch() would.

Cheers,

Jelmer

« Back to merge proposal