Quick howto for mercurial

From Yzis Wiki

Jump to: navigation, search

This page will give some examples of how to use mercurial for Yzis development. More information can be found on the official web page for mercurial and on the mercurial book.

The best way to develop for Yzis is to start from a checkout (see Build Yzis for this), and then make your modifications in this source tree. Then, depending on how familiar you are with mercurial, you can contribute your changes in several ways.


The easiest way

You change the files locally, but you never commit. You can see your changes with

 hg diff

When you want to synchronize with the main repository you can do

 hg pull # updates your local repository but does not update the source files
 hg up   # updates the source files

or in one line

 hg pull -u  # same effect as 'hg pull' followed by 'hg up'

Hopefully you wont have any conflicts. A conflict occurs when your modifications appear at the same locations as some other modifications in the main repository. In the case of a conflict, you will need to resolve the conflict (see the mercurial book for details).

When you want to show your modifications, just send the output of 'hg diff', for example in an email or on http://freehackers.pastebin.com/ to show on irc.

The convenient way

If your modifications are large (even if this only for testing) you can commit to your local copy. You can even do several commits. You can still update using

 hg pull -u

But your modifications will be on a different branch. You will need to use the merge command to have a source tree with both modifications

 hg merge # hg merge --help for more help

Ideally, you would use the latest mercurial (at least version 1.1) and use the rebase feature so as not to clutter the history with branches/merge.

 hg pull --rebase

See the page http://www.selenic.com/mercurial/wiki/index.cgi/RebaseProject for more information about this. That's probably what we will use if we integrate a bundle from your repository.


How to send patches

If you want to send patches, to someone (by mail) or to the bugtracker (use the 'Patch submission' tracker), the best way is to send a 'bundle'. A bundle is a file containing the different commit, as understood by mercurial. It makes it more easy to integrate for use as it already contains metadata such as

  • comments
  • commiter s name
  • (mercurial) version against which it applies

To make a bundle, you need to use the 'hg bundle' command. Please refer to the mercurial documentation and/or 'hg bundle --help' for more information about the options.