Go to bitbucket.org - make an account. Make sure to use your.edu email address so that you get a free unlimited account. In bitbucket, create a repository. Make sure to mark it private. Make sure to make it a Mercurial one and not a Git one. The language doesn't really matter a whole lot - but will help with syntax highlighting when viewing code on the web. You can make one locally and then add it to the server, but the steps are more complicated. Go to your desktop. Right click and then tell TortiseHG to set up a clone. Get the URL from your repository. It should look like: https://bitbucket.org/yourname/y ourproject/ Don't include the last part (overview or src or whatever page you are looking at).
Use that as the source. Destination can be wherever. To match the rest of this document, make sure the folder name is mysample You should end up with a new folder, empty except for the.hg repository files. Make a new QT Creator Project and create it in that folder:
You can tell QT to add the files immediately to version control. If you don't do it now, you can easily do so later. You can also just drag an existing project into the mysample folder. Go ahead and build your project so that we can practice ignoring the build product. Open up the Hg Workbech by right clicking in explorer - do this in the mysample folder to automatically open it in the workbench.
You should see something like this on the sample repository. Green files are already added. Pink files are not a part of the repository. Nothing here is final until we commit. First we want to ignore some files. Right click the Makefile and hit Ignore. You will be asked if you want to add a.hgignore file. Yes you do. First, we want to specify to ignore all Makefiles. Enter the pattern shown to the right *Makefile* Says anything that possibly has any text (*), followed by "Makefile", possibly followed by any other text (*). Clicking add should make the Makefiles disappear from the Untracked files list. Now add the patterns: *.o *.exe *.pro.user Once again, * means "any string". So anything ending with.o,.exe or.pro.user will be ignored.
Note that the.hgignore is just a plain text file - you can edit it by hand with a text editor. Close the ignore dialog. Now your only files to worry about should be the.cpp,.pro and.hgignore. Check them all to indicate that you want to include these changes in the first commit. If you want you could only check the.ignore, and check it in as one change, then do the.cpp and.pro as a separate change. Type a message about what you are committing and hit commit. You will likely be asked to identify yourself. Just fill in the username field of the Commit settings. You can put anything you like - this is the name that gets stored with the commit it does not have to match your actual bitbucket account. Now push your changes to the server.
Go log into bitbucket and find your repository. Examine the source there. Go back to the desktop and clone the repository again (we want two copies of it). Clone this copy to mysample2 folder. The new repository should have the exact same code as the first.
Open up the project in mysample Make a change to the code. Save the changes. In the workbench, under mysample, make sure you are on the Working Directory. You should see main.cpp has changed and shows up in blue at the bottom. If you do not see it, refresh (F5). Make sure it is checked, add a commit message and then hit commit to save it. Push the commit to the server. In the workbench, switch to mysample2. It does not have the change yet. Hit the Pull button to get the change from the server.
It will show up as a new branch. The "Not a head revision" on the main branch means that any changes you have made in mysample2 are not checked in. Right click on the new branch and Update to it. Go check mysample2 folder. It should have the new version of the code. Other things to try: Make some changes in mysample2, push them to the server, then pull them to mysample Make changes in BOTH mysample and mysample2 (change different lines or files in each). Then commit both and try to push them. When you go to push the second one, you will be told there are new changes available and be forced to integrate your changes with the once from the server. Right click the new branch and Merge it into your changes. Make conflicting changes in both. (Pick two lines of code, change both lines in both copies of the repository). Push the changes from mysample, pull those into mysample2 and then try to merge. You will have to use the KDiff tool to pick the correct version of each change that is in conflict. This link describes how KDiff works: http://naleid.com/blog/2012/01/12/how-to-use-kdiff3-as-a-3-way-merge-tool-withmercurial-git-and-tower-app