[Coco] making patches to NitrOS-9 (part I)

Tormod Volden lists.tormod at gmail.com
Wed Jan 22 15:28:13 EST 2014


Dear NitrOS-9 contributors,

Mercurial (hg) seems to put many off, but can really be of good help
to us all. There is lot of documentation around, for instance
<http://hgbook.red-bean.com/>. However, I will outline some of the
basics to get you going.

1) How to make a patch the simplest way

You have cloned the repo, pulled and updated it. Now you have made
some modifications that you want to share with others. Simply type:
 hg diff
and it will list your changes as a patch. To make a patch file, type:
 hg diff > my_little_change.patch
Now you can send this file to others, for instance to a maintainer who
will commit this to the repository for you.

2) How to undo your changes

To bring a file back to the repo version (or last commit), type
 hg revert filename

3) How to apply a patch

If you have a patch file and want to apply it to your working tree, run
 patch -p1 < some_change.patch
The changes will now appear when you run "hg diff".

If you want to undo this patch, but don't want to rewind the file back
to the repo version with "hg revert" (because the file has other
changes that you want to keep), you can apply the patch in reverse:
 patch -R -p1 < some_change.patch

4) How to check the status of your repo

At any time type "hg status" to see which files you have modified
(indicated by "M") or added to your local working directory tree.
Files that are only added to your local directory will not be included
in "hg diff".

"hg summ" gives a summary of what the latest commit is, which branch
you are on and statistics on modified or new files. It will be even
more useful later.

5) Conclusion

Run "hg diff" and "hg status" all the time. It makes it easy to see
what changes you did and helps you avoid adding something unwanted to
your patches.

Next part will be about using the mercurial "mq" extension to keep
track of several patches. If you can't wait, see for instance
<http://hgbook.red-bean.com/read/managing-change-with-mercurial-queues.html>
or <http://mercurial.selenic.com/wiki/MqExtension>.

Regards,
Tormod



More information about the Coco mailing list