How to set up a Mercurial Project
What I need
Hello and Welcome to my Mercurial Tutorial. In this tutorial I will be explaining how to start up a project with Mercurial and Bitbucket. Mercurial is one of those things that wont mean much to those less tech savvy people. But Hopefully by the end of this tutorial you will be a master in creating and setting up a Mercurial project on your own!
What is Mercurial? is Source Control for your code.
What can it do for me? Have you ever worked on a document for school or work and lost it because there was nothing to back it up? Have you ever worked on a document with a group of people and then had to patch it together, and found out it was a hassle to get it to flow nicely? Mercurial does this all for you except for computer coding languages. If you have multiple people working on a similar project, it keeps track of the code and line spacing you have modified. It then seamlessly patches your code with someone else's additions once you decide to merge.
What is BitBbucket? Bitbucket.org is a company that will let you back up your code using SVN, Mercurial or Git. Which are all different types of source control programs. Bitbucket allows you to store your code on there privately or publicly and allows you to manage who can do what with your code.
Now that we have addressed a few questions, let us proceed.
Getting started with Bitbucket.org
First before we do anything else we need a Bitbucket account. Do so by going here for the free 5 users plan. You can have as many repositories as you want, but only 5 users on 1 private repository
Once you have created your account you will be brought to a blank page with absolutely nothing interesting on it what so ever. Get a feel for the site a little bit and I will go over a few of the things that I have highlighted in the picture on the right.
Green: This is your news feed. As you find people to collaborate with you may want to follow them to find out what new projects they are currently developing. This will keep you updated as things happen.
Cyan: This is where all your created repositories are shown. You can tell if they are private or not based on if the lock is showing in color. You can also tell if you are following your project updates based on the heart next to it. If the heart is showing, you will receive information in you news feed every time something has been done to your repository. There is also an add new repositories button. This can be accomplished by clicking on the green plus sign.
Purple: This is where your "currently participating" repositories are showed. These also show a heart next to them to show if you are following on their updates. There is also a padlock to show if the repository is private.
Creating a Project
Name: The name you would like to have on your repository.
Private: Make this repository private or public for others to view.
Repository Type: The type of Source control you are going to be using.
Language: The type of Coding language you will be using.
Issue Tracking: This is useful if you would like the public or your team to keep track of issues or future plans. Great for ticket help and status updates.
Wiki: Enables having a Wiki on your project. Great for explaining what your project does and how to operate it.
Description: Describe your project
Website: Company or project website
Getting started with a project on Bitbucket is really simple. If you look in the cyan highlighted area that was described in the last section, you will find a green plus sign. Click that.
After that you are brought to this page. This is where you can create a new repository or import some existing code. In this tutorial we are going to be creating a new repository from scratch and creating our project in the new repo.
Fill out the form and select the appropriate language for your project and click create repository.
The great thing about Bitbucket is they have tons of resources. They don't just leave you in the dark, there is a complete wiki just for people that need help getting started. You can find these resources here: Clicky
Clone: Clones the repository using the URL provided by Bitbucket
Create Repository Here: Creates a new repository with out the need of websites like Bitbucket. (Code will not be backed up on the server, but it will start the repository)
Explore Extension Settings: Gives you the settings for extensions
Global Settings: Global settings that will be applied to every repository that you access.
Update Icons: Updates the icons if you have changed the layout of them
We are going to leave Bitbucket for now and move on the meat of this tutorial. For this next part you will need to download Mercurial Hg. You can do so by clicking this link here: Clicky. Click the big blue button on the right of the page and you will begin to download the appropriate package for your OS.
(Please note the rest of this tutorial is going to be focusing on Windows OS. I don't currently own a mac.)
Once the download is complete click on the package and install the program using all the pre-configured settings. Once this is complete it may request your computer to be restarted as this puts a menu option when you right click.
URLs for projects
Alright we have our project on Bitbucket! Take a break, this is a lot of reading. Go grab a sandwich and a glass of 2% milk. Once you have done that come back here and we will continue.
You ready then? Sweet!
This next section is about URLs. This is fairly simple to understand. The URL is highlighted in a cyan box. If you will notice there is two links, One called HTTPS and SSH. If you are on Windows You will be using HTTPS. This is the one I will be using for this guide.
The URL is made so that you can upload/download your project files from Bitbucket. When using the Clone option, the URL goes in the Source textbox.
TLDR (To the Point)
- Create an account on Bitbucket if you don't have one already.
- Create a project by clicking the green plus sign on the mid top right section of the page.
- Name the project and fill out all the inappropriate information, adding or removing all the features needed.
- Download and install Mercurial if not already installed.
- Find a folder you would like to have the project in.
- Right click in some white space so that you can find the Mercurial options under Tortoise HG
- Copy the link you get from the Bitbucket repository (be sure to get the HTTPS, You do not need "hg clone" just the https://blablah.bitbucket.com)
- Paste the URL into the source section of the Clone option.
- Click ok - it should ask you for your Bitbucket password and depending on the connection string it will ask for your Bitbucket username.
After you have cloned your project into a projects folder you should now be ready to start committing the code and updating to the server. If there is anything on here that is unclear and needs to be clarified. Please let me know. I will also answer any questions that I know how, on here if any come up. I hope this guide has been useful and be sure to check out my other guides by visiting these thinks: