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

Benoit Boissinot benoit.boissinot at ens-lyon.org
Wed Apr 14 09:37:02 CDT 2010


On Wed, Apr 14, 2010 at 10:28:15AM -0400, Greg Ward wrote:
> On Wed, Apr 14, 2010 at 10:23 AM, Benoit Boissinot
> <benoit.boissinot at ens-lyon.org> wrote:
> > On Wed, Apr 14, 2010 at 10:10:22AM -0400, Greg Ward wrote:
> >> # HG changeset patch
> >> # User Greg Ward <greg-hg at gerg.ca>
> >> # Date 1271254132 14400
> >> # Branch stable
> >> # Node ID 02e76c11eee97d454e8dcfca4752d73572b0b92b
> >> # Parent  fcd774f7d93d55fc74c04a4f8cb9c7ef7722af1c
> >> revlog: fix lazyparser.__iter__() to see all revisions.
> >> (issue2137)
> >>
> >> diff --git a/tests/issue2137.py b/tests/issue2137.py
> >
> > why two different files?
> 
> Hey, you didn't notice that I forgot the *.out file!  ;-)
> 
> > a better tests might be using a wrapper that changes revlog._prereadsize
> > and revlog._maxinline.
> >
> > and use an extension wrapping around the commit command to check for
> > lookup()
> 
> 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

Benoit
-- 
:wq


More information about the Mercurial-devel mailing list