Unable to view any repositories with hgwebdir on windows and Apache

View: New views
6 Messages — Rating Filter:   Alert me  

Unable to view any repositories with hgwebdir on windows and Apache

by Todd Morgan-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Note: This e-mail is subject to the disclaimer contained at the bottom of this message.


Hi,
     I have been attempting to setup a centralised Mercurial server using Apache, Python 2.5.2, the current version of Mercurial (1.3.1) upon Windows.
 
I am using Windows as we have a Windows machine already available, that is serving some other RCSs and is appropriately backed up.
 
I have managed to get the Hgweb application rendering correctly but it is not showing any repositories at all (I have one dummy repository setup). C:\Mercurial\repos\boring\.hg
 
 
My directory structures are:
 
Mercurial (1.3.1)   C:\Mercurial
 
Python    C:\Python25
 
WAMP  C:\wamp
 
I have installed Python Win32API
Extracted the library.zip to the lib dir
Created the hg dir (C:\wamp\www\hg)
 
"Installed" [copied] the modpython_gateway.py to C:\Python25\Lib\site-packages
 
Downloaded and renamed hgweddir.cgi to C:\Mercurial\hgwebdir.py
 
My hgwebdir.py contains the following
 
 
 
 
 
#!C:/Python25/python.exe
#
# An example CGI script to export multiple hgweb repos, edit as necessary
 
# adjust python path if not a system-wide install:
import sys
sys.path.insert(0, "C:/Mercurial/lib")
 
# Changes Python Working path to support collections in windows with mod_python
import os
os.chdir("C:/Mercurial")
 
 
 
# enable importing on demand to reduce startup time
from mercurial import demandimport; demandimport.enable()
 
# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb
cgitb.enable()
 
# If you'd like to serve pages with UTF-8 instead of your default
# locale charset, you can do so by uncommenting the following lines.
# Note that this will cause your .hgrc files to be interpreted in
# UTF-8 and all your repo files to be displayed using UTF-8.
#
#import os
#os.environ["HGENCODING"] = "UTF-8"
 
from mercurial.hgweb.hgwebdir_mod import hgwebdir
import mercurial.hgweb.wsgicgi as wsgicgi
 
# The config file looks like this.  You can have paths to individual
# repos, collections of repos in a directory tree, or both.
#
# [paths]
# virtual/path1 = /real/path1
# virtual/path2 = /real/path2
# virtual/root = /real/root/*
# / = /real/root2/*
# virtual/root2 = /real/root2/**
 
#repo1 = C:/Mercurial/repos/boring
 
# [collections]
# /prefix/to/strip/off = /root/of/tree/full/of/repos
#
# paths example:
#
# * First two lines mount one repository into one virtual path, like
# '/real/path1' into 'virtual/path1'.
#
# * The third entry mounts every mercurial repository found in '/real/root'
# in 'virtual/root'. This format is preferred over the [collections] one,
# since using absolute paths as configuration keys is not supported on every
# platform (especially on Windows).
#
# * The fourth entry is a special case mounting all repositories in
# /'real/root2' in the root of the virtual directory.
#
# * The fifth entry recursively finds all repositories under the real root,
# and mounts them using their relative path (to given real root) under the
# virtual root.
#
# collections example: say directory tree /foo contains repos /foo/bar,
# /foo/quux/baz.  Give this config section:
#   [collections]
#   /foo = /foo
# Then repos will list as bar and quux/baz.
#
# Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
# or use a dictionary with entries like 'virtual/path': '/real/path'
 
application = hgwebdir('hgweb.config')
#wsgicgi.launch(application)
 
 
 
 
 
 
 
 
My hg.conf (C:\wamp\alias\hg.conf) contains the following
 
<Location /hg>
  PythonPath "sys.path + [ 'c:\Mercurial' ]"
  PythonDebug On
  #Uncomment this line if you got a problem and need debug information
  SetHandler mod_python
  PythonHandler modpython_gateway::handler
  PythonOption SCRIPT_NAME /hg
  PythonOption wsgi.application hgwebdir::application
