On Thursday, June 15, 2017 at 12:23:15 PM UTC-5, Edward K. Ream wrote:
> > I wonder whether git can deliver (the contents of) blobs by file name
and commit.
> Well, of course it can: git show HEAD~2:./leo/core/commit_timestamp.json
...
> If this output can be piped into Leo we won't need gitpython at all...
The following reads the 5182 lines of leoAtFile.py into Leo almost
instantaneously:
import os
import shlex
import subprocess
os.chdir(r'c:\leo.repo\leo-editor')
command = r'git show HEAD~2:./leo/core/leoAtFile.py'
p = subprocess.Popen(
shlex.split(command),
stdout=subprocess.PIPE,
stderr=None, # Shows error messages.
shell=False,
)
out, err = p.communicate()
n = 0
for line in g.splitLines(out):
n += 1
s = g.toUnicode(line.rstrip())
print('%s lines' % n)
This is very fast because it uses git itself. I see no reason to use
gitpython. Do you?
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.