1. Environment and required tool installation
1. Installing Python-2.7.9.exe
2. Installing Mercurial-3.2.3.win32-py2.7.exe
3. Installing Mercurial-3.2.3-x86.msi
4. Install tortoisehg-3.3.2-x64 or tortoisehg-3.3.2-x86
5. Install Windows IIS
2. Operation procedure
1. Build a website, create a new folder D:/hgweb
2. Create a new Web site in IIS with the name Hgweb and the physical path pointing to the previous step D:/hgweb
3. In IIS, select the site you just created, select "Handler Mappings" in the features view on the right, as
Syntax for IIS 7.0 or more
Syntax for IIS 6.0
4. Create a new text file under D:\hgweb, rename it to test.cgi (note with the extension), and edit its contents as follows:
print ' status:200 OK '
print ' content-type:text/html '
Print
print '
Save, and then browse test.cgi in IIS:
url:http://localhost/hg/test.cgi
Interface:
If you can see the above interface, the initial configuration is successful, continue.
If you are prompted for an HTTP error 404.2-not Found
The page you requested cannot be provided because of the ISAPI and CGI Restrictions list settings on the WEB server
Open IIS Manager, navigate to the server level, and locate the ISAPI and CGI restrictions in its list of features:
Double-click to open, inside must exist as shown in the line:
If it does not exist, press the "Add" button on the right of the click to fill in:
If it already exists, but is disabled, enable it.
When you are done, retry opening test.cgi, you should see the IT works Word.
5. Create a new text file in the D:\hgweb directory, rename it to hgweb.cgi, and edit its contents in the following sentences:
#!/usr/bin/env python # # An example hgweb CGI script, edit as necessary # See also Http://mercurial.selenic.com/wiki/PublishingRepositories # Path to repo or Hgweb config to serve (see ' HG help Hgweb ') Config = "D:/hgweb/hgweb.config" # Uncomment and adjust if Mercurial is not installed System-wide: #import SYS; Sys.path.insert (0, "/path/to/python/lib") # 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) |
Then create a new text file under D:\Mercurial, rename it to Hgweb.config, and try to browse http://localhost:8080/hgweb.cgi without writing anything. Should be able to see the following interface:
6. Modify Hgweb.config
[Paths] /repositories/= e:/myweb/* [web] BaseURL =/hgweb.cgi Allow_push = * Push_ssl = False |
7. Create a code Warehouse
Create the Test folder under D:/hgweb, and in the folder, create the HG
Visit hgweb.cgi again to see the picture as:
8. Synchronization
Enter HG clone on the computer you want to sync
9. Submit your code
After modifying a file, set the user name to submit user name in Settings
Setup of Hg server under Windows