i18n: Fixed i18n_test by setting the LANGUAGE env variable

When I ran i18n_test, I had failures on 'ja_JP' and 'de_DE' tests. After
a little search, it turns out that gettext was unable to find the proper
mo files. cola's approach to setting up its translation is to set
environement variables and then call `translation()` without a
`languages` argument.

Before this patch, the environment variables we set were "LANG" and
"LC_MESSAGES". However, this is what Python doc for `find()` says:

"""
If languages is not given, then the following environment variables are
searched: LANGUAGE, LC_ALL, LC_MESSAGES, and LANG. The first one
returning a non-empty value is used for the languages variable.
"""

Therefore, non-empty "LANGUAGE" or "LC_ALL" env variables would
mess up our translation.

I've added a line setting "LANGUAGE" (in addition to the two others
already there) and it fixed the tests for me.

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
Merge pull request #231 from hsoft/fix-i18n

i18n: fix i18n test by setting the LANGUAGE env variable

Signed-off-by: David Aguilar <davvid@gmail.com>
doc: add Virgil to the credits

Signed-off-by: David Aguilar <davvid@gmail.com>
modernize: Added "division" __future__ import

Added "from __future__ import division" in every python unit of the
project. Wherever there was division going on, ensured that it was still
correct and modern.

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
modernize: Minimum Python version is now 2.6

That allowed us to remove some dead weight in cola.compat.

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
modernize: Added "absolute_import" __future__ import

No further adjustments were required, the code was already clear of
ambiguous imports.

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
modernize: Removed utils.ProgressIndicator

ProgressIndicator, which isn't used anywhere, is the only place where we
use a print statement. Rather than modernizing it with a
"print_function" __future__, I've simply removed it.

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
modernize: Added "unicode_literals" __future__ import

Also, replaced the few "u" literals spread across the code with normal
string literals.

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
modernize: Added support for Python 3

Cola now runs on both Python 2.6+ and 3! Many refactorings were
necessary for this.

In-house "six-like" compat unit: Because there were only a few
compatibility tricks needed, I felt that it was overkill to add a
dependency on the "six" module, so I added the necessary compatibility
tricks in cola.compat:

* ustr: replaces all previous instances of `unicode`.
* unichr: Alias of `chr` under py3.
* StringIO: Import from `cStringIO` under py2 and `io` under py3.
* urllib: Aliases to `urllib.parse` under py3.

Then, there's a couple of small fixes that had to be made:

* StandardError --> Exception
* except foo, e --> except foo as e
* foo.reverse() --> reversed(foo)
* xrange() --> range() (minimal perf impact under py2)
* iteritems() --> items() (minimal perf impact under py2)
* Wrapping list() where needed (filter(), map(), etc.)
* __next__ = next aliasing

Also, there were a couple of places where `core.encode()` was used and
didn't have to. Under py2, it did nothing, but under py3, it generated
an error. I've tried to be as careful and minimal as possible for that
part, but if there's one area where there's a risk of newly indtroduced
bugs, it's that part.

There were also "cmp" functions that had to be replaced with "key"
functions.

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
modernize: Use io.StringIO instead of cStringIO

It turns out that Python has its `io` modules since Python 2.6,
something I didn't know. It simplifies the two previous `cStringIO` uses
and removes the need for a `compat.StringIO`.

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
Merge pull request #233 from hsoft/modernize

Support Python 3

Signed-off-by: David Aguilar <davvid@gmail.com>
doc: fix release notes section headers

Signed-off-by: David Aguilar <davvid@gmail.com>
README.md: add full-stops to make the argparse section easier to read

Signed-off-by: David Aguilar <davvid@gmail.com>
git-cola v2.0.0

Signed-off-by: David Aguilar <davvid@gmail.com>
Fixed build-git-cola.sh.

$install_dir does not exist. Instead, changed it to $COLA_PREFIX.

$COMPILE_TOP does not eixst. Instead, changed it to $compile_top.

The command to make git-cola was incorrect as it uses the currently
installed Python. Instead, it should be using the Python that was just
built and installed. Modified the make command to include overriding the
PYTHON value.

After fixing the make command, the extra script that adds environment
variables to run git-cola are no longer needed. Removed the notes about
the script and added notes to simply use git-cola from the install.
Merge pull request #235 from wmwong/master

Fixed build-git-cola.sh.

Signed-off-by: David Aguilar <davvid@gmail.com>
git: fix unicode error in non-ascii worktrees

Decode the worktree passed to set_worktree() so that we
maintain unicode purity in the internals.

Closes #234

Signed-off-by: David Aguilar <davvid@gmail.com>
browse: guard against missing files

abrt on Fedora 20 reported a traceback:

	File "cola/models/browse.py", line 338, in date
	  st = core.stat(self.path)
	File "cola/core.py", line 186, in wrapped
	  return decorator(fn(action(*args, **kwargs)))
	OSError: [Errno 2] No such file or directory

This happens when a file is removed as we are gathering
modification times for display in the browser.

Catch the exception and recover gracefully.

Signed-off-by: David Aguilar <davvid@gmail.com>