ext-phase-report.py
22 lines
| 799 B
| text/x-python
|
PythonLexer
Boris Feld
|
r33459 | # tiny extension to report phase changes during transaction | ||
from __future__ import absolute_import | ||||
def reposetup(ui, repo): | ||||
def reportphasemove(tr): | ||||
Gregory Szorc
|
r36061 | for rev, move in sorted(tr.changes[b'phases'].items()): | ||
Boris Feld
|
r33459 | if move[0] is None: | ||
Gregory Szorc
|
r36061 | ui.write((b'test-debug-phase: new rev %d: x -> %d\n' | ||
Boris Feld
|
r33459 | % (rev, move[1]))) | ||
else: | ||||
Gregory Szorc
|
r36061 | ui.write((b'test-debug-phase: move rev %d: %d -> %d\n' | ||
Boris Feld
|
r33459 | % (rev, move[0], move[1]))) | ||
class reportphaserepo(repo.__class__): | ||||
def transaction(self, *args, **kwargs): | ||||
tr = super(reportphaserepo, self).transaction(*args, **kwargs) | ||||
Gregory Szorc
|
r36061 | tr.addpostclose(b'report-phase', reportphasemove) | ||
Boris Feld
|
r33459 | return tr | ||
repo.__class__ = reportphaserepo | ||||