[PATCH 2 of 2 STABLE] revlog: fix lazyparser.__iter__() to see all revisions

Greg Ward greg-hg at gerg.ca
Wed Apr 14 14:04:37 CDT 2010


On Wed, Apr 14, 2010 at 10:37 AM, Benoit Boissinot
<benoit.boissinot at ens-lyon.org> wrote:
>> Actually I think it's doable with a single Python script.  I don't see
>> the value of using wrappers or extensions at all here.
>
> Avoid depending to much on the internal API.
>
> commit wrapper extension, foo.py:
>
> def commitwrapper(orig, ui, repo, *args, **kwargs):
>    revlog._prereadsize = revlog._maxinline = 128
>    ret = orig(ui, repo, *args, **kwargs)
>    tip = repo.changelog.tip()
>    print hgnode.hex(repo.changelog.lookup(hgnode.short(tip)))
>    return ret
>
> extensions.wrapcommand(commands.table, 'commit', commitwrapper)
>
> then just activate the extension and:
>
> hg init
> hg commit something
> hg commit something else
>
> voila

Ahhh, clever.  I get it.  It even works too: new patch coming soon.

Greg


More information about the Mercurial-devel mailing list