tests/fakepatchtime.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sun, 01 Nov 2015 08:38:56 +0900
branchstable
changeset 26838 47dd34f2e727
parent 25756 a4a41525180c
child 27284 f624b0e69105
permissions -rw-r--r--
i18n: look translation of both "DEPRECATED" and "(DEPRECATED)" up Since 44cc9f63a2f1, deprecated commands, options and so on are detected by "(DEPRECATED)" instead of "DEPRECATED". "hg.pot" generated from recent source files doesn't contain msgid "DEPRECATED", and looking the translation of "DEPRECATED" up in up-to-date *.po files works incorrectly. But on the other hand, there are still old *.po files, which contain msgid "DEPRECATED" but not "(DEPRECATED)". Looking the translation of "(DEPRECATED)" up in such old *.po files also works incorrectly. This patch resolves this problem by looking translation of both "DEPRECATED" and "(DEPRECATED)" up. This should work correctly, because previous patch makes "deprecated" checker be applied only on translations, of which msgid contains exact "(DEPRECATED)" string. 'p.msgstr' examination in 'deprecatedsetup()' is needed to ignore untranslated entries. This also makes 'deprecatedpe.msgstr' examination in 'deprecated()' meaningless.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25756
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     1
# extension to emulate invoking 'patch.internalpatch()' at the time
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     2
# specified by '[fakepatchtime] fakenow'
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     3
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     4
from mercurial import extensions, patch as patchmod, util
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     5
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     6
def internalpatch(orig, ui, repo, patchobj, strip,
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     7
                  prefix='', files=None,
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     8
                  eolmode='strict', similarity=0):
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     9
    if files is None:
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    10
        files = set()
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    11
    r = orig(ui, repo, patchobj, strip,
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    12
             prefix=prefix, files=files,
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    13
             eolmode=eolmode, similarity=similarity)
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    14
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    15
    fakenow = ui.config('fakepatchtime', 'fakenow')
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    16
    if fakenow:
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    17
        # parsing 'fakenow' in YYYYmmddHHMM format makes comparison between
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    18
        # 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    19
        fakenow = util.parsedate(fakenow, ['%Y%m%d%H%M'])[0]
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    20
        for f in files:
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    21
            repo.wvfs.utime(f, (fakenow, fakenow))
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    22
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    23
    return r
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    24
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    25
def extsetup(ui):
a4a41525180c tests: add extension to emulate invoking internalpatch at the specific time
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    26
    extensions.wrapfunction(patchmod, 'internalpatch', internalpatch)