What's wrong with hgweb.cgi ?

232 views
Skip to first unread message

Dongsheng Song

unread,
Jun 18, 2010, 5:09:44 AM6/18/10
to merc...@selenic.com
Here is my fork of http://selenic.com/repo/hg/file/tip/hgweb.cgi:

$ cat /home/dongsheng/repo/hg/hgweb.config
[web]
style = gitweb

[paths]
/ = /home/dongsheng/repo/hg/*

$ cat hg.cgi
#!/usr/bin/env python

# Path to repo or hgweb config to serve
config = "/home/dongsheng/repo/hg/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide:
import sys; sys.path.insert(0, "/home/dongsheng/lib/python2.6/site-packages")

# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()

from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)

Traceback (most recent call last):
  File "hg.cgi", line 15, in <module>
    application = hgweb(config)
  File "/home/dongsheng/lib/python2.6/site-packages/mercurial/hgweb/__init__.py", line 12, in hgweb
    return hgweb_mod.hgweb(*args, **kwargs)
  File "/home/dongsheng/lib/python2.6/site-packages/mercurial/hgweb/hgweb_mod.py", line 30, in __init__
    self.repo = hg.repository(u, repo)
  File "/home/dongsheng/lib/python2.6/site-packages/mercurial/hg.py", line 82, in repository
    repo = _lookup(path).instance(ui, path, create)
  File "/home/dongsheng/lib/python2.6/site-packages/mercurial/bundlerepo.py", line 305, in instance
    return bundlerepository(ui, repopath, bundlename)
  File "/home/dongsheng/lib/python2.6/site-packages/mercurial/bundlerepo.py", line 177, in __init__
    raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
mercurial.error.Abort: /home/dongsheng/repo/hg/hgweb.config: not a Mercurial bundle file
Exception ImportError: 'No module named shutil' in <bound method bundlerepository.__del__ of <mercurial.bundlerepo.bundlerepository object at 0x8010bdf10>> ignored


BTW, the comments 'hg help hgweb' in hgweb.cgi not valid now.

Regards,
Cauchy

Dongsheng Song

unread,
Jun 18, 2010, 5:27:06 AM6/18/10
to merc...@selenic.com
It seems that config in 'hgweb(config)' should be repository, not hgweb.config !

When I use hgweb("/home/dongsheng/repo/hg/hg"), it looks good !

But I can see mpm change hgweb.cgi recently:

changeset:   11000:338167735124
user:        Matt Mackall <m...@selenic.com>
date:        Mon Apr 26 11:03:40 2010 -0500
summary:     hgweb: simplify hgweb.cgi, add help pointer

Therefore, this very strange, how can I use hgweb.config properly?

Dirkjan Ochtman

unread,
Jun 18, 2010, 5:57:01 AM6/18/10
to Dongsheng Song, merc...@selenic.com
On Fri, Jun 18, 2010 at 11:27, Dongsheng Song <dongshe...@gmail.com> wrote:
> It seems that config in 'hgweb(config)' should be repository, not
> hgweb.config !
>
> When I use hgweb("/home/dongsheng/repo/hg/hg"), it looks good !
>
> But I can see mpm change hgweb.cgi recently:
>
> changeset:   11000:338167735124
> user:        Matt Mackall <m...@selenic.com>
> date:        Mon Apr 26 11:03:40 2010 -0500
> summary:     hgweb: simplify hgweb.cgi, add help pointer
>
> Therefore, this very strange, how can I use hgweb.config properly?

What version of Mercurial are you running?

Cheers,

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

Dongsheng Song

unread,
Jun 18, 2010, 6:08:05 AM6/18/10
to Dirkjan Ochtman, merc...@selenic.com
$ hg version
Mercurial Distributed SCM (version 1.5.4)

Matt Mackall

unread,
Jun 18, 2010, 9:49:28 AM6/18/10
to Dongsheng Song, Dirkjan Ochtman, merc...@selenic.com
[Ugh, repairing top-posting]

On Fri, Jun 18, 2010 at 17:57, Dirkjan Ochtman <dir...@ochtman.nl>
wrote:

> What version of Mercurial are you running?

On Fri, 2010-06-18 at 18:08 +0800, Dongsheng Song wrote:
>
> $ hg version
> Mercurial Distributed SCM (version 1.5.4)

You can't use 1.5.4 with the unified hgweb.cgi that you grabbed from the
development tree because the support for it is also in that tree.

--
Mathematics is the supreme nostalgia of our time.

Dongsheng Song

unread,
Jun 18, 2010, 12:24:36 PM6/18/10
to Matt Mackall, Dirkjan Ochtman, merc...@selenic.com
On Fri, Jun 18, 2010 at 21:49, Matt Mackall <m...@selenic.com> wrote:
[Ugh, repairing top-posting]

On Fri, Jun 18, 2010 at 17:57, Dirkjan Ochtman <dir...@ochtman.nl>
wrote:
> What version of Mercurial are you running?

On Fri, 2010-06-18 at 18:08 +0800, Dongsheng Song wrote:
>
> $ hg version
> Mercurial Distributed SCM (version 1.5.4)

You can't use 1.5.4 with the unified hgweb.cgi that you grabbed from the
development tree because the support for it is also in that tree.


Thanks, I checked hgweb.cgi in 1.5.4:
    application = hgweb("/path/to/repo", "repository name")

Is it means I cannot use one cgi  to serve multiple repository ?

Rafael Martins

unread,
Jun 18, 2010, 12:32:00 PM6/18/10
to Dongsheng Song, Dirkjan Ochtman, merc...@selenic.com, Matt Mackall
On Fri, Jun 18, 2010 at 1:24 PM, Dongsheng Song
<dongshe...@gmail.com> wrote:
>
> Is it means I cannot use one cgi to serve multiple repository ?

You can:
http://selenic.com/repo/hg/file/1.5.4/hgwebdir.cgi

--
Rafael Goncalves Martins
http://rafaelmartins.eng.br/

Dirkjan Ochtman

unread,
Jun 18, 2010, 12:32:51 PM6/18/10
to Dongsheng Song, merc...@selenic.com, Matt Mackall
On Fri, Jun 18, 2010 at 18:24, Dongsheng Song <dongshe...@gmail.com> wrote:
> Is it means I cannot use one cgi  to serve multiple repository ?

You can, but it's called hgwebdir.cgi.

Cheers,

Dirkjan

Reply all
Reply to author
Forward
0 new messages