On Mon, 16 Nov 2020, Martin Liška wrote:

> >   I have decided to give your `contrib/mklog.py' script a hit and, well,
> > ahem, I guess I must be doing something utterly silly, but no matter what
> > kind of a diff I hand to the script it does not produce anything unless I
> > apply a patch like below to it, in which case the output produced is as
> > expected.
> 
> Hm, it should not be really needed. See:
> 
> $ git show > 1
> $ ipython
> $ from unidiff import PatchSet
> $ PatchSet(open('1'))
> Out[2]: <PatchSet: [<PatchedFile: gcc/config/i386/i386.h>, <PatchedFile:
> gcc/doc/invoke.texi>]>

 Hmm,

$ ipython
-bash: ipython: command not found
$ 

> >   What's going on here -- has the API of `PatchSet' changed so much at one
> > point?  Can we do anything to prevent someone else from tripping over this
> > issue?
> 
> Can you please show how do you use the script and what's the output?

 Sure, let's pick your recent change:

$ git show 2935ff7eb7ac | contrib/mklog.py
$

Nothing, as I wrote.  With my tweaked version I instead get:

$ git show 2935ff7eb7ac | ../mklog.py
ChangeLog:

        * gcc/testsuite/g++.dg/ubsan/pr61272.C:

$

which is not perfect as it failed to pick ChangeLog from gcc/testsuite/, 
but at least it's a starting point.

 Let's retry with `ipython' installed now:

$ git show 2935ff7eb7ac > 1
$ ipython
$ Python 2.7.16 (default, Oct 10 2019, 22:02:15)
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from unidiff import PatchSet

In [2]: PatchSet(open('1'))
Out[2]: <PatchSet: [<PatchedFile: gcc/testsuite/g++.dg/ubsan/pr61272.C>]>

Same with `ipython3' except for:

Python 3.7.3 (default, Jul 25 2020, 13:03:44)

Please note however that your script effectively does:

In [3]: PatchSet(open('1').read())
Out[3]: <PatchSet: []>

which my tweak changes into your proposed sequence.

  Maciej no less confused

Reply via email to