Mercurial (HG) Server build process record

Source: Internet
Author: User
Tags mercurial

Mercurial (HG) Server build process record

1. Environmental description

Just test build, environment for native development environment: win 8.1 + IIS8.5

Software Preparation:

2. Software Installation

Install Python2.7 First, then install the mercurial Python package, install TORTOISEHG, and finally install the URL rewrite component.

3, in the D set up a data warehouse total directory, such as D:\Mercurial\ Hgweb, all the repositories will be located under this directory.

(Repositories is a warehouse folder, which holds multiple code warehouses.) Here in order to conveniently put D:\Mercurial\ Hgweb path, in fact, can also be placed in other paths, as long as the configuration file in the configuration of the line)

4. Create a website HG under IIS

Double-click Handlers Mappings, a list of actions appears on the right, click Add Managed Handler, a new window pops up, fill in the new window as shown:

5, the D:\Mercurial\ hgweb path under the establishment of hgweb.cgi file, the contents are as follows:

#! D:/python27/python.exe

#

# example FastCGI script for use with Flup, edit as necessary

# Path to repo or Hgweb config to serve (see ' HG help Hgweb ')

Config = "D:/mercurial/hgweb/hgweb.config"

# Uncomment and adjust if Mercurial is not installed System-wide

# (consult "Installed modules" path from ' Hg Debuginstall '):

Import SYS; Sys.path.insert (0, "d:\\python27\\lib\\site-packages\\mercurial")

# uncomment to send Python tracebacks to the browser if an error occurs:

From mercurial import demandimport;

Demandimport.enable ()

Import CGITB

Cgitb.enable ()

#import OS

#os. environ["hgencoding"] = "UTF-8"

From Mercurial.hgweb.hgwebdir_mod import Hgwebdir

Import mercurial.hgweb.wsgicgi as wsgicgi

application = Hgwebdir (config)

Wsgicgi.launch (Application)

Where D:/python27/python.exe is the Python installation path,

Config = "D:/mercurial/hgweb/hgweb.config" (the file to be created next)

D:\\python27\\lib\\site-packages\\mercurial is the Python package path for installing mercurial.

6, again under D:\Mercurial\ hgweb a new text file, renamed to Hgweb.config, the content is:

[Paths]

/repositories/= d:/mercurial/hgweb/repositories/*

[web]

encoding = UTF-8

Push_ssl = False

Allow_read = *

Allow_push = *

BaseURL =/

You can try browsing http://localhost/hgweb.cgi. Should be able to see the following interface:

(because 80 ports have other sites, used here for the 83 port, internal use, so the security issue is not concerned about setting Push_ssl = False)

7. Web. config files are automatically generated when the site is created, open the file with any text editor, and add a rewrite section below the handlers section under System.webserver

1 <?XML version= "1.0" encoding= "UTF-8"?>2 3 <Configuration>4 5     <system.webserver>6 7        <handlers>8 9             <Addname= "Cgihandler"Path= "*.cgi"verb="*"Modules= "CgiModule"ScriptProcessor= "D:\Python27\python.exe-u &quot;%s&quot;"ResourceType= "Unspecified"requireaccess= "Script" />Ten  One        </handlers> A  -       <rewrite> -  the         <rules> -  -           <Clear/> -  +           <Rulename= "hgweb.cgi"enabled= "true"Patternsyntax= "Wildcard"> -  +             <MatchURL="*" /> A  at             <conditionslogicalgrouping= "MatchAll"Trackallcaptures= "false"> -  -               <Addinput= "{request_filename}"MatchType= "Isfile"negate= "true" /> -  -             </conditions> -  in             <Actiontype= "Rewrite"URL= "Hgweb.cgi/{r:1}" /> -  to           </Rule> +  -         </rules> the  *       </rewrite> $ Panax Notoginseng         <Security> -  the             <Authorization> +  A                 <RemoveUsers="*"Roles=""verbs="" /> the  +                 <AddAccessType= "Allow"Users="?" /> -  $             </Authorization> $  -         </Security> -  the     </system.webserver> - Wuyi </Configuration>

This makes it possible to access and http://localhost/hgweb.cgi the same effect directly with http://localhost/.

8. Create a warehouse in repositories with HG

Then it can be in the client clone repository, and push to the server.

You may encounter permission problems when you push, and the workaround:

1) Determine the iis_iusers have read and write D:/mercurial/hgweb folder permissions;

2) Modify the. hg/hgrc file in the warehouse

Add the following content

[web]

Allow_read = *

Allow_push = *

Push_ssl = False

(and it's not quite clear why, there are these configurations in Hgweb.config, what's the difference?) But you can actually push it when you add it here.)

Reference URL:

Http://www.cnblogs.com/Moosdau/archive/2012/03/06/2382769.html

http://blog.csdn.net/delphinew/article/details/5440723

http://bz.selenic.com/show_bug.cgi?id=2954

Mercurial (HG) Server build process record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.