Question

Ok, this is really weird. I have an old Mercurial 2.02. with python 2.6 on an old Ubuntu-something (I think 10.4). We are a windows shop, und push regularly, so I wanted kind of a review service. It absolutely worked on windows.. pretxnchangegroup referencing the python file on the drive, worked..

But I made the mistake to create the Mercurial hook on a new Mercurial 2.7, but then recognized the internal API changed, so I got back and fixed it, or tried to. I'm using windows, but need to deploy the hook to Linux, so I use WinSCP to copy the py file to my home directory. And then sudo cp it to the python 2.6 distro folder where the other hook file lie.

I invoke the hook via the module pattern on the linux box:

pretxnchangegroup.pushtest = python:mycompanyname.testcommit.exportpatches

In the folder "mycompanyname" is the file testcommit.py and the function is named exportpatches. It works locally without a problem.

The strange thing: It worked once, and kind of unstable: sometime it just says that the function "mycompanyname.testcommit.exportpatches" is not defined. And sometimes it just uses an old version of the hook (I see that because it gives an old exception message instead of the newer one). And I don't know how to get exception messages in python, so I'm lost there..

Second strange thing: these hook files also have a .pyc version, probably compiled, but my hook doesn't get such treatment. Is that autocompilation?

If I try the directory approach to point to the file, I get a straight 500 internal error on push.

I'm really lost and desperate by now, because the stuff has to work pretty soon, and I'm banging my head against the wall right now..

Was it helpful?

Solution

I don't know exactly what happened, but it seams like it was not using the script because an exceptions somehow prohibited it from compiling to a pyc, and Mercurial somehow fetched the old version of that pyc file. Not too sure, but that's my best guess (as somehow noone else seems to have an idea and the Mercurial guys made it really clear they only answer stuff on their mailing list instead of SO.. how .. nice).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top