Mercurial > public > mercurial-scm > hg-stable
diff hgext/censor.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 | c303d65d2e34 |
children | 687b865b95ad |
line wrap: on
line diff
--- a/hgext/censor.py Sat Oct 05 10:29:34 2019 -0400 +++ b/hgext/censor.py Sun Oct 06 09:45:02 2019 -0400 @@ -44,15 +44,21 @@ # leave the attribute unspecified. testedwith = 'ships-with-hg-core' -@command('censor', - [('r', 'rev', '', _('censor file from specified revision'), _('REV')), - ('t', 'tombstone', '', _('replacement tombstone data'), _('TEXT'))], + +@command( + 'censor', + [ + ('r', 'rev', '', _('censor file from specified revision'), _('REV')), + ('t', 'tombstone', '', _('replacement tombstone data'), _('TEXT')), + ], _('-r REV [-t TEXT] [FILE]'), - helpcategory=command.CATEGORY_MAINTENANCE) + helpcategory=command.CATEGORY_MAINTENANCE, +) def censor(ui, repo, path, rev='', tombstone='', **opts): with repo.wlock(), repo.lock(): return _docensor(ui, repo, path, rev, tombstone, **opts) + def _docensor(ui, repo, path, rev='', tombstone='', **opts): if not path: raise error.Abort(_('must specify file path to censor')) @@ -88,13 +94,17 @@ heads.append(hc) if heads: headlist = ', '.join([short(c.node()) for c in heads]) - raise error.Abort(_('cannot censor file in heads (%s)') % headlist, - hint=_('clean/delete and commit first')) + raise error.Abort( + _('cannot censor file in heads (%s)') % headlist, + hint=_('clean/delete and commit first'), + ) wp = wctx.parents() if ctx.node() in [p.node() for p in wp]: - raise error.Abort(_('cannot censor working directory'), - hint=_('clean/delete/update first')) + raise error.Abort( + _('cannot censor working directory'), + hint=_('clean/delete/update first'), + ) with repo.transaction(b'censor') as tr: flog.censorrevision(tr, fnode, tombstone=tombstone)