HG_URL in changegroup hook
Mads Kiilerich
mads at kiilerich.com
Sat Jan 22 19:37:45 CST 2011
Ryan wrote, On 01/22/2011 08:54 PM:
> I've setup a simple changegroup hook for my Mercurial repositories to
> email the set of changes to interested users. I'd like to use a single
> script for every repository I manage, and I would also like to
> identify the repository the changegroup came from. According to the
> Mercurial Hooks documentation, the environment variable HG_URL is
> available for this purpose. However, I am not getting what I'm
> expecting from this variable:
>
> expected:
>
> https://repo01/hg/project
>
> actual:
>
> remote:https::rnideffer
>
> Why is this the URL, and how do I get what I expected into the changegroup hook?
That's a good question. It seems like this isn't documented anywhere.
I conclude that your hook is running in hgweb on your server.
The hgrc man page says "URL from which changes came is in $HG_URL". But
when you push to hgweb the changes do not come _from_ a URL but is sent
_to_ a URL. Putting the destination URL as seen from the client in
HG_URL would (also) be incorrect according to the documentation.
It seems like hgweb instead inserts
"remote:protocol:$REMOTE_HOST:$REMOTE_USER" in HG_URL. So the value you
see indicates that you are pushing over https, REMOTE_HOST is apparently
not set, and the push was authenticated as rnideffer on the web server.
I guess your web server will set some other environment variable you can
use to distinguish the repositories - for example |PATH_INFO or
||REQUEST_URI.
/Mads
|
More information about the Mercurial
mailing list