Browsing the Project Repository
At https://bitbucket.org/giszmo/glob2 you can browse through the repository.
Getting a Copy of the Mercurial Repository
No matter if you want to contribute with write access or just want to get a read only copy of glob2, you should cd to a directory where you have write permissions and run hg clone:
cd ~/my_hg_repositories hg clone https://bitbucket.org/giszmo/glob2 cd glob2
The same can be achieved using HGE or tortoise-HG.
Which revision to use
Having cloned the repository you now have all the history of glob2 at hands. According to your intents you now might want to choose different revisions to jump to and start working on them. Pick from the subsections what most fits your intents:
If you want to play against others you need the same major version of glob2 as they have. If they have betaX.4 you should pick some betaX version. You get the latest version in the betaX release candidate branch using the tip of betaX-rc. To get there issue
hg update betaX-rc
In rare occasions this version might not work. To get a version that was tagged for being released, check the output of
for lines matching betaX.y and update to the highest y:
hg update betaX.y
If you want to test the latest not yet released version of glob2 you should update to the tip of the latest release candidate (-rc) branch:
hg update betaY-rc
or if a feature freeze was not yet decided on, you can also test the latest version of the default branch:
hg update default
The bug fixer
You might have started as a tester but now want to actually touch code. Now it is getting slightly more complicated. Having found a bug and a solution to it means applying the fix to the right revision. As bugs often are not only bugs of not yet released features but also express in years old versions you should fix the oldest relevant version. If on the download page beta4 is still promoted, you should fix this and merge your changes up to beta5 and finally to default. In hg this is pretty easy to do:
hg update beta4-rc do your changes to the code .... hg commit -m"fixed bug xy ..." hg update beta5-rc hg merge beta4-rc hg commit -m"merge" hg update default hg merge beta5-rc hg commit -m"merge"
Depending on how important the bug-fix was you might now want to directly tag the new versions:
hg tag beta4-rc beta4.X hg tag beta5-rc beta5.Y
The mini-features guy
If you have a new small feature to contribute, you do this in "default":
hg update default do your changes to the code ... hg commit -m"implemented mini-feature xy"
The big-features guy
If you have a new big feature to contribute, you do this in a separate branch starting at "default":
hg update default hg branch fooFeature
work on your feature with a series of
change code hg commit -m"changed this and that"
but while you work on your feature don't miss to get in sync with the changing "default" by doing as follows:
hg pull hg merge -r default hg commit -m"merge"
once your feature is ready to be used in the game just like other features, merge it into default:
hg update default hg merge fooFeature hg commit -m"merged"
All the above was read only from the point of view of the main glob2-repository. If you have changes worth sharing you must make them public. Easiest is to pick one of the free mercurial hosters. If you go for bit bucket you can fork Giszmo's repository. With your own bitbucket setup you can check for what would push
hg outgoing https://bitbucket.org/yourBBNick/glob2
and push your changes there:
Now after you checked all is fine you can ask on the glob2 mailing list for someone with write access to the main repo to pull your changes. Asking on the irc is an option, too but for bigger changes you review might take some time and then it is safer to do it via the mailing list.
Don't forget to change the authors file if it's your first contribution ;)
If you are a regular contributor you may get write permissions for the central repo from Nct. You can mail him your username and password at stephane [at] magnenat [dot] net.
If you've never used Mercurial, you should read some documentation about it; a useful URL is http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart. Using Mercurial is not complex but you have to understand what is going on. The best way to start is to ask a friend to show you the way, or pop onto the glob2 development IRC channel and ask there.
A quick overview of Mercurial
Basically you have to know that there is not total order on a mercurial repository. Each revision except the initial revision has at least one parent. Different revisions can have the same parent(s). A revision will have more than one parent, if and only if it is a merge of those parents.
If two or more revisions share a parent, we have infact different branches in the repository. The new mercurial feature allows to give a revision a sticky tag that is past to almost all its children. Exeptions are merges. If you merge branch A into branch B, this revision will belong to branch B. So when you merge the default branch into a development branch, the result will belong to the development branch. This is good because you can keep track of approved changes, during your development now and then.
Branches might have names, unless you give them a name.Their names don't have to be unique but it is strengthy recommended to don't use an already given name branch to another. So multiple branches were supported all the time. The new feature just allows to name them. You can put the branchname everywhere you can put a revision number. So all commands that have '-r' or '-rev' option accept a branchname too. Mercurial will then search the latest revision in that branch and path its number to the command. (At least that's what I think it does.)
If every branch (named or not) has the same "latest revision", our repository will have exactly 1 head. Otherwise we will have more heads and mercurial will suppose that we merge the heads. But most of the time this would be inappropriate, and we shouldn't do it.
The latest revision is always called tip, and mercurial defaults to think that we want to work on it. This is also very sad, if it does belong to an other branch. I really recomment that you only pull the branch you want to use. You can do this, because the clone and pull commands have a '-r' option. I pull the whole repository on my computer and than pull the branches that I want to work on, from that local repository to different working repositories. I suggest everyone should do this. So there is one incoming repository, one or more working repository and one outgoing repository locally on my computer.
Our "trunk" or default branch is called "default". You can try everything with mercurial locally before pushing to the remote repository.
hg log hg diff hg branches hg heads hg tags hg incoming hg outgoing hg status
are very helpful to get information. Try "hg help" for details.
hg serve //and browsing to localhost:8000
is very good for a graphical overview of the repository structure. If you prefer using a GUI tool, go for Tortoise-HG. And you definitely have to set up a merge tool for those case when you have to merge manually.
Branching of should look like this:
hg revert --all -r <revision from which you want to branch of> hg branch <branchname> hg commit -m "message"
Using -r/--rev (or 'clone src#rev dest') implies --pull, even for local source. repositories.
hg clone -r <branchname> <location of the repository> <name that you want your repository to have>
'Ppulling is implicitly engage when -r option is set within the clone command.
hg pull -r <branchname> <location of the repository>