pretxnchangegroup hook cannot see entire changeset
we're trying to find a way to see the entire changeset of one or more incoming revisions in a mercurial repository inside the pretxnchangegroup hook. We use version 1.6.3.
We can get the first incoming change with $HG_NODE, but hg tip
still points to the oldest, co开发者_JS百科mmitted change, not to the one that we're about to tack on. The same for hg log -rNode:
We cannot even seem to get the diff of $HG_NODE in this hook, hg log just says "unknown revision"
It seems like this is related to http://groups.google.com/group/mercurial_general/browse_thread/thread/9321b94b08ab04b9
Has anyone had the same problem and solved it somehow?
It should definitely be the case that both tip
and log
reflect the post-arrival information. Are you sure that the directory in which you're running those commands is that of the repository triggehg clone hooktest hooktest-clone
ring the hook? The only way I could see that not being the case were if you were using hg -R
, which you'd know.
Here's a test script you should be able to paste into a (unix or cygwin) shell:
hg init hooktest
echo this >> hooktest/afile
echo -e '[hooks]\npretxnchangegroup = hg log && hg tip' >> hooktest/.hg/hgrc
hg -R hooktest commit -A -m 'initial commit'
hg clone hooktest hooktest-clone
echo more >> hooktest-clone/afile
hg -R hooktest-clone commit -m 'second commit'
hg -R hooktest-clone push
When I paste that I get:
ry4an@hail [~/hg] % hg init hooktest
ry4an@hail [~/hg] % echo this >> hooktest/afile
ry4an@hail [~/hg] % echo -e '[hooks]\npretxnchangegroup = hg log && hg tip' >> hooktest/.hg/hgrc
ry4an@hail [~/hg] % hg -R hooktest commit -A -m 'initial commit'
adding afile
ry4an@hail [~/hg] % hg clone hooktest hooktest-clone
updating working directory
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ry4an@hail [~/hg] % echo more >> hooktest-clone/afile
ry4an@hail [~/hg] % hg -R hooktest-clone commit -m 'second commit'
ry4an@hail [~/hg] % hg -R hooktest-clone push
pushing to /home/msi/ry4an/hg/hooktest
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
changeset: 1:ab2cec57f878
tag: tip
user: Ry4an Brase <ry4an@msi.umn.edu>
date: Wed Nov 03 09:10:40 2010 -0500
summary: second commit
changeset: 0:30db2e527437
user: Ry4an Brase <ry4an@msi.umn.edu>
date: Wed Nov 03 09:10:39 2010 -0500
summary: initial commit
changeset: 1:ab2cec57f878
tag: tip
user: Ry4an Brase <ry4an@msi.umn.edu>
date: Wed Nov 03 09:10:40 2010 -0500
summary: second commit
ry4an@hail [~/hg] %
Where you can see that both 'hg log' and 'hg tip' show the new changeset in the hook.
Does that test run for you?
精彩评论