Hgweb.cgi internal server error

hgweb.cgi internal server error

It uses a cgi script (hgweb.cgi) to launch mercurial which is a python I get the following Python error in my web browser: By the way. (pid=2332): Target WSGI script 'D:/Home/web/apache/cgi-bin/ hgwebdir.wsgi' cannot be loaded as Python module. [Sat Jun 19 14:32:35 2010] [error] [client. Mercurial's internal web server, hgweb, can serve either a single repository, file common to 'hg serve', "hgweb.wsgi", "hgweb.cgi" and "hgweb.fcgi".

Hgweb.cgi internal server error - are not

SoundSoftware Code Site

In logs:

Usage: DynaLoader::dl_load_file(filename, flags=0), <DATA> line 556. /usr/lib/python2.6/cgitb.py:173: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 value = pydoc.html.repr(getattr(evalue, name)) Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python2.6/cgitb.py", line 269, in __call__ self.handle((etype, evalue, etb)) File "/usr/lib/python2.6/cgitb.py", line 290, in handle self.file.write(doc + '\n') IOError: [Errno 32] Broken pipe Original exception was: Traceback (most recent call last): File "/var/hg/index.cgi", line 67, in <module> wsgicgi.launch(application) File "/usr/local/lib/python2.6/dist-packages/mercurial/hgweb/wsgicgi.py", line 74, in launch write(chunk) File "/usr/local/lib/python2.6/dist-packages/mercurial/hgweb/wsgicgi.py", line 55, in write out.flush() IOError: [Errno 32] Broken pipe

Not fixed by restarting Apache.

xargs -0r chmod 755 find ~/public_html -type f -print0

Configuring hgweb

Mercurial's internal web server, hgweb, can serve either a single repository, or a tree of repositories. In the second case, repository paths and global options can be defined using a dedicated configuration file common to 'hg serve', "hgweb.wsgi", "hgweb.cgi" and "hgweb.fcgi".

This file uses the same syntax as other Mercurial configuration files but recognizes only the following sections:

The "web" options are thoroughly described in 'hg help config'.

The "paths" section maps URL paths to paths of repositories in the filesystem. hgweb will not expose the filesystem directly - only Mercurial repositories can be published and only according to the configuration.

The left hand side is the path in the URL. Note that hgweb reserves subpaths like "rev" or "file", try using different names for nested repositories to avoid confusing effects.

The right hand side is the path in the filesystem. If the specified path ends with "*" or "**" the filesystem will be searched recursively for repositories below that point. With "*" it will not recurse into the repositories it finds (except for ".hg/patches"). With "**" it will also search inside repository working directories and possibly find subrepositories.

In this example:

[paths] /projects/a = /srv/tmprepos/a /projects/b = c:/repos/b / = /srv/repos/* /user/bob = /home/bob/repos/**
  • The first two entries make two repositories in different directories appear under the same directory in the web interface
  • The third entry will publish every Mercurial repository found in "/srv/repos/", for instance the repository "/srv/repos/quux/" will appear as "http://server/quux/"
  • The fourth entry will publish both "http://server/user/bob/quux/" and "http://server/user/bob/quux/testsubrepo/"

The "collections" section is deprecated and has been superseded by "paths".

URLs and Common Arguments

URLs under each repository have the form "/{command}[/{arguments}]" where "{command}" represents the name of a command or handler and "{arguments}" represents any number of additional URL parameters to that command.

The web server has a default style associated with it. Styles map to a collection of named templates. Each template is used to render a specific piece of data, such as a changeset or diff.

The style for the current request can be overridden two ways. First, if "{command}" contains a hyphen ("-"), the text before the hyphen defines the style. For example, "/atom-log" will render the "log" command handler with the "atom" style. The second way to set the style is with the "style" query string argument. For example, "/log?style=atom". The hyphenated URL parameter is preferred.

Not all templates are available for all styles. Attempting to use a style that doesn't have all templates defined may result in an error rendering the page.

Many commands take a "{revision}" URL parameter. This defines the changeset to operate on. This is commonly specified as the short, 12 digit hexadecimal abbreviation for the full 40 character unique revision identifier. However, any value described by 'hg help revisions' typically works.

Commands and URLs

The following web commands and their URLs are available:

/annotate/{revision}/{path}

Show changeset information for each line in a file.

The "ignorews", "ignorewsamount", "ignorewseol", and "ignoreblanklines" query string arguments have the same meaning as their "[annotate]" config equivalents. It uses the hgrc boolean parsing logic to interpret the value. e.g. "0" and "false" are false and "1" and "true" are true. If not defined, the server default settings are used.

The "fileannotate" template is rendered.

/archive/{revision}.{format}[/{path}]

Obtain an archive of repository content.

The content and type of the archive is defined by a URL path parameter. "format" is the file extension of the archive type to be generated. e.g. "zip" or "tar.bz2". Not all archive types may be allowed by your server configuration.

The optional "path" URL parameter controls content to include in the archive. If omitted, every file in the specified revision is present in the archive. If included, only the specified file or contents of the specified directory will be included in the archive.

No template is used for this handler. Raw, binary content is generated.

/bookmarks

Show information about bookmarks.

No arguments are accepted.

The "bookmarks" template is rendered.

/branches

Show information about branches.

All known branches are contained in the output, even closed branches.

No arguments are accepted.

The "branches" template is rendered.

/changelog[/{revision}]

Show information about multiple changesets.

If the optional "revision" URL argument is absent, information about all changesets starting at "tip" will be rendered. If the "revision" argument is present, changesets will be shown starting from the specified revision.

If "revision" is absent, the "rev" query string argument may be defined. This will perform a search for changesets.

The argument for "rev" can be a single revision, a revision set, or a literal keyword to search for in changeset data (equivalent to 'hg log -k').

The "revcount" query string argument defines the maximum numbers of changesets to render.

For non-searches, the "changelog" template will be rendered.

/changeset[/{revision}]

Show information about a single changeset.

A URL path argument is the changeset identifier to show. See "hg help revisions" for possible values. If not defined, the "tip" changeset will be shown.

The "changeset" template is rendered. Contents of the "changesettag", "changesetbookmark", "filenodelink", "filenolink", and the many templates related to diffs may all be used to produce the output.

/comparison/{revision}/{path}

Show a comparison between the old and new versions of a file from changes made on a particular revision.

This is similar to the "diff" handler. However, this form features a split or side-by-side diff rather than a unified diff.

The "context" query string argument can be used to control the lines of context in the diff.

The "filecomparison" template is rendered.

/diff/{revision}/{path}

Show how a file changed in a particular commit.

The "filediff" template is rendered.

This handler is registered under both the "/diff" and "/filediff" paths. "/diff" is used in modern code.

/file/{revision}[/{path}]

Show information about a directory or file in the repository.

Info about the "path" given as a URL parameter will be rendered.

If "path" is a directory, information about the entries in that directory will be rendered. This form is equivalent to the "manifest" handler.

If "path" is a file, information about that file will be shown via the "filerevision" template.

If "path" is not defined, information about the root directory will be rendered.

/diff/{revision}/{path}

Show how a file changed in a particular commit.

The "filediff" template is rendered.

This handler is registered under both the "/diff" and "/filediff" paths. "/diff" is used in modern code.

/filelog/{revision}/{path}

Show information about the history of a file in the repository.

The "revcount" query string argument can be defined to control the maximum number of entries to show.

The "filelog" template will be rendered.

/graph[/{revision}]

Show information about the graphical topology of the repository.

Information rendered by this handler can be used to create visual representations of repository topology.

The "revision" URL parameter controls the starting changeset. If it's absent, the default is "tip".

The "revcount" query string argument can define the number of changesets to show information for.

The "graphtop" query string argument can specify the starting changeset for producing "jsdata" variable that is used for rendering graph in JavaScript. By default it has the same value as "revision".

This handler will render the "graph" template.

/help[/{topic}]

Render help documentation.

This web command is roughly equivalent to 'hg help'. If a "topic" is defined, that help topic will be rendered. If not, an index of available help topics will be rendered.

The "help" template will be rendered when requesting help for a topic. "helptopics" will be rendered for the index of help topics.

/log[/{revision}[/{path}]]

Show repository or file history.

For URLs of the form "/log/{revision}", a list of changesets starting at the specified changeset identifier is shown. If "{revision}" is not defined, the default is "tip". This form is equivalent to the "changelog" handler.

For URLs of the form "/log/{revision}/{file}", the history for a specific file will be shown. This form is equivalent to the "filelog" handler.

/manifest[/{revision}[/{path}]]

Show information about a directory.

If the URL path arguments are omitted, information about the root directory for the "tip" changeset will be shown.

Because this handler can only show information for directories, it is recommended to use the "file" handler instead, as it can handle both directories and files.

The "manifest" template will be rendered for this handler.

/changeset[/{revision}]

Show information about a single changeset.

A URL path argument is the changeset identifier to show. See "hg help revisions" for possible values. If not defined, the "tip" changeset will be shown.

The "changeset" template is rendered. Contents of the "changesettag", "changesetbookmark", "filenodelink", "filenolink", and the many templates related to diffs may all be used to produce the output.

/shortlog

Show basic information about a set of changesets.

This accepts the same parameters as the "changelog" handler. The only difference is the "shortlog" template will be rendered instead of the "changelog" template.

/summary

Show a summary of repository state.

Information about the latest changesets, bookmarks, tags, and branches is captured by this handler.

The "summary" template is rendered.

/tags

Show information about tags.

No arguments are accepted.

The "tags" template is rendered.

Mercurial server error when push storage with large files

I've got older Debian Jessie server with Mercurial 3.1.2 and Phabricator. Long time Phabricator protest that HG is old and there is secure problems and I decide to make brand new VM with latest HG. Old:

New:

and configured:

Rsynced all the repositories and setup hgweb.wsgi to act like a web server (Apache2 vhost as it's easy for me)

Python version is:

When push large files I receive error:

Tried realy hard whole day that and another tweak and advice but no luck :/

Some one with smtar advice ?

PS: Also tried to clone old >> push new some repos and not good again

asked Sep 13, 2019 at 7:08

user avatar
TopperTopper

10333 bronze badges

xargs -0r chmod 644

The other possibility with permissions is that you might get a completely empty window when you try to load the script. In this case, it's likely that your access permissions are too permissive. Apache's subsystem won't execute a script that's group- or world-writable, for example.

Your web server may be configured to disallow execution of CGI programs in your per-user web directory. Here's Apache's default per-user configuration from my Fedora system.

<Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory>

If you find a similar-looking group in your Apache configuration, the directive to look at inside it is . Add to the end of this list if it's missing, and restart the web server.

If you find that Apache serves you the text of the CGI script instead of executing it, you may need to either uncomment (if already present) or add a directive like this.

AddHandler cgi-script .cgi

The next possibility is that you might be served with a colourful Python backtrace claiming that it can't import a -related module. This is actually progress! The server is now capable of executing your CGI script. This error is only likely to occur if you're running a private installation of Mercurial, instead of a system-wide version. Remember that the web server runs the CGI program without any of the environment variables that you take for granted in an interactive session. If this error happens to you, edit your copy of and follow the directions inside it to correctly set your environment variable.

Finally, you are certain to be served with another colourful Python backtrace: this one will complain that it can't find . Edit your script and replace the string with the complete path to the repository you want to serve up.

At this point, when you try to reload the page, you should be presented with a nice HTML view of your repository's history. Whew!

To be exhaustive in my experiments, I tried configuring the increasingly popular web server to serve the same repository as I described with Apache above. I had already overcome all of the problems I outlined with Apache, many of which are not server-specific. As a result, I was fairly sure that my file and directory permissions were good, and that my script was properly edited.

Once I had Apache running, getting to serve the repository was a snap (in other words, even if you're trying to use , you should read the Apache section). I first had to edit the section of its config file to enable and , both of which were disabled by default on my system. I then added a few lines to the end of the config file, to configure these modules.

userdir.path = "public_html" cgi.assign = (".cgi" => "" )

With this done, ran immediately for me. If I had configured before Apache, I'd almost certainly have run into many of the same system-level configuration problems as I did with Apache. However, I found to be noticeably easier to configure than Apache, even though I've used Apache for over a decade, and this was my first exposure to .