Mercurial > public > mercurial-scm > hg-stable
diff hgext/closehead.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/closehead.py Sat Oct 05 10:29:34 2019 -0400 +++ b/hgext/closehead.py Sun Oct 06 09:45:02 2019 -0400 @@ -28,13 +28,16 @@ commitopts = cmdutil.commitopts commitopts2 = cmdutil.commitopts2 -commitopts3 = [('r', 'rev', [], - _('revision to check'), _('REV'))] +commitopts3 = [('r', 'rev', [], _('revision to check'), _('REV'))] + -@command('close-head|close-heads', commitopts + commitopts2 + commitopts3, +@command( + 'close-head|close-heads', + commitopts + commitopts2 + commitopts3, _('[OPTION]... [REV]...'), helpcategory=command.CATEGORY_CHANGE_MANAGEMENT, - inferrepo=True) + inferrepo=True, +) def close_branch(ui, repo, *revs, **opts): """close the given head revisions @@ -44,10 +47,18 @@ The commit message must be specified with -l or -m. """ + def docommit(rev): - cctx = context.memctx(repo, parents=[rev, None], text=message, - files=[], filectxfn=None, user=opts.get('user'), - date=opts.get('date'), extra=extra) + cctx = context.memctx( + repo, + parents=[rev, None], + text=message, + files=[], + filectxfn=None, + user=opts.get('user'), + date=opts.get('date'), + extra=extra, + ) tr = repo.transaction('commit') ret = repo.commitctx(cctx, True) bookmarks.update(repo, [rev, None], ret) @@ -73,7 +84,7 @@ message = cmdutil.logmessage(ui, opts) if not message: raise error.Abort(_("no commit message specified with -l or -m")) - extra = { 'close': '1' } + extra = {'close': '1'} with repo.wlock(), repo.lock(): for rev in revs: