DVCS with a Windows central repository

前端 未结 7 559
悲哀的现实
悲哀的现实 2021-01-30 04:54

We are currently using VSS for version control. Quite few of our developers are interested in a distributed model (And want to get rid of VSS). Our network is full of Windows ma

7条回答
  •  独厮守ぢ
    2021-01-30 05:03

    After reading Mikko's Answer which almost worked for me, I came up with my own notes for installation. My setup was designed to be a "non protected and open" repository that members of my team could use installed on a Windows 2008 Server.

    1. Install Python.

    The version of Python I used was Python 2.6.2 and I used the Windows x86 MSI Installer.

    • Install for all Users.
    • Install to C:\Mercurial\Python
    • Use Default Feature Options.

    2. Install MinGW.
    The version of Minimalist GNU for Windows I used was MinGW 5.1.4

    • Install the MinGW-5.1.4.exe.
    • Choose the Download and Install Option.
    • Choose the Current Package Option to Install.
    • For the Components to Install Select the "Minimal" option.
    • Install to C:\Mercurial\MinGW

    3. Modify your path.

    You need to add in locations to your environmental path at this point.

    • Add 'C:\Mercurial\Python26;C:\Mercurial\MinGW\bin' to the path (Order Matters.)

    4. Install Mercurial.

    The version of mercurial that I used was the latest release in the stable branch and I did not use the binaries, but used the source code. I wanted to compile mercurial myself so that it would work with whatever version of Python I had installed so I didn't have to worry about any compatability issues which I found to be the biggest challenge with other install methods. The easist way to get the source is by downloading the "zip" file. Mercurial Stable Release

    • Extract Zip File to C:\Mercurial\Source.
    • Build the Source at command prompt.
    python setup.py build --force -c mingw32
    python setup.py install --force --skip-build

    5. Modify your path.

    You need to insert into your environmental path another location for the 'hg' command.

    • Add 'C:\Mercurial\Python26\Scripts;C:\Mercurial\Python26;C:\Mercurial\MinGW\bin' to the path (Order Matters.)

    6. Create your Config file.

    You need to have a default user name set if your going to do any commits locally on this server.

    • Create file '"C:\Documents and Settings{username}.hgrc"'
    [ui]  
    editor = Notepad  
    username = your_name 

    6. Test your Install.

    Open up a new command window and test with 'hg debuginstall' to validate. You should see something like the following.

    Checking encoding (cp1252)...  
    Checking extensions...  
    Checking templates...  
    Checking patch...  
    Checking commit editor...  
    Checking username...  
    No problems detected  
    

    7. Setup Web Directory.

    • Create Directory 'C:\Mercurial\Web'
    • Copy the hgwebdir.cgi file from the 'C:\Mercurial\Source' to 'C:\Mercurial\Web'

    8. Configure IIS7 for Centralized Repository.

    I used the DefaultAppPool which is using .Net 2.0, Pipeline=Integrated, Identity = ApplicationPoolIdentity.

    • Ensure CGI features are available in IIS7.
    • Control Panel/Programs/Windows Features/IIS/App Development Features/CGI
    • Add App into IIS on the Website you wish.
    • Alias=Mercurial -- Physical Path=C:\Mercurial\Web
    • On the App select HTTP Modules and add a new Module Mapping.
      • Request Path=*.cgi, Module=CgiModule, Executable=C:\Mercurial\Python26\python.exe %s, Name=Mercurial.
      • When Prompted to add entry to ISAPI and CGI restrictions list say yes.

    9. Test your Web Setup.

    You should now be able to browse http://localhost/Mercurial/hgwebdir.cgi and see and empty repository list.

    10. Configure IIS7 for Friendly URL

    I did not like having the unfriendly URL and this step allows us to remap the URL to something more friendly. Install the URL Rewrite Moduel 1.1 Extension for IIS.

    • On the Mercurial IIS Application in IIS Manager featurs View select URL Rewrite Component and install a new Rule.
    • Choose Add Rules, then the Template 'Rule with rewrite map.' Rule Action=Rewrite, Specify Rewrite Map=Mercurial
    • Add a mapping Entry. OriginalValue='/Mercurial/Repo', New Value='/Mercurial/hgwebdir.cgi'

    11. Create Mercurial Repository

    You can now create a test repository.

    • Create a Directory C:\Mercurial\Repository and ensure IUSR account has the permissions to write to the directory. (If on Domain account is more like IUSR_{ComputerName}.
    • Create file C:\Mercurial\Web\hgweb.config to list the repositories.
    [paths]
    / = C:\Mercurial\Repository\**
    • Add a directory C:\Mercurial\Repository\Test and initialize the repository with 'hg init'

    ** If you want now to be able to push without ssl create in the .hg directory of the repository a hgrc file the following lines.

    [web]
    allow_push = *
    push_ssl = false

    References:

    Mercurial Wiki Windows Install
    HG Book
    Step by Step
    Publishing Mercurial Repositories

提交回复
热议问题