Code review comment for lp:~3v1n0/ubuntu-archive-tools/sru-review-bileto-support

Revision history for this message
Brian Murray (brian-murray) wrote :

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_39a8dbb93caf4ec889f8a1b7f69885db/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
+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!

review: Needs Fixing

« Back to merge proposal