extension using revsets etc.

Matthew Watson mattw.watson at gmail.com
Fri Apr 8 09:06:24 CDT 2011


Hi Guys,

I've got an extension that I want to be able to accept revsets for
convenience and consistency's sake.

I've got an arg *nodes that gets passed in and I was doing the
following, basically from looking at what log does in commands.py:

   matchfn = cmdutil.matchall(repo)
    fopts = {}
    fopts['rev'] = nodes
    if not nodes:
        fopts['rev'] = "0:%s" % repo['tip'].rev()
    def prep(ctx, fns):
        True
    for ctx in cmdutil.walkchangerevs(repo, matchfn, fopts, prep):
        felognode(ui, repo, ctx, **opts)

felognode does a lot of inspection of the commit, loads manifests and diffs etc.

Problem is that this approach doesn't seem to garbage colect anything
- after about 4000 commits, my python process is up to 12GB memory and
the machine is swapping like crazy. Is there a better way to do this
where the contexts, the filectx and manifest(s) are getting garbage
collected as I go along? Or a better way to process a generic --rev
arg into a list of commit numbers to process?

Also, I'm not really sure of the role of the "prep" function, whether
I should be doing my output within that or within the body of the for
loop.

Any guidance much appreciated,
Thanks in advance,

Matt Watson


More information about the Mercurial-devel mailing list