[PATCH] fetch: do not count closed branches when attempting to infer a merge

Benjamin Pollack benjamin at bitquabit.com
Mon Mar 16 22:22:49 CDT 2009


On 3/16/09 10:14 PM, John Mulligan wrote:
> On Mon, Mar 16, 2009 at 05:04:01PM -0400, Benjamin Pollack wrote:
>   
>> Good question, but meanwhile, it looks as if I didn't actually fix the 
>> bug.  Please disregard the patch for the moment until I figure out 
>> what's going on here.
>>     
>
> Since I think I caused this with the branch closing patches, please
> let me know if I can help. I looked at the issue quickly and it looked 
> like the branchheads function was returning "buried" branch heads that 
> are currently in the cache but aren't actually heads. 
> We may want to fix that function first. Any thoughts?
>   
The only issue is that repo.branchheads() returns inactive branches,
which I wasn't expecting and didn't test for.  The fix is trivial--you
simply need to filter out "heads" that have children:

    heads = [head for head in repo.branchheads(branch, closed=False) if
repo[head].children() == 0]

I already have a modification of my first submission that does exactly
that.  I'll post back here as soon as I modify the fetch test-suite to
avoid a regression.

Personally, it makes sense to me that branchheads() returns the heads of
all branches, regardless of whether active or not; and if that's what it
should be doing, then there's no bug in your code.

--Benjamin


More information about the Mercurial-devel mailing list