Mercurial > hg
comparison tests/testlib/ext-phase-report.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 | 3b4d14beac3d |
children | fdc802f29b2c |
comparison
equal
deleted
inserted
replaced
43075:57875cf423c9 | 43076:2372284d9457 |
---|---|
1 # tiny extension to report phase changes during transaction | 1 # tiny extension to report phase changes during transaction |
2 | 2 |
3 from __future__ import absolute_import | 3 from __future__ import absolute_import |
4 | 4 |
5 | |
5 def reposetup(ui, repo): | 6 def reposetup(ui, repo): |
6 | |
7 def reportphasemove(tr): | 7 def reportphasemove(tr): |
8 for rev, move in sorted(tr.changes[b'phases'].items()): | 8 for rev, move in sorted(tr.changes[b'phases'].items()): |
9 if move[0] is None: | 9 if move[0] is None: |
10 ui.write((b'test-debug-phase: new rev %d: x -> %d\n' | 10 ui.write( |
11 % (rev, move[1]))) | 11 ( |
12 b'test-debug-phase: new rev %d: x -> %d\n' | |
13 % (rev, move[1]) | |
14 ) | |
15 ) | |
12 else: | 16 else: |
13 ui.write((b'test-debug-phase: move rev %d: %d -> %d\n' | 17 ui.write( |
14 % (rev, move[0], move[1]))) | 18 ( |
19 b'test-debug-phase: move rev %d: %d -> %d\n' | |
20 % (rev, move[0], move[1]) | |
21 ) | |
22 ) | |
15 | 23 |
16 class reportphaserepo(repo.__class__): | 24 class reportphaserepo(repo.__class__): |
17 def transaction(self, *args, **kwargs): | 25 def transaction(self, *args, **kwargs): |
18 tr = super(reportphaserepo, self).transaction(*args, **kwargs) | 26 tr = super(reportphaserepo, self).transaction(*args, **kwargs) |
19 tr.addpostclose(b'report-phase', reportphasemove) | 27 tr.addpostclose(b'report-phase', reportphasemove) |