#  PythonOption hgwebdir::application
 
</Location>
 
 
 
 
My hgweb.conf contains
 
#[collections]
#repos\ = /repos/**
#[paths]
#repo1 = C:/alt_repos/**
#[paths]
#/alt_repos = /alt_repos/**
#[collections]
#\webdata\hg_repos\trunk = /webdata/hg_repos/trunk
[collections]
repos\ = repos/
 
 
 
 
My repository is located C:\Mercurial\repos\boring\.hg
 
I (believe) that I have attempted all the possible combinations of / and \  as well as fully qualified paths to specify the repository both within the collections and the paths section (restarting apache each time I change the file).
 
I'm sure I am doing something simple wrong. Can anyone help me get this working please?
 
Thanks Todd
 

The information transmitted in this message and its attachments (if any) is intended only for the person or entity to which it is addressed.

The message may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information, by persons or entities other than the intended recipient is prohibited.

If you have received this in error, please contact the sender and delete this e-mail and associated material from any computer.

The intended recipient of this e-mail may only use, reproduce, disclose or distribute the information contained in this e-mail and any attached files, with the permission of the sender.

This message has been scanned for viruses with Symantec Scan Engine and cleared by MailMarshal.



_______________________________________________
Mercurial mailing list
Mercurial@...
http://selenic.com/mailman/listinfo/mercurial

Re: Unable to view any repositories with hgwebdir on windows and Apache

by Greg Ward-17 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 4, 2009 at 1:52 AM, Todd Morgan <Todd.Morgan@...> wrote:
> I have managed to get the Hgweb application rendering correctly but it is
> not showing any repositories at all (I have one dummy repository setup).
> C:\Mercurial\repos\boring\.hg
>
[...]
> I'm sure I am doing something simple wrong. Can anyone help me get this
> working please?

Probably: I find that when hgweb doesn't work, it's usually a simple
error on my part.  And the answer is usually found in Apache's error
log, which is where stderr of CGI scripts goes.  Very often there's a
big noisy traceback reporting a config error, or a syntax error, or a
permission error... stuff like that.  Take a look there and let us
know what you find.

Greg
_______________________________________________
Mercurial mailing list
Mercurial@...
http://selenic.com/mailman/listinfo/mercurial

Re: Unable to view any repositories with hgwebdir on windows and Apache

by Dirkjan Ochtman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 4, 2009 at 23:02, Greg Ward <greg-hg@...> wrote:
> Probably: I find that when hgweb doesn't work, it's usually a simple
> error on my part.  And the answer is usually found in Apache's error
> log, which is where stderr of CGI scripts goes.  Very often there's a
> big noisy traceback reporting a config error, or a syntax error, or a
> permission error... stuff like that.  Take a look there and let us
> know what you find.

Another useful debugging technique is running hg serve --webdir-conf
with your config file on the command-line, because then you may get a
lot of spew right there in your command prompt window. I'm going to
make a guess and say that you probably want your hgwebdir.conf to have

[paths]
/ = C:\alt_repos\** (it may need forward slashes, not sure)

Cheers,

Dirkjan

_______________________________________________
Mercurial mailing list
Mercurial@...
http://selenic.com/mailman/listinfo/mercurial

RE: Unable to view any repositories with hgwebdir on windows and Apache

by Todd Morgan-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


_______________________________________________________________________________________

Note: This e-mail is subject to the disclaimer contained at the bottom of this message.
_______________________________________________________________________________________


Thanks for that Dirkjan and Greg :-)

I believe I have solved the problem. Minor "pebkac" or spacing issue on my end and contradictions within the wiki doco.

I was able to run the application successfully when I used the vanilla hg serve method and specifying the config file on the command line. I couldn't understand what the problem was. The only minor interesting thing in the apache error log was this


