help - how do I use HG_PENDING in a hook?
James C. McPherson
jmcp at opensolaris.org
Tue Oct 20 07:38:56 UTC 2009
Hi all,
I own the task of updating our gate hooks to work with 1.3.1
and I'm stuck on how to make use of HG_PENDING.
[For reference, the current hook code is found at
ssh://anon@hg.opensolaris.org/hg/scm-migration/onnv-gk-tools]
The hook in question is bghook, which we use to spawn off some
other hooks which don't force a rollback.
When I come across the pending element in **kwargs I'm using
the same evaluation that I see in localrepo.py to extract it
so I can then call cPickle.dumps() on the rest of the args:
================
newkwargs = dict()
for k, v in kwargs.iteritems():
if not callable(v):
# strip out lazy-evaluated lambdas etc
newkwargs[k] = v
else:
v = v()
env['HG_' + k.upper()] = v
os.environ['HG_' + k.upper() ] = v
env["KWARGS"] = cPickle.dumps(newkwargs)
================
Which is fine except that my spawned-off hooks abort with
ERROR: bg-pretxnchangegroup.0 hook failed
calling hook bg-pretxnchangegroup.0: hook.cache.cache
caching changes for gatehooks...
***ERROR in changegroup.
Changes aborted.
Contact gk.
hook cache.cache caught exception unknown revision
'329d2ad52a67b70143855c76121fbf98c293258f'
So I realise that I need some way of working with the not-yet-written
changes and thought that perhaps I could use
newrepo = localrepo.instance(ui, repo.root, 0)
repo = newrepo
but I'm still missing something - I just do not know what it is.
Any and all suggestions will be gratefully received (including
which part of TFM I've missed, or misunderstood).
Thankyou in advance,
James C. McPherson
--
Senior Kernel Software Engineer, Solaris
Sun Microsystems
http://blogs.sun.com/jmcp http://www.jmcp.homeunix.com/blog
More information about the Mercurial-devel
mailing list