Re: [PATCH v2 44/44] qapi: convert trivial intro sections for block-core.json
Markus Armbruster <[email protected]> Thu, 30 Jul 2026 14:59:12 +0200
| Newsgroups | org.nongnu.qemu-trivial,org.kernel.vger.linux-cxl,org.kernel.vger.linux-edac,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Markus Armbruster <[email protected]> writes: > John Snow <[email protected]> writes: > >> On Fri, Jul 24, 2026 at 4:38=E2=80=AFAM Markus Armbruster <armbru@redhat= .com> wrote: > > [...] > >>> I believe all the problematic first paragraphs consist of more than one >>> sentence. What about splitting "trivial" into "very trivial" (just one >>> paragraph, no sentence-ending punctuation in the middle) and "hopefully >>> trivial" (just one paragraph, remainder)? >> >> That's tricky to automate, and doing it by hand doesn't sound much fun >> either... can we just power through one-by-one? >> >> Unless you have a script or a trick you believe will help, and then I >> am happy to oblige. > > By hand would clearly be a bad use of your time. > > I'll look into automating it. Lightly tested throwaway script: #!/usr/bin/env python3 import os import re import subprocess import sys proc =3D subprocess.Popen(['/usr/bin/git', 'add', '-p'], bufsize=3D1, stdin=3Dsubprocess.PIPE, stdout=3Dsubprocess.PIPE, text=3DTrue) n =3D 0 while True: n +=3D 1 chunk =3D os.read(proc.stdout.fileno(), 1024*1024).decode('utf-8') if not chunk: break lines =3D chunk.splitlines() prompt =3D lines[-1] if prompt.find('Stage this hunk') =3D=3D -1: print(f"{sys.argv[0]}: no recognizable prompt after chunk #{n}", file=3Dsys.stderr) break #old =3D '\n'.join(filter(lambda l: re.match(r'^[- ]', l), lines)) #print(old) deleted =3D '\n'.join(filter(lambda l: re.match(r'^-#', l), lines)) if re.search(r'[!.?].*[!.?]', deleted, flags=3Dre.DOTALL): proc.stdin.write('n\n') else: proc.stdin.write('y\n') ch =3D os.read(proc.stdout.fileno(), 1).decode('utf-8') try: proc.wait(1) except: print(f"{sys.argv[0]}: git-add appears to hang, sending SIGTERM", file=3Dsys.stderr) proc.terminate() proc.wait() if proc.returncode !=3D 0: print(f"{sys.argv[0]}: git-add terminated abnormally (code=3D{proc.retu= rncode})", file=3Dsys.stderr)