[Fri Oct 30 14:55:23 2009] [error] python_init: Python version mismatch, expected '2.5', found '2.5.2'.
[Fri Oct 30 14:55:23 2009] [error] python_init: Python executable found 'C:\\wamp\\bin\\apache\\apache2.2.11\\bin\\httpd.exe'.
[Fri Oct 30 14:55:23 2009] [error] python_init: Python path being used 'C:\\WINDOWS\\system32\\python25.zip;C:\\Python25\\Lib;C:\\Python25\\DLLs;C:\\Python25\\Lib\\lib-tk;;C:\\wamp\\bin\\apache\\apache2.2.11\\bin'.
[Fri Oct 30 14:55:23 2009] [notice] mod_python: Creating 8 session mutexes based on 0 max processes and 64 max threads.


I performed the installation upon another (Virtual) machine using the 2.5 version of Python (not 2.5.2) but I got the same problem. No repositories. I was able to run the hg serve application on the command line AOK. Then I realised. The wiki refers to 2 different files for configuring the HGWEBDIR

http://mercurial.selenic.com/wiki/WAMPInstall refers to it as

11. Create <MercurialPath>\***hgweb.conf***

But the other refers to the ***hgweb.config***   (http://mercurial.selenic.com/wiki/HgWebDirStepByStep#Windows_Specific_Instructions)

5.3. Other Gotchas

The path to your Mercurial repositories cannot also contain the name to the path to the Mercurial CGI. Maybe this is just my weird Apache setup, but when my hgwebdir.cgi was installed in c:/webdata/repos, this ***hgweb.config*** failed for me:




Perhaps someone with write access should update the wiki to reflect the correct name of the file (hgweb.config and NOT hgweb.conf) as it appears to be an "immutable Page" (unless that's because I haven't got an account for the wiki). Also fixing up the wiki markup so that it doesn't mangle the content would be good also.

With regards to the paths - both actually worked - so I had 2 sets of repositories rendered - 1 based upon the paths and one for the collections.

Now I just have to get it all to place nicely with our LDAP server :-)

Thanks muchly
                Todd


-----Original Message-----
From: djc.ochtman@... [mailto:djc.ochtman@...] On Behalf Of Dirkjan Ochtman
Sent: Thursday, 5 November 2009 9:10 AM
To: Greg Ward
Cc: Todd Morgan; mercurial@...
Subject: Re: Unable to view any repositories with hgwebdir on windows and Apache

On Wed, Nov 4, 2009 at 23:02, Greg Ward <greg-hg@...> wrote:
> Probably: I find that when hgweb doesn't work, it's usually a simple
> error on my part.  And the answer is usually found in Apache's error
> log, which is where stderr of CGI scripts goes.  Very often there's a
> big noisy traceback reporting a config error, or a syntax error, or a
> permission error... stuff like that.  Take a look there and let us
> know what you find.

Another useful debugging technique is running hg serve --webdir-conf
with your config file on the command-line, because then you may get a
lot of spew right there in your command prompt window. I'm going to
make a guess and say that you probably want your hgwebdir.conf to have

[paths]
/ = C:\alt_repos\** (it may need forward slashes, not sure)

Cheers,

Dirkjan
_______________________________________________________________________________________

The information transmitted in this message and its attachments (if any) is intended
only for the person or entity to which it is addressed.
The message may contain confidential and/or privileged material. Any review,
retransmission, dissemination or other use of, or taking of any action in reliance
upon this information, by persons or entities other than the intended recipient is
prohibited.

If you have received this in error, please contact the sender and delete this e-mail
and associated material from any computer.

The intended recipient of this e-mail may only use, reproduce, disclose or distribute
the information contained in this e-mail and any attached files, with the permission
of the sender.

This message has been scanned for viruses with Symantec Scan Engine and cleared by
MailMarshal.
_______________________________________________________________________________________

_______________________________________________
Mercurial mailing list
Mercurial@...
http://selenic.com/mailman/listinfo/mercurial

