Free and Open Source real time strategy game with a new take on micro-management

Mercurial

From Globulation2

Revision as of 13:16, 21 August 2010 by Giszmo (talk | contribs)
Jump to: navigation, search
Main User Resources: User Manual | Frequently Asked Questions | Map editor guide | YOG
Game specific arguments: Resources | Buildings | Units | Combat | Flags and special areas | Farming | Graphs | Statistics | Prestige | Fruit and conversion
Building from Sources: Git | Compiling

Browsing the Project Repository

At http://hg.globulation2.org/ you can browse through the repository.

Tools

hg
To really access a mercurial repository you need mercurial. You can get it from your distribution if you are running Linux or from the mercurial homepage.
tortoise-hg
To generally access hg repositories at a file system level you might want to use a GUI. Tortoise-HG is just great for that.
HGE
The mercurail plugin for Eclipse is another great way to navigate our repository. You need Eclipse (the CDT-version) and can then get HGE by going to help -> install new software... -> Add... -> Location = http://cbes.javaforge.com/update -> checking mercurial eclipse ...

Getting a Copy of the Mercurial Repository

NOTE: FEEL FREE TO VISIT THE MERCURY MAN PAGE ONLINE since it not available with all shell.

Anonymous Mercurial Access

See the Mercurial sources download instructions

Pushing changes via HTTPS

Member access is performed using the Mercurial over HTTPS method. Access can be given by providing User:Nct with a username and password by emailing him at stephane [at] magnenat [dot] net.

When you have commited changes locally (hg commit --message="what you have changed"), you can push the changes to the server using:

hg push -r branch https://hg.globulation2.org/glob2-new/

(change "-r branch" to the branch you wish to commit to, for example "-r default")

Mercurial Newbies

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.

  • A tag name is associated with a revision ID number.
  • A branch name should represent the tipmost revision of that branch.
  • The special tag "tip" is always identifies the most recent revision.

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.)

HINT for Tags name & branch: Since tag names have priority over branch names during revision lookup, using an existing branch name as a tag name is discouraged.

Tag and branch names must not contain the ":" character.Note that because revision numbers may be different in different repository clones, the branch tip may be different in different cloned repositories.

For Further details please visit the HG MAN PAGE.

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:

  • Branch from a revision other than the tip of your local repository:
hg revert --all -r <revision from which you want to branch of>
hg branch <branchname>
hg commit -m "message"
  • Cloning from a branch:

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>
  • Pulling from a branch:

'Ppulling is implicitly engage when -r option is set within the clone command.

hg pull -r <branchname> <location of the repository>
Misc