Tuesday, 24 May 2011

Setting up Mercurial on IIS

I have just set up a Mercurial server using IIS to serve the requests. I found that the following blog post was a great step by step guide to setting it up http://blog.schuager.com/2010/03/how-to-setup-mercurial-server-on.html. However I had a few issues that were not covered in the blog post: The first was that I was getting a "DLL load failed" error for several modules. The reason for this is that I had installed the standalone version of Mercurial and that it could not reference the compiled C versions of the python modules. I fixed this by copying the pure python modules into the lib directory. You can find the pure python modules for the 1.8.3 version of Mercurial at http://selenic.com/repo/hg/file/3cb1e95676ad/mercurial/pure The second issue was that IIS refused to serve cs files, as the Request Filtering feature was enabled. I disabled this for the whole repo by adding the following to the web.config at the top level of the IIS hg app.
<configuration>
    <system.webServer>
        <security>
            <requestFiltering>
                <fileExtensions>
                    <clear/>
                </fileExtensions>
            </requestFiltering>
        </security>
    </system.webServer>
</configuration>

Simple Python Command to generate a random GUID

Every so often I need to generate a GUID for a MS Proj file. The simple python command will create one for me:
python -c "import uuid;print uuid.uuid4()"
Changing that to a emacs function so I can insert them where ever I need we get:
(defun genUUID ()
  "Generates a UUID"
  (interactive)
  (shell-command "python -c \"import uuid;print uuid.uuid4()\"" t)
)