tgext.mercurial /

Filename Size Date modified Message
146 B
88 B
1.3 KB
139 B
3.0 KB
216 B
50 B
895 B

I. Prerequisites In order to run this extension you will need: - TG 2.0.3+ - Mercurial 1.3.1+ (Windows users should note that mercurial should be installed

as a library, not only the client. More information can be found at For Linux and Mac users an easy_install mercurial should be enough).
  1. Install

During the installation process we'll use the following conventions: * <host_app> - the application in which we will enable the extension. It Should

have repoze.what authentication enabled, as this extension provide a custom predicate.
  • <repos_path> - the absolute path to where the repositories will be stored
  1. Clone the repository from bitbucket. For this you will need mercurial installed.

    hg clone <src_path>

or install using easy_install

easy_install tgext.mercurial

If you install from bitbucket then you will have to cd into <src_path> and run:

python install
  1. Add the configuration file for the hgdir wsgi app
    • create the file <repos_path>/web.ini
    • add the following lines

------------ the configuration file begins here ----------------- [web] push_ssl = false allow_push = * allow_archive = zip,bz2,gz

[paths] / = <repos_path>/** ------------ the configuration file ends here -----------------

The two * are compulsory. Windows users should pay attentions to the way they write the <repos_path>. They should omit the drive letter and the colon. For example:

c:UsersTrudyrepositories** -> UsersTrudyrepositories**

2. Add the necessary configuration lines inside <host-app>/development.ini. Under the [app:main] section add the following lines: hg.warehouse = <repos_path> hg.webini = %(hg.warehouse)s/web.ini

3. Import the necessary classes and functions inside your controller(the default controller should be under <host_app>/controllers/

from tgext.mercurial.controllers.root MercurialController from tgext.mercurial.lib.predicates import public_read_private_push

# inside the main controller class add # its compulsory to name it hg

hg = MercurialController(public_read_private_push())
  1. Add authentication configuration at the end of this file <host_app>/config/

from repoze.who.interfaces import IIdentifier from repoze.who.interfaces import IChallenger

from repoze.who.plugins.basicauth import BasicAuthPlugin

http_auth = BasicAuthPlugin('localhost') http_auth.classifications = {IIdentifier:['mercurial'],


base_config.sa_auth.identifiers = [('http_auth', http_auth)] base_config.sa_auth.challengers = [('http_auth_chall', http_auth)]

from tgext.mercurial.lib.auth import mercurial_classifier base_config.sa_auth.classifier = mercurial_classifier


This extension's stylesheet was developed using clever css. CleverCSS can be installed via easy_install:

easy_install clevercss