Mercurial > hg
diff contrib/dirstatenonnormalcheck.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 | 6e7fae8f1c6c |
children | 35295f5a5b9f |
line wrap: on
line diff
--- a/contrib/dirstatenonnormalcheck.py Sat Oct 05 10:29:34 2019 -0400 +++ b/contrib/dirstatenonnormalcheck.py Sun Oct 06 09:45:02 2019 -0400 @@ -13,6 +13,7 @@ extensions, ) + def nonnormalentries(dmap): """Compute nonnormal entries from dirstate's dmap""" res = set() @@ -21,6 +22,7 @@ res.add(f) return res + def checkconsistency(ui, orig, dmap, _nonnormalset, label): """Compute nonnormalset from dmap, check that it matches _nonnormalset""" nonnormalcomputedmap = nonnormalentries(dmap) @@ -30,15 +32,19 @@ ui.develwarn(b"[nonnormalset] %s\n" % _nonnormalset, config=b'dirstate') ui.develwarn(b"[map] %s\n" % nonnormalcomputedmap, config=b'dirstate') + def _checkdirstate(orig, self, arg): """Check nonnormal set consistency before and after the call to orig""" - checkconsistency(self._ui, orig, self._map, self._map.nonnormalset, - b"before") + checkconsistency( + self._ui, orig, self._map, self._map.nonnormalset, b"before" + ) r = orig(self, arg) - checkconsistency(self._ui, orig, self._map, self._map.nonnormalset, - b"after") + checkconsistency( + self._ui, orig, self._map, self._map.nonnormalset, b"after" + ) return r + def extsetup(ui): """Wrap functions modifying dirstate to check nonnormalset consistency""" dirstatecl = dirstate.dirstate