Mercurial > hg
diff tests/fakedirstatewritetime.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 760a7851e9ba |
children | 9f70512ae2cf |
line wrap: on
line diff
--- a/tests/fakedirstatewritetime.py Sat Oct 05 10:29:34 2019 -0400 +++ b/tests/fakedirstatewritetime.py Sun Oct 06 09:45:02 2019 -0400 @@ -18,6 +18,7 @@ try: from mercurial import rustext + rustext.__name__ # force actual import (see hgdemandimport) except ImportError: rustext = None @@ -25,13 +26,14 @@ configtable = {} configitem = registrar.configitem(configtable) -configitem(b'fakedirstatewritetime', b'fakenow', - default=None, +configitem( + b'fakedirstatewritetime', b'fakenow', default=None, ) parsers = policy.importmod(r'parsers') rustmod = policy.importrust(r'parsers') + def pack_dirstate(fakenow, orig, dmap, copymap, pl, now): # execute what original parsers.pack_dirstate should do actually # for consistency @@ -43,6 +45,7 @@ return orig(dmap, copymap, pl, fakenow) + def fakewrite(ui, func): # fake "now" of 'pack_dirstate' only if it is invoked while 'func' @@ -62,9 +65,9 @@ # The Rust implementation does not use public parse/pack dirstate # to prevent conversion round-trips orig_dirstatemap_write = dirstate.dirstatemap.write - wrapper = lambda self, st, now: orig_dirstatemap_write(self, - st, - fakenow) + wrapper = lambda self, st, now: orig_dirstatemap_write( + self, st, fakenow + ) dirstate.dirstatemap.write = wrapper orig_dirstate_getfsnow = dirstate._getfsnow @@ -83,16 +86,19 @@ if rustmod is not None: dirstate.dirstatemap.write = orig_dirstatemap_write + def _poststatusfixup(orig, workingctx, status, fixup): ui = workingctx.repo().ui - return fakewrite(ui, lambda : orig(workingctx, status, fixup)) + return fakewrite(ui, lambda: orig(workingctx, status, fixup)) + def markcommitted(orig, committablectx, node): ui = committablectx.repo().ui - return fakewrite(ui, lambda : orig(committablectx, node)) + return fakewrite(ui, lambda: orig(committablectx, node)) + def extsetup(ui): - extensions.wrapfunction(context.workingctx, '_poststatusfixup', - _poststatusfixup) - extensions.wrapfunction(context.workingctx, 'markcommitted', - markcommitted) + extensions.wrapfunction( + context.workingctx, '_poststatusfixup', _poststatusfixup + ) + extensions.wrapfunction(context.workingctx, 'markcommitted', markcommitted)