Parent Message unknown Re: Unable to view any repositories with hgwebdir on windows and Apache

by Dirkjan Ochtman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Nov 5, 2009 at 06:15, Todd Morgan <Todd.Morgan@...> wrote:
> http://mercurial.selenic.com/wiki/WAMPInstall refers to it as
>
> 11. Create <MercurialPath>\***hgweb.conf***
>
> But the other refers to the ***hgweb.config***   (http://mercurial.selenic.com/wiki/HgWebDirStepByStep#Windows_Specific_Instructions)
>
> 5.3. Other Gotchas
>
> The path to your Mercurial repositories cannot also contain the name to the path to the Mercurial CGI. Maybe this is just my weird Apache setup, but when my hgwebdir.cgi was installed in c:/webdata/repos, this ***hgweb.config*** failed for me:

The name of the config file doesn't matter, as long as the CGI, FCGI
or WSGI script refers to the right one.

Cheers,

Dirkjan

_______________________________________________
Mercurial mailing list
Mercurial@...
http://selenic.com/mailman/listinfo/mercurial

RE: Unable to view any repositories with hgwebdir on windows and Apache

by Todd Morgan-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


_______________________________________________________________________________________

Note: This e-mail is subject to the disclaimer contained at the bottom of this message.
_______________________________________________________________________________________


Thanks Dirkjan,
      I'm a Java dev by trade so I didn't pick up the fact that this line


application = hgwebdir('hgweb.config')

is specifying the configuration file.

Regardless, this web page http://mercurial.selenic.com/wiki/WAMPInstall refers to

"11. Create <MercurialPath>\hgweb.conf"

Yet both the stable version of hgweb.cgi (py) (http://selenic.com/repo/hg-stable/file/07a62819b309/hgweb.cgi) and the version inline on that page have that line

"application = hgwebdir('hgweb.config')"

Which is what threw me and possibly others who just follow the wiki directly.

Ciao
    Todd





-----Original Message-----
From: djc.ochtman@... [mailto:djc.ochtman@...] On Behalf Of Dirkjan Ochtman
Sent: Thursday, 5 November 2009 6:37 PM
To: Todd Morgan
Cc: Greg Ward; mercurial@...
Subject: Re: Unable to view any repositories with hgwebdir on windows and Apache

On Thu, Nov 5, 2009 at 06:15, Todd Morgan <Todd.Morgan@...> wrote:
> http://mercurial.selenic.com/wiki/WAMPInstall refers to it as
>
> 11. Create <MercurialPath>\***hgweb.conf***
>
> But the other refers to the ***hgweb.config***   (http://mercurial.selenic.com/wiki/HgWebDirStepByStep#Windows_Specific_Instructions)
>
> 5.3. Other Gotchas
>
> The path to your Mercurial repositories cannot also contain the name to the path to the Mercurial CGI. Maybe this is just my weird Apache setup, but when my hgwebdir.cgi was installed in c:/webdata/repos, this ***hgweb.config*** failed for me:

The name of the config file doesn't matter, as long as the CGI, FCGI
or WSGI script refers to the right one.

Cheers,

Dirkjan
_______________________________________________________________________________________

The information transmitted in this message and its attachments (if any) is intended
only for the person or entity to which it is addressed.
The message may contain confidential and/or privileged material. Any review,
retransmission, dissemination or other use of, or taking of any action in reliance
upon this information, by persons or entities other than the intended recipient is
prohibited.

If you have received this in error, please contact the sender and delete this e-mail
and associated material from any computer.

The intended recipient of this e-mail may only use, reproduce, disclose or distribute
the information contained in this e-mail and any attached files, with the permission
of the sender.

This message has been scanned for viruses with Symantec Scan Engine and cleared by
MailMarshal.
_______________________________________________________________________________________

_______________________________________________
Mercurial mailing list
Mercurial@...
http://selenic.com/mailman/listinfo/mercurial