DevelopUim

Muneyuki Noguchi edited this page Mar 22, 2015 · 2 revisions

Introduction

This page describes how to develop uim and contribute to the uim project with Git. The intended audience of this page includes not only the uim committers but also non-committers.

Git Work flow

+----------------+                +------------------+                  +-------------+
|                | ---git pull--> |                  | ---git pull ---> |             |
| uim repository |                | local repository |                  | source tree |
|                | <--git push--- |                  | <--git commit--- |             |
+----------------+                +------------------+                  +-------------+

Cloning the uim repository

To develop uim, create your local repository from the uim repository and move to the source tree in your local repository:

$ git clone https://github.com/uim/uim.git
$ cd uim

See http://code.google.com/p/uim/source/checkout for more details on getting the source tree.

InstallUim describes how to compile and install uim from the source tree.

Setup

Set your name and email address to Git if you plan to commit to your local repository:

$ git config --global user.name <your name>
$ git config --global user.email <your email address>

Committing to your local repository

After changing files in the source tree, you can check your changes to the source tree with the following commands:

$ git status
$ git diff

Commit changed files to your local repository:

$ git add file1 dir1/file2
$ git commit

where file1 and dir1/file2 are changed files.

If you want to commit all the changed files, you can use the following command:

$ git commit -a

Applying changes to the uim repository

For committers

If you are a committer, you can push your changes to the uim repository directly:

$ git push

For non-committers

First, create patches :

$ git format-patch origin

Second,

  • send your patches to the uim-en mailing list. You need to join the mailing list before sending your patches. or
  • send a pull request to a GitHub repository. You need to create a GitHub account before sending a pull request.

One of the committers may push your patches to the uim repository.

Updating your local repository

You can follow changes in the uim repository:

$ git pull

Misc

Working on a stable branch

If you want to create a branch which tracks a stable branch in the uim repository, create a tracking branch:

$ git checkout --track -b x.y origin/x.y

where x.y is the name of a stable branch in the uim repository.

If you made changes to the tracking branch and want to make your changes to the uim repository, push your changes specifying the name of the branch:

$ git push origin x.y

Applying a patch by a contributor

If you are a committer and you want to apply a patch by a contributor to the uim repository, you can use git apply or git am.

If the patch was generated by git diff or diff, use the former:

$ git apply patch-by-contributor.patch

where patch-by-contributor.patch is a patch by a contributor.

If the patch was generated by git format-patch, use the latter:

$ git am patch-by-contributor.patch

Copying a commit from a branch to another

You can commit a change to the master branch which was committed to a stable branch and vice versa:

$ git cherry-pick abcde

where abcde is the change which was committed to one branch and will be committed to another branch.

Using an external repository

You can create an external repository. If you want to create your external repository in GitHub, the operation will be as follows:

$ git remote add github git@github.com:foo/bar.git
$ git push github master

where foo is your GitHub account name and bar is your external repository name.

You can create a topic branch in your external repository without creating it in the uim repository:

$ git checkout -b baz
$ git push github baz

where baz is a topic branch.

Before pushing your changes into the uim repository, rebase the branch and merge the changes into a branch in your local repository:

$ git checkout master
$ git rebase master baz
$ git checkout master
$ git merge baz
$ git push origin master

or just merge the changes into a branch in your local repository without rebasing:

$ git checkout master
$ git merge baz

Translation

Updating translation files

You can update translation files with make update-po:

$ cd po
$ make update-po

Update copyright

Committers should update a copyright line in the source files every year:

$ git ls-files | grep -v '^\(sigscheme\|ChangeLog.old.2\)$' | xargs perl -i -pe 's/\b(20\d\d)([,-\s]+20\d\d)*\s+uim\b/\1-2013 uim/'

where 20xx is the current year.