Windows registry key which describes install location of this tool. Mercurial will search for this key first under HKEYCURRENTUSER and then under HKEYLOCALMACHINE. (default: None) regkeyalt An alternate Windows registry key to try if the first key is not found. The alternate key uses the same regname and regappend semantics of the primary. Setting up a Mercurial server under IIS7 on Windows Server 2008 R2 This guide walks you through setting up a Mercurial server under IIS7 on Windows Server 2008 R2. Note: This post uses Mercurial 1.4.3 and Python 2.5.4, although this process will also work with Mercurial 1.5 and Python 2.6.4.
Applies to
Summary
This article describes how to link a SQL Server database to a Mercurial repository. Since a Mercurial repository can be accessed in various ways (using different protocols), we’ll go through these cases one by one.
Quick tip: When working with Mercurial, it is a requirement to have a Mercurial command-line client installed on the same machine where ApexSQL Source Control is installed. Any of the source install, Inno Setup Installer or MSI installer contains the command-line client, as well as TortoiseHg executable. No additional configuration is required after the installation |
Description
The following protocols will be used: File, HTTP, HTTPS and SSH.
To link a database to a Mercurial repository, follow the common steps through the Source control setup window. These steps are covered in the How to link a database to source control article.
Note: The information describing the steps common to all source control systems is not included in this article.
The goal of this article is to cover various ways of linking a database to a Mercurial repository with a focus on specific information (parameters) that should be used in the Source control setup window depending on the used Mercurial repository.
The first step in order to link a database to any Mercurial repository is to make sure that the Mercurial item is selected in the Connection type tab from the Source control system drop-down list:
When Mercurial is selected in the first tab, the System login tab is as follows:
Install Mercurial
Linking a database to a Mercurial repository using the File protocol
To demonstrate how to link a database to a Mercurial repository hosted by the local file system, TortoiseHg will be used. TortoiseHg is a free Mercurial client that integrates into Windows as a shell component. This means that a folder on a local file system can be created and, in a few clicks, initialized as a Mercurial repository.
Quick tip: In addition to TortoiseHg, any other Mercurial client can be used to initialize or clone a Mercurial repository |
In order to use a local folder as a Mercurial repository, it has to be either initialized or a remote Mercurial repository needs to be cloned to a local folder. To initialize a Mercurial repository, we’ll create a folder on a local file system, called MercurialRepo and while the folder is opened, right-click to bring up the context menu. If TortoiseHg is installed, there should be a menu item called Create repository here:
This option opens the New repository dialog:
Clicking the Create button will initialize the selected folder as a Mercurial repository.
As shown in the New repository dialog, there is a Mercurial command that can be executed to initialize a folder as a repository, instead of using the context menu option. In this specific case, a command is as follows:
hg init –config=hooks.post-init.thgskel=python:tortoisehg.util.hgcommands.postinitskel “C:UsersMaraDesktopMercurial”
Either by using the context menu in Windows Explorer or a command executed through the CLI, the result will be a folder structure which represents a mercurial repository:
Quick tip: The Mercurial command-line component comes with the TortoiseHg installation. However, it can be installed as a separate component |
Once the repository is initialized, we can link a database using the full path as a parameter for the Repository field in the System login tab:
Quick tip: Besides initializing a repository, a remote repository can be cloned to a local file system and used in the same way as the initialized one |
The following command will clone a remote Mercurial repository in a local folder:
hg clone https://SQLDev@bitbucket.org/SQLDev/remotemercurial
Username and Password
When working with a local file system, a username and password are not required in most of the cases, since the current user will have the necessary permissions and the folder selected to be a Mercurial repository will not be password protected. By default the username and password are not mandatory when working with Mercurial over the File protocol:
Project
The Project field allows the user to create a separate folder/project for any database (which is recommended), directly from the Source control setup window and without the need to switch from SQL Server Management Studio to any other application. To browse for the existing projects, use the Browse for folder button to open the Choose project dialog:
Quick tip: When creating a Mercurial project inside the repository, it is mandatory to provide a description |
Linking a database to a Mercurial repository using HTTP and HTTPS protocols
To show how to utilize HTTP and HTTPS protocols, we’ll use Bitbucket.org as an online Mercurial repository service.
When the new Mercurial repository is created, the following URL will be available:
https://<username>@bitbucket.org/<username>/<repository_name>
For instance, if the username on Bitbucket.org is krusho and a repository that is created is mercurial_1, the following is the URL that will be generated:
https://krusho@bitbucket.org/krusho/mercurial_1
To link a database to the remote repository, its URL must be provided as a parameter for the Repository field under the System login tab:
Quick tip: Some online Mercurial repository hosting services require an account username and a password for authentication, while others require an email in combination with a password for the user account |
Linking a database to a Mercurial repository using SSH protocol
Detailed steps on how to generate SSH key pair as well as how to add a public key to a Bitbucket.org repository are described in the How to link SQL Server database to a Git repository article.
Once the key is added, a generated SSH URL can be used along with the specified passphrase instead of a password that is used for HTTP(S) URL:
Q: Is it possible to link a database to a repository that is on a machine in the same domain as the machine where SQL Server Management Studio and ApexSQL Source Control are installed?
A: Yes, if the machine where the Mercurial repository is hosted is in the same domain as a machine where ApexSQL Source Control is installed, a database can be linked either using Windows credentials or without them.
Q: What happens if a description for the created project inside the Mercurial repository is not specified?
A: A validation message appears informing the user that a description is mandatory when creating a new project.
Q: How can I update the password for linking a database, if it is changed after a database is linked?
A: Unlinking a database and linking it to the same repository allows the user to specify a password in the final step of the Source control setup window. Instead of using the saved password, specify a new one and proceed with the linking process.
Related posts:
Declan Sciolla-Lynch held a session at LS 12 AD102 about how to setup a RedMine Server for Mercurial.
I needed to see if there where a way to setup a Mercuial repository server that could run on windows it could probably run on other operating systems also but I haven’t tested any other.
If found scm-manager a java server that could handle Mercurial, Subversion and Git the best part of this server is that it has a .war file container to you could deploy it in websphere if you have this setup.
But it can also be used with Tomcat and that setup is what I will show you today.
Follow the Notes in 9 video 041 Source Control on how to setup the designer to use the Mercurial plugin.
1. Download SCM-Manager it’s the scm-webapp-1.12.war that you want to download
2. Download Tomcat 7 click on the appropriate version for your server.
3. Unzip the tomcat zip file to a folder of your choice
4. Open up the Tomcat-users.xml in the conf subfolder
here you add your admin user add the following rows
in the tomcat users section
This will add a user called admin with the password admin (select your own password)
Save the file
5. Open a commadn prompt goto the bin folder beneath the tomcat folder
Install Mercurial Linux
Write service install This will add tomcat to run as a service.
Start the service
6. Open up a webbrowser http://127.0.0.1:8080
The tomcat main page opens up
7. Click on
9. Scroll up scm should now be in the list of deployed applications
10. Click on /scm-webapp-1.11 this is now your url to the repository
11. You will now be asked to login to the SCM Manager
Use scmadmin and password scmadmin
12. Click on Repository Types in the Right Navigation beneath Config
13. All the Mercurial fields are blank when you look at them
Click on Start Configuration Wizard to configure them.
in the dialog box select Download and Install
When the configuration is done. Click on Save.
Mercurial For Windows 10
14. You need to restart Tomcat or SCM-Manager to get the Mercurial as an option when creating repositories.
15. Login to SCM-Manager again and create a user
16. Create a repository and select the type a mercurial.