[PATCH] localrepo: fix bugs in branchheads

Dirkjan Ochtman dirkjan at ochtman.nl
Wed Sep 23 06:03:47 CDT 2009


On Wed, Sep 23, 2009 at 12:56, Sune Foldager <cryo at cyanite.org> wrote:
> # HG changeset patch
> # User Sune Foldager <cryo at cyanite.org>
> # Date 1253703203 -7200
> # Node ID 9a335e3dc705fb3f3873c554d18634dadd673099
> # Parent  a15813fae0a8f414228f9da768c235f9d017ebfa
> localrepo: fix bugs in branchheads
>
> 1. The call to reverse() reversed the list in place in the global branchmap.
> 2. The nodesbetween function doesn't preserve ordering.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1164,12 +1164,12 @@
>         branches = self.branchmap()
>         if branch not in branches:
>             return []
> -        bheads = branches[branch]
>         # the cache returns heads ordered lowest to highest
> -        bheads.reverse()
> +        bheads = list(reversed(branches[branch]))

This should probably be sorted(x, reverse=True) instead of list(reversed(x)).

Also adding a small docstring to branchheads() would be awesome. :)

Thanks,

Dirkjan



More information about the Mercurial-devel mailing list