File: ext-phase-report.py

package info (click to toggle)
mercurial 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 45,080 kB
  • sloc: python: 208,589; ansic: 56,460; tcl: 3,715; sh: 1,839; lisp: 1,483; cpp: 864; makefile: 769; javascript: 649; xml: 36
file content (25 lines) | stat: -rw-r--r-- 895 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# tiny extension to report phase changes during transaction


def reposetup(ui, repo):
    def reportphasemove(tr):
        for revs, move in sorted(tr.changes[b"phases"], key=lambda r: r[0][0]):
            for rev in revs:
                if move[0] is None:
                    ui.writenoi18n(
                        b'test-debug-phase: new rev %d:  x -> %d\n'
                        % (rev, move[1])
                    )
                else:
                    ui.writenoi18n(
                        b'test-debug-phase: move rev %d: %d -> %d\n'
                        % (rev, move[0], move[1])
                    )

    class reportphaserepo(repo.__class__):
        def transaction(self, *args, **kwargs):
            tr = super().transaction(*args, **kwargs)
            tr.addpostclose(b'report-phase', reportphasemove)
            return tr

    repo.__class__ = reportphaserepo