[PATCH] commands: add more robust support for 'hg log -b' (issue2078)

Sune Foldager cryo at cyanite.org
Mon Apr 19 04:51:16 CDT 2010


On 19-04-2010 00:50, Steve Losh wrote:
> This change adds a localrepo.lookupbranch(key, remote=None) function. This
> will look up the branch of the revision with the given key. The algorithm
> works like this:
>
>      * If a remote repo is given and KEY is the name of a branch in that repo,
>        return KEY.
>      * If no remote repo is given and KEY is the name of a branch in the local
>        repo object, return KEY.
>      * Otherwise look up the revision with the identifier KEY in the local repo
>        and return its branch.
>
> This change also makes 'hg log -b' use this new functionality and adds a few
> tests for it.

What about special handling for '.'? Also, what about in/out/pull/push 
(and clone)'s -b options? I use a semi-similar function there to perform 
the lookups; there might be overlap, although "my" function does 
something a bit more specific, as I recall (it's addbranchrevs, I think).

We should at any rate consolidate the two, if possible. The current 
semantics of -b for those commands:

push/out: Lookup local branches. If it fails, use key as a rev instead; 
it DOESN'T look up its branch!.. we may want to change this.

pull/in: Lookup remote branches, except '.' is special-cased as branch 
of parent. As above if that fails, and we may want to change that.

clone: As above, and '.' can be used (I think) if the source is local 
and has a working directory parent.

/Sune


More information about the Mercurial-devel mailing list