ContributingCode.wiki
author sheepluva
Thu, 14 Jan 2016 20:26:42 +0000
changeset 720 03def791ae0b
parent 718 e4e1597f6b84
child 721 76c078df2785
permissions -rw-r--r--
Edited via web interface
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
718
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     1
#summary Useful hints for contributing code to Hedgewars
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     2
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     3
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     4
*Table of Contents*
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     5
<wiki:toc max_depth="2" />
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     6
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     7
= Introduction =
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     8
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
     9
You want to contribute code to Hedgewars? That's great! Here are some hints how to help us with importing your code.
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
    10
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
    11
= Recommended workflows =
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
    12
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
    13
== Using a mercurial clone ==
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
    14
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
    15
TODO
e4e1597f6b84 New Page: ContributingCode
sheepluva
parents:
diff changeset
    16
720
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    17
=== Creating a (named) branch ===
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    18
We prefer not to use (named) branches for little patches, as branches are permanent and will clutter the list of {{{hg branches}}}.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    19
So for small code contributions, use unnamed branches instead (see below).
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    20
However, if you are going to write code that is more a pro#summary Useful hints for contributing code to Hedgewars
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    21
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    22
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    23
*Table of Contents*
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    24
<wiki:toc max_depth="2" />
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    25
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    26
= Introduction =
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    27
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    28
You want to contribute code to Hedgewars? That's great! Here are some hints how to help us with importing your code.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    29
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    30
= Recommended workflows =
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    31
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    32
== Using a mercurial clone ==
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    33
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    34
TODO
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    35
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    36
=== Creating a (named) branch ===
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    37
We prefer not to use (named) branches for little patches, as branches are permanent and will clutter the list of {{{hg branches}}}.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    38
So for small code contributions, use unnamed branches instead (see below).
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    39
However, if you are going to write code that is more a project than a patch and that will take dozens of commits, feel free to use a (named) branch.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    40
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    41
To create a new branch use {{{hg branch}}} followed by the name of the new branch, before committing the first code.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    42
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    43
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    44
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    45
=== Using unnamed branches ===
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    46
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    47
Unnamed branches a.k.a. topological branches, are when the history of commits within a branch (e.g. "default") splits up into  alternative chains of commits.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    48
These alternative chains will have more than one {{{head}}} (at the the end of each chain) within the same branch, until they will be merged back together into a single chain.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    49
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    50
In order for us to be able which bugfixes/features of you we merge into the official repository, you should put each in a separate "unnamed branch" as described above.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    51
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    52
Make sure that the first commit of each bugfix/feature commit set is based on a commit from the official repository, that way your bugfixes/features will not depend on the commits of each other and can be merged into official individually, as needed.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    53
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    54
That means: *Before you start writing code towards a new bugfix/feature, make sure to {{{hg update}}} to a revision from the official repository.*
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    55
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    56
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    57
In newer versions of Mercurial you can give those unnamed branches a "local" and removable name using {{{hg bookmark}}}.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    58
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    59
You can see example of how unnamed branches and bookmarks are used best [http://hg.hedgewars.org/hw-example-clone/graph here]
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    60
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    61
ject than a patch and that will take dozens of commits, feel free to use a (named) branch.
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    62
03def791ae0b Edited via web interface
sheepluva
parents: 718
diff changeset
    63
To create a new branch use {{{hg branch}}} followed by the name of the new branch, before committing the first code.