sapling/i18n
Jordi Gutiérrez Hermoso 8eb132f5ea style: kill ersatz if-else ternary operators
Although Python supports `X = Y if COND else Z`, this was only
introduced in Python 2.5. Since we have to support Python 2.4, it was
a very common thing to write instead `X = COND and Y or Z`, which is a
bit obscure at a glance. It requires some intricate knowledge of
Python to understand how to parse these one-liners.

We change instead all of these one-liners to 4-liners. This was
executed with the following perlism:

    find -name "*.py" -exec perl -pi -e 's,(\s*)([\.\w]+) = \(?(\S+)\s+and\s+(\S*)\)?\s+or\s+(\S*)$,$1if $3:\n$1    $2 = $4\n$1else:\n$1    $2 = $5,' {} \;

I tweaked the following cases from the automatic Perl output:

    prev = (parents and parents[0]) or nullid
    port = (use_ssl and 443 or 80)
    cwd = (pats and repo.getcwd()) or ''
    rename = fctx and webutil.renamelink(fctx) or []
    ctx = fctx and fctx or ctx
    self.base = (mapfile and os.path.dirname(mapfile)) or ''

I also added some newlines wherever they seemd appropriate for readability

There are probably a few ersatz ternary operators still in the code
somewhere, lurking away from the power of a simple regex.
2015-03-13 17:00:06 -04:00
..
check-translation.py cleanup: rename check-translation.py checker function - don't hide global var 2014-08-15 16:20:47 +02:00
da.po i18n: fix non-matching 1st line indentations 2014-01-22 16:47:05 +01:00
de.po i18n-de: translation improvement for gpg extension 2014-05-07 09:15:58 +02:00
el.po i18n-el: add missing indention for literal block 2013-06-29 19:11:24 +02:00
fr.po i18n-fr: remove duplicate paragraphs 2013-06-25 18:45:33 -04:00
hggettext hggettext: handle i18nfunctions declaration for docstrings translations 2010-10-24 12:52:37 +02:00
it.po i18n: fix non-matching 1st line indentations 2014-01-22 16:47:05 +01:00
ja.po i18n-ja: synchronized with be4e8b8e43d7 2015-03-01 01:28:05 +09:00
polib.LICENSE i18n: import polib 0.5.2 (rev b0ab301cfdcc) 2010-06-17 20:10:34 -03:00
polib.py style: kill ersatz if-else ternary operators 2015-03-13 17:00:06 -04:00
posplit i18n: leave out entries which contain only rst syntax 2014-02-03 21:34:13 +01:00
pt_BR.po i18n-pt_BR: synchronized with be4e8b8e43d7 2015-03-01 00:18:43 -03:00
ro.po i18n: fix non-matching 1st line indentations 2014-01-22 16:47:05 +01:00
ru.po i18n-ru: synchronized with bc20b710d0da 2014-10-13 14:46:50 +01:00
sv.po i18n: fix non-matching 1st line indentations 2014-01-22 16:47:05 +01:00
zh_CN.po i18n-zh_CN: remove duplicate paragraphs 2013-06-24 00:11:28 -04:00
zh_TW.po i18n-zh_TW: set Language header 2014-05-07 09:23:23 +02:00