Mercurial > hg
view tests/fakemergerecord.py @ 51925:3a90a6fd710d
dirstate: subclass the new dirstate Protocol class
Behold the chaos that ensues. We'll use the generated *.pyi files to apply type
annotations to the interface, and see how much agrees with the documentation.
Since the CamelCase name was used to try to work around pytype issues with zope
interfaces and is a new innovation this cycle (see c1d7ac70980b), drop the
CamelCase name. I think the Protocol classes *should* be CamelCase, but that
can be done later in one pass. For now, the CamelCase alias is extra noise in
the *.pyi files.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 26 Sep 2024 18:52:46 -0400 |
parents | 6000f5b25c9b |
children |
line wrap: on
line source
# Extension to write out fake unsupported records into the merge state # # from mercurial import ( mergestate as mergestatemod, registrar, ) cmdtable = {} command = registrar.command(cmdtable) @command( b'fakemergerecord', [ (b'X', b'mandatory', None, b'add a fake mandatory record'), (b'x', b'advisory', None, b'add a fake advisory record'), ], '', ) def fakemergerecord(ui, repo, *pats, **opts): with repo.wlock(): ms = mergestatemod.mergestate.read(repo) records = ms._makerecords() if opts.get('mandatory'): records.append((b'X', b'mandatory record')) if opts.get('advisory'): records.append((b'x', b'advisory record')) ms._writerecords(records)