Comment 3 for bug 893470

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 893470] Re: BzrDir.list_branches lists same branch twice when a branch reference exists

Am 22/11/11 09:06, schrieb Martin Pool:
> On 22 November 2011 18:49, Neil Martinsen-Burrell<email address hidden> wrote:
>> Oops, we can't list(set(...)) to remove duplicates because apparently
>> branches don't compare equal based on their base attribute. Should
>> they?
> No. It's tempting, but adding __cmp__ to complex non-value-like
> objects tends to get in to trouble when people make different
> assumptions about what equality means: is a locked Branch equal to an
> unlocked Branch pointing to the same thing?
>
> Better just to use has_same_location, or get the base locations and
> uniquify on that.
I wonder if BzrDir.list_branches() needs to return a dictionary mapping
the names to branches, so it can preserve the original names.

Cheers,

Jelmer