Hey there!
I'm not sure if you still look at this, but I'm really interested in using it for some devlog videos and I'd love a helping hand!
So I think the biggest problem is that the dependencies have changed over time, I'll try to lay down every problem I ran into trying to get this to run.
1) On the README file, this is said regarding dependencies:
pip install git whatthepatch keyboard
To which I'm immediately greeted with:
ERROR: Could not find a version that satisfies the requirement git (from versions: none)
ERROR: No matching distribution found for git
I assume the git
package must be GitPython on PyPI, so that's what I installed.
2) After cloning the files into my git repo and updating the EMPTY_TREE_SHA
, a couple things happen:
2.1) This line:
for diff in whatthepatch.parse_patch(patch)
fails with the following message:
TypeError: cannot use a string pattern on a bytes-like object
I assume this happens because this line:
patch = commits[0].diff(EMPTY_TREE_SHA, create_patch=True)[0].diff
was supposed to return a string. So I changed it to this:
patch = commits[0].diff(EMPTY_TREE_SHA,
create_patch=True)[0].diff.decode("utf-8")
Printing the variable patch
gives me the expected diff string, so it looks correct, but I'm not sure.
2.2) Now the problem is with this line:
for (i, d, t) in diff.changes:
The error is a simple ValueError: too many values to unpack (expected 3)
, so I assumed the GitPython lib must've added something to the Changes object, which looks like it's the case:
[Change(old=1, new=None, line='[submodule "Class"]', hunk=1), Change(old=2, new=None, line='\tpath = Class', hunk=1), Change(old=3, new=None, line='\turl = https://github.com/preischadt/Class', hunk=1)]
So I just added a throwaway variable to the unpacking to get rid of that hunk
property that looked like constant. Like this:
for (i, d, t, _) in diff.changes:
print(d, i, t)
2.3) Then I applied the same changes to the code inside the commits
loop:
patch = commits[i - 1].diff(c, create_patch=True)[0].diff.decode("utf-8")
for diff in whatthepatch.parse_patch(patch):
for (d, i, t, _) in diff.changes:
if d == None or i == None:
print(d, i, t)
And there we go, here's my output:
None 1 [submodule "Class"]
None 2 path = Class
None 3 url = https://github.com/preischadt/Class
Lucas Pinheiro Event Class implementation
It looks correct to me, but I'm not sure what it should look like, so that's what brings me here! Saving my output to a file and running playback.py
results only in VIM opening up, putting in the two settings (set syntax=html
and set timeoutlen=1000 ttimeoutlen=0
), and then the script reads all lines, and just ends.
This is most likely the line causing the problem:
(d, i, t) = ast.literal_eval(line)
It seems never to be able to evaluate that expression.
So another thing I tried was tracking the releases of the GitPython and whatthepatch to try and get the ones close to December 2018, around the date where you uploaded your GameBoy emulator video using the script. I was able to install some older versions, and although that fixed the extra hunk
property from the Changes class in GitPython, that was all.
After all that I decided it might be worth a shot reaching for some help here. Sorry for the gigantic wall of text, I don't want to be a nuisance, and I really loved what you did with this project in your video, so I totally understand if you don't have the time or don't want to help.
Thanks in advance!