An extension for hg using git-flow branch model

Adrian Buehlmann adrian at cadifra.com
Wed Jan 19 04:00:33 CST 2011


On 2011-01-19 10:14, yinweiming at gmail.com wrote:
> Hi Adrian
> 
> 
> On Wed, Jan 19, 2011 at 3:51 PM, Adrian Buehlmann <adrian at cadifra.com
> <mailto:adrian at cadifra.com>> wrote:
> 
>     On 2011-01-19 03:05, yinweiming at gmail.com
>     <mailto:yinweiming at gmail.com> wrote:
>     > Hi, guys,
>     >
>     > I am a new comer in this mail group. Say hello to everybody.
> 
>     Welcome!
> 
> 
> Thank you.
>  
> 
> 
>     > I think much people heard about git-flow,
>     > http://nvie.com/posts/a-successful-git-branching-model/ .
>     > I just write hg flow and using in my own team. I put it on
>     bitbucket.org <http://bitbucket.org>
>     > <http://bitbucket.org>, you can get it here
>     > https://bitbucket.org/yinwm/hgflow .
>     >
>     > If you think that's not bad, please give me some feedback.
>     >
>     > Thanks so much.
> 
>     (tl;dr summary: License your extensions under GPL v2+!)
> 
>     Sorry for the bad news: but your license [1] is most likely ineffective
>     for anyone actually trying to use your extension.
> 
> 
> Sorry for the mistake, I change it into GPL v2.

Excellent! Just note that it should be "GPL Version 2 or any later
version".

See the Mercurial source files, which contain the header comment:

# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

I recommend you add that to the header of hgflow.py too.

> 
>     As soon as your program does things like:
> 
>      from mercurial import commands
>      from mercurial import hg
> 
>     you are most likely calling into mercurial's internal API [2]. Quote
>     (reference added).
> 
>      Using this API is a strong indication that you're creating a
>      "derived work" subject to the GPL. Before going any further,
>      read the License page [3]
> 
>     See also WritingExtensions [4].
> 
> 
> I will change my code soon for remove all internal API related code.

Why? After all, your license is fine now.

And I believe you can't do that. The interface that is used by extensions *is*
part of the mercurial internal API.

For example, in your code you do:

    def _getBranches(self):
        bmap = self.repo.branchmap()
        branches = []
        for b, h in bmap.iteritems():
            branches.append(b)

        return branches

calling repo.branchmap() constitutes usage of the interface of mercurial's repo
object, which is part of the mercurial internal API.

Technically, it is ok to do that in extensions.

Just watch out for future API changes. Consider creating a login for yourself
on the wiki and then subscribe to the changes of the wiki page

  http://mercurial.selenic.com/wiki/ApiChanges

so you get an email when there is a change on that page.

Potential future API changes will be released with major releases. See

  http://mercurial.selenic.com/wiki/TimeBasedReleasePlan


More information about the Mercurial mailing list