TracNav
Development pages
Running Transifex
Trac resources
Other
Development Workflow
Common workflow
The usual workflow we use to add features is the following:
- Grab the code by cloning one of the repos (usually the mainline one).
- Code/fix something following the guidelines.
- Write unit tests for each feature/bug.
- Run make test to make sure the new code didn't bring any regressions.
- If the patch is not small or trivial, put it up for review at http://review.transifex.org/
- Commit.
- Repeat 2-4 often (small features, often commits). Pull often to make sure merging is OK.
- Once it's ready, let us know (eg. directly email the changeset to the mailing list (hg email), bundle it (hg bundle) and send the email manually, or push it to a public repo of yours and let the group know).
- Someone will review the changes and push them to the main repo.
For a public hg hosting service, take a look at bitbucket or freehg.
Coding style
See the Docs.
Discussing development
The development discussion group is transifex-devel. To receive updates on code checkins and ticket modifications, subscribe to the transifex-updates group, which you can use to comment on the development.
Mercurial Setup
Name and email
Setup a name and an email address, and some common locations.
~/.hgrc: [ui] username = A Contributor <contributor@example.com> [paths] txo=http://code.transifex.org/mainline/
Extensions
You can enable some pretty useful extensions:
- hgk: hg view opens a nice graphical history tree (see http://www.selenic.com/mercurial/wiki/index.cgi/HgkExtension)
- graphlog: hg glog is an enhanced hg log that displays the history tree using asciiart (see http://www.selenic.com/mercurial/wiki/index.cgi/GraphlogExtension)
- patchbomb: you can send patches with hg email command (see http://www.selenic.com/mercurial/wiki/index.cgi/PatchbombExtension)
- extdiff: use an external program to view diffs, eg. hg extdiff -p /usr/bin/meld (see http://www.selenic.com/mercurial/wiki/index.cgi/ExtdiffExtension)
~/.hgrc: [extensions] hgext.hgk= hgext.graphlog= hgext.patchbomb= hgext.extdiff=
Setup patch sending
The patchbomb extension enables sending patchsets via email. You have to setup some information to the global hgrc file.
~/.hgrc: [email] method = smtp from = A Contributor <contributor@example.com> cc = Transifex devel list <transifex-devel@googlegroups.com> [smtp] host = smtp.gmail.com tls = true username = <your username> password = <your password>
You can now send a patch/patchset with:
- patch: hg email --inline --diffstat --to a-maintainer@transifex.org --rev tip
- patchset: hg email --inline --diffstat --to a-maintainer@transifex.org --rev 250:252
To import a patchset, save the file somewhere on your system and use hg import to add the changesets in a tree of yours. This will have the same effect as running hg pull from a repo with those patchsets.
In general we prefer to send single patches on the list and push to a separate repos for more than a few changesets.
Setup Review Board sending
The mercurial-reviewboard extension enables sending review requests of patches directly to http://review.transifex.org. For doing it, you have to setup some information to the global hgrc file, besides downloading the extension.
Check out the source code of the extension with this commands:
mkdir ~/sources cd ~/sources hg clone https://mercurial-reviewboard.googlecode.com/hg/ mercurial-reviewboard
After that enable it in your hgrc file:
~/.hgrc: [extensions] reviewboard = ~/sources/mercurial-reviewboard # it needs to be the repo dir [reviewboard] server = http://review.transifex.org/ user = <user> # your user at http://review.transifex.org/ target_groups = transifex
For sending a review request to Transifex's Review Board, after you commit something on tip of your local repository, do the following:
hg postreview tip
When you receive some comments to change, you can do the following to update your patch:
hg qimport -r tip <Do changes> hg qrefresh hg qfinish -a # Update your review request: hg postreview -p -u -e <number_review> tip
Colored diffs
To produce colored diffs, you can install the 'colordiff' package and configure hg to use it.
~/.hgrc: [defaults] # suppress noisy extdiff header message cdiff = -q [extdiff] cmd.cdiff = colordiff opts.cdiff = -uprN
Simple patch sending
Once you fix something, you can send a simple patch to the maintainer or the mailing list. Even better, you can commit the patch and send the committed one. The latter is preferred, as your name will appear in the commit message and the maintainer can more easily import your patch.
To do so, setup your name in ~/.hgrc as descibed in #Nameandemail. Then commit your fix and package it in a 'bundle', as follows:
hg clone ... (fix something) hg commit -m 'bugfix: Foo should be bar and not baz' hg bundle mycommit.bundle
Attach the bundle on an email and send it to a maintainer, CCing the list. He'll be able to simply run hg import and your commit will be implanted in his repository.
Sample committer workflow
$ cat pub/.hg/hgrc [paths] default = ssh://opendev@code.transifex.org/repos/tx/mainline/ bitbucket = ssh://hg@bitbucket.org/glezos/transifex/ [hooks] changegroup.default = hg push default; hg push bitbucket; firefox http://code.transifex.org/mainline $ hg -R pub $ hg clone pub f-foofix $ cd f-foofix $ hg pull https://glezos@bitbucket.org/diegobz/transifex-django/ $ hg view & <test> $ hg out ../pub $ hg push ../pub
Sample deployer workflow
$ cat yourbranch/.hg/hgrc [paths] default = ssh://username@domain/repos/txnet $ cd yourbranch $ hg pull $ hg pull ../pub $ hg view $ hg merge && hg commit -m 'Merge' $ hg push $ ssh -t username@domain su - # cd /srv/devel/tx-django # hg pull ~username/repos/txnet # hg up <additional steps: see below> # service httpd reload If evolution is needed: # python manage.py evolve --settings=settings_evolve --hint # python manage.py evolve --settings=settings_evolve --hint --execute For Amazon S3, if new site_media exist: # cd site_media # find | python ../transifex/misc/update_s3.py
