from contextlib import ExitStack
+from itertools import dropwhile
from launchpadlib.launchpad import Launchpad
from lazr.restfulclient.errors import ServerError
from sru_workflow import process_bug
@@ -364,8 +365,11 @@
if debdiff and opts.view:
with ExitStack() as resources:
tfile = resources.enter_context(tempfile.NamedTemporaryFile())
- for line in debdiff:
- tfile.write(line)
+ while True:
+ for line in dropwhile(lambda x:not x.decode('utf-8').startswith('diff '), debdiff):
+ tfile.write(line)
+ else:
+ break tfile.flush()
if opts.diffstat: combinedfile = resources.enter_context(
Could you add that to your changes? Then I'll harass somebody who has commit access to this to get it merged. Thanks again!
This is great thanks for working on this and updating it. One thing I noticed today when testing it was that bileto's "diff" includes the output of diffstat (e.g. https:/ /objectstorage. prodstack4- 5.canonical. com/v1/ AUTH_39a8dbb93c af4ec889f8a1b7f 69885db/ bileto- 4610/2021- 07-09_10: 06:30/focal_ xtables- addons_ content. diff) and then sru-review can add additional diffstat. This seemed rather redundant to me so I played with the code a bit and made the following change:
--- old/sru-review 2020-06-05 13:56:50 +0000
+++ new/sru-review 2021-07-13 23:18:49 +0000
@@ -43,6 +43,7 @@
import webbrowser
from contextlib import ExitStack launchpad import Launchpad ent.errors import ServerError enter_context( tempfile. NamedTemporaryF ile()) 'utf-8' ).startswith( 'diff '), debdiff):
tfile. flush()
combinedfile = resources. enter_context(
+from itertools import dropwhile
from launchpadlib.
from lazr.restfulcli
from sru_workflow import process_bug
@@ -364,8 +365,11 @@
if debdiff and opts.view:
with ExitStack() as resources:
tfile = resources.
- for line in debdiff:
- tfile.write(line)
+ while True:
+ for line in dropwhile(lambda x:not x.decode(
+ tfile.write(line)
+ else:
+ break
if opts.diffstat:
Could you add that to your changes? Then I'll harass somebody who has commit access to this to get it merged. Thanks again!