0

Hosting Mercurial on a windows box thru IIS.

I have a root directory where I put all of my repos

d:\repos
   - ProjectA
       - .hg
          - hgrc
   - ProjectB
       - .hg
          - hgrc
   - ProjectC
       - .hg
          - hgrc

All of the repos' hgrc files setup the notify extension with:

config =d:\hg\Repositories\NotificationList.txt

That way I have a single file to manage all of the notification recipients, like the wiki describes: https://www.mercurial-scm.org/wiki/NotifyExtension

But the wiki makes mention of controlling that NotificationList.txt file thru it's own repository? How can I do that? If I create a separate repo at d:\repos\HgNotify and have the NotificationList.txt file in there, users can change, commit and push back, but when the push occurs, NotificationList.txt does not get updated on the hg server.

Is there a way to update that file somehow? Am I missing a key setup on my Hg server? Or do I need to use a post-push hook to deploy that file?

Update 1

I added the details from Tim's answer and I kept getting HTTP 500: Server Error on the push. I finally figure out how to trace the python calls (python -m win32traceutil), and here is what seems to be the problem:

 File "C:\Python27\lib\site-packages\mercurial\util.py", line 402, in hgexecutable
 exe = findexe('hg') or os.path.basename(sys.argv[0]) AttributeError: 'module' object has no attribute 'argv'

It doesn't seem to be able to find hg.exe.

Update 2

I installed TortoiseHg and rebooted the system. Now I get: emote: added 1 changesets with 1 changes to 1 files remote: notify: sending 1 subscribers 1 changes remote: warning: changegroup.update hook exited with status 1

So that makes be think that it has found the hg.exe, but it is not doing its job, because the file does not get updated

Update 3

Found my solution here: https://stackoverflow.com/a/8023594/698

The command line I ended up using was:

 changegroup = cmd /c hg update

I also added: [ui] debug=true

To my hgrc. Those two combined gave me a lot more meaningful messages. In the end I saw "Access denied". I gave Users full permission, but I am not sure why giving IUSR full permission didn't work. Something I'll have to dig into at a later time.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
slolife
  • 19,520
  • 20
  • 78
  • 121

1 Answers1

1

On the server repo containing your notification list you need to add a changegroup hook:

[hooks]
changegroup.update = hg update -C

or if you want to ensure the repository is always clean:

[extensions]
purge =

[hooks]
changegroup.update = hg update -C && hg purge --all
Tim Delaney
  • 5,535
  • 3
  • 24
  • 18
  • Here's what I get when I push: HTTP Error: 500 (Internal Server Error) [command returned code 255 Thu Feb 07 13:02:53 2013]. I don't know where to look up any more detail on that. – slolife Feb 07 '13 at 21:06
  • Do you only get this with the changegroup hook? If so, add the `--traceback` option: `changegroup.update = hg --traceback update -C`. It might well be because you're using a web server for the repo - it might not have permissions to do the update. I'd suggest looking into [mercurial-server](https://www.lshift.net/mercurial-server.html). – Tim Delaney Feb 07 '13 at 21:36
  • I added changegroup.update = hg --traceback update -C but don't see any more details. See my update 1 about not finding hg.exe – slolife Feb 07 '13 at 21:38
  • Your web server may be running as a different user - how are you starting it? Just `hg serve`? Or are you using Apache or some other web server? – Tim Delaney Feb 07 '13 at 21:46
  • Running it thru IIS as an ISAPI filter using the instruction here: http://www.firegarden.com/software/hosting-mercurial-repo-iis7-windows-server-2008r2-x64-python-isapi-cgi – slolife Feb 07 '13 at 22:23