annotate tests/testlib/ext-phase-report.py @ 53040:cdd7bf612c7b stable tip

bundle-spec: properly format boolean parameter (issue6960) This was breaking automatic clone bundle generation. This changeset fixes it and add a test to catch it in the future.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 11 Mar 2025 02:29:42 +0100
parents 5cc8deb96b48
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33459
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
1 # tiny extension to report phase changes during transaction
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
2
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 36082
diff changeset
3
33459
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
4 def reposetup(ui, repo):
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
5 def reportphasemove(tr):
44558
fdc802f29b2c transactions: convert changes['phases'] to list of ranges
Joerg Sonnenberger <joerg@bec.de>
parents: 43076
diff changeset
6 for revs, move in sorted(tr.changes[b"phases"], key=lambda r: r[0][0]):
fdc802f29b2c transactions: convert changes['phases'] to list of ranges
Joerg Sonnenberger <joerg@bec.de>
parents: 43076
diff changeset
7 for rev in revs:
fdc802f29b2c transactions: convert changes['phases'] to list of ranges
Joerg Sonnenberger <joerg@bec.de>
parents: 43076
diff changeset
8 if move[0] is None:
52661
0e11e532c958 style: use `ui.xxxnoi18n()` methods instead of wrapping msg in `()`
Matt Harbison <matt_harbison@yahoo.com>
parents: 48966
diff changeset
9 ui.writenoi18n(
0e11e532c958 style: use `ui.xxxnoi18n()` methods instead of wrapping msg in `()`
Matt Harbison <matt_harbison@yahoo.com>
parents: 48966
diff changeset
10 b'test-debug-phase: new rev %d: x -> %d\n'
0e11e532c958 style: use `ui.xxxnoi18n()` methods instead of wrapping msg in `()`
Matt Harbison <matt_harbison@yahoo.com>
parents: 48966
diff changeset
11 % (rev, move[1])
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 36082
diff changeset
12 )
44558
fdc802f29b2c transactions: convert changes['phases'] to list of ranges
Joerg Sonnenberger <joerg@bec.de>
parents: 43076
diff changeset
13 else:
52661
0e11e532c958 style: use `ui.xxxnoi18n()` methods instead of wrapping msg in `()`
Matt Harbison <matt_harbison@yahoo.com>
parents: 48966
diff changeset
14 ui.writenoi18n(
0e11e532c958 style: use `ui.xxxnoi18n()` methods instead of wrapping msg in `()`
Matt Harbison <matt_harbison@yahoo.com>
parents: 48966
diff changeset
15 b'test-debug-phase: move rev %d: %d -> %d\n'
0e11e532c958 style: use `ui.xxxnoi18n()` methods instead of wrapping msg in `()`
Matt Harbison <matt_harbison@yahoo.com>
parents: 48966
diff changeset
16 % (rev, move[0], move[1])
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 36082
diff changeset
17 )
33459
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
18
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
19 class reportphaserepo(repo.__class__):
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
20 def transaction(self, *args, **kwargs):
52668
5cc8deb96b48 pyupgrade: modernize calls to superclass methods
Matt Harbison <matt_harbison@yahoo.com>
parents: 52661
diff changeset
21 tr = super().transaction(*args, **kwargs)
36082
3b4d14beac3d py3: port ext-phase-report.py extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33459
diff changeset
22 tr.addpostclose(b'report-phase', reportphasemove)
33459
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
23 return tr
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
24
67a3204c83c1 phases: test phases tracking at the transaction level
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
25 repo.__class__ = reportphaserepo