On Thu, Dec 16, 2010 at 2:22 PM, Maciej Fijalkowski <[email protected]>wrote:
> On Thu, Dec 16, 2010 at 12:14 PM, Dan Villiom Podlaski Christiansen > <[email protected]> wrote: > > On 16 Dec 2010, at 10:33, Antonio Cuni wrote: > > > >> Alternatively, if you install mercurial you can then "import > >> mercurial.commands" and use its public API from Python. Or as you said > you > >> can > >> just execute hg log and parse the output: in this case you might be > >> interested > >> in the --template option, which allows you to format things exactly as > you > >> want, e.g.: > > > > <snip> > > > > I'd suggest parsing the command line output of Mercurial, as it's the > > officially sanctioned stable API for Mercurial. The Python API, while > > faster, provides no stability guarantees. That being said, the following > > will create a repository instance and access the context for a particular > > changeset: > > > >>>> from mercurial import hg, ui > >>>> > >>>> repo = hg.repository(ui.ui(), 'path/to/repo') > >>>> ctx = repo['tip'] > >>>> log = ctx.description() > > > > The typical accessors for a changeset context are defined at > > < > http://hg.intevation.org/mercurial/file/7397a53219c9/mercurial/context.py#l97 > >. > > > > Please note that any use of the Python API means that the entire > application > > is covered by the GPL. > > > > How is it even technically possible? It does not link against > mercurial and GPL specifically excludes anything about *running* your > software. > _______________________________________________ > [email protected] > http://codespeak.net/mailman/listinfo/pypy-dev > Because the term "link" is totally meaningless in the context of Python code. Some people say this means it's impossible for Python to invoke that clause of the GPL, others say it means `import`ing something invokes it. There's no correct answer. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero "Code can always be simpler than you think, but never as simple as you want" -- Me
_______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
