You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Progress not showing up before the last second #444
And then, when I clone a very large repository (like mozilla's gecko):
% git hub clone mozilla/gecko-dev
Pulling from github |████████████████████████████████|
Successfully cloned `https://github.com/guyzmo/git-repo` into `./git-repo`!
the progress bar is "progressing" (i.e. incrementing from 0 to 100%), but it shows up only at the very end of the fetching, after hanging for a long while. I started to debug it, and it looks like it's related to subprocess stuff.
Though, I might be implementing it wrong, which is why I'm asking here while I'm still debugging that issue.
I think I'm onto something, I stopped with pdb to watch at the type of proc.stderr, and found out that proc.stderr.mode is 'rb', so it's binary buffering, and it's unlikely to have universal line ending enabled.
If the stderr argument was PIPE, this attribute is a readable stream object as returned by open(). Reading from the stream provides error output from the child process. If the universal_newlines argument was True, the stream is a text stream, otherwise it is a byte stream. If the stderr argument was not PIPE, this attribute is None.
so I guess it's worth trying with Popen(..., universal_newlines=True)!
Looks very good ! I am currently experimenting with adding this option just for fetch/push operations, and it doesn't seem too straightforward for some reason. Let's see how it goes.
Why is it going through stdout twice ? And even if so, it's just a few hundred lines at most, and I wouldn't expect this to be noticeable. If it is, it might be something with regular expressions being slow ? Just guessing though.
I just pushed the universal_newline fix for remote operations. It should work, but please verify. For anything, I'd be happy to merge PRs you send this way.
Thanks for the asciicinema videos, it was nice to see the results of this work, and certainly helped my motivations :) !
ok, it looks like the "slowness" of my pulls might be caused by github throttling me, as I'm hammering them a bit too much:
git clone -v --progress https://github.com/gitpython-developers/GitPython 0.72s user 0.23s system 3% cpu 26.830 total
git hub -v clone gitpython-developers/GitPython 1.28s user 0.19s system 6% cpu 24.252 total
as I'm on a gigabit connection, I'm used to the clone being a lot less :)
Though, now that leaves us with this message showing up:
Fetch head lines do not match lines provided via progress information
length of progress lines 2 should be equal to lines in FETCH_HEAD file 1
Will ignore extra progress lines or fetch head lines.
any clues why it is happening? is it related to some other changes in master?
Yes, it's a fix for another issue, which if not there would have caused an assertion error.
It might also show that something is different now. Could you revert my previous two commits to see if the error still occours ?
It could be that indeed we get more progress lines than previously, thanks to the different split characters.
it's still happening with b9a7dc5 and b40d4b5 reverted. So I guess it's because of the new split mechanism. I guess we're including extra lines in one of l_fil and l_fhi... Now we just need to figure out what, and how to exclude them! :-)
So the new branch isn't handled as it is not part of the information git puts into the FETCH_HEAD.
I really don't know what the rule is there, but believe the warning can be ignored for now.
Also what I understand is the my two recent commits didn't affect this issue, so we wouldn't have to be concerned with it here.
So the new branch isn't handled as it is not part of the information git puts into the FETCH_HEAD.
I really don't know what the rule is there, but believe the warning can be ignored for now.
well, maybe should we downgrade the warning to debug logging, so it's not in the way looking bad when doing a pull when not in verbose mode? :-)
Thank you ! I am super happy to finally see this feature implemented right. Even though I implemented it for my own use, I never got around to actually using it, and thus didn't notice the various shortcomings you now discovered.
I have to admit that I've implemented the feature mostly because I saw the progress parameter to the function and found it fun to implement (I also liked very much the progress bar of pip, so I thought why not do it the same way? :-) ). Anyway, it looks like we've nailed it 👍
BTW, if you're on IRC, don't hesitate to ping me, I'm zmo on freenode.
Not sure if I should file a new bug or resurrect this one, but an earlier comment says:
I am currently experimenting with adding this option just for fetch/push operations
Was cloning just overlooked? git.Repo.clone_from seems to have the exact same problem. I fixed it locally by changing git.remote.add_progress to also set kwargs['universal_newlines'] = True, and changing git.base.Repo._clone to pass decode_streams = False to handle_process_output
Activity
guyzmo commentedon May 26, 2016
I think I'm onto something, I stopped with pdb to watch at the type of
proc.stderr, and found out thatproc.stderr.mode is 'rb', so it's binary buffering, and it's unlikely to have universal line ending enabled.Then I went on to read subprocess documentation where it says:
so I guess it's worth trying with
Popen(..., universal_newlines=True)!guyzmo commentedon May 26, 2016
yay, it's what was the issue \o/
http://asciinema.org/a/5n0tyv6jmvu14u8lsi18f53c5
there's a bunch of caveats, though, because now
proc.stderrlines are not bytes anymore, but unicodestr.Byron commentedon May 26, 2016
Looks very good ! I am currently experimenting with adding this option just for fetch/push operations, and it doesn't seem too straightforward for some reason. Let's see how it goes.
guyzmo commentedon May 26, 2016
Though, as a side effect the fetching is quite terribly slow, certainly of the overhead of going twice to stdout.
Byron commentedon May 26, 2016
Why is it going through stdout twice ? And even if so, it's just a few hundred lines at most, and I wouldn't expect this to be noticeable. If it is, it might be something with regular expressions being slow ? Just guessing though.
guyzmo commentedon May 26, 2016
well, from git's stdout to GitPython, and from GitPython to stdout!
Byron commentedon May 26, 2016
That is something I would then consider a bug in either codebase, and hopefully fixable.
guyzmo commentedon May 26, 2016
here's a summary of my patch:
about the other errors, I just found out that I fscked up my local workspace, so to make a proper commit I need to do some cleaning first :)
fix(remote): use universal_newlines for fetch/push
Byron commentedon May 26, 2016
I just pushed the universal_newline fix for remote operations. It should work, but please verify. For anything, I'd be happy to merge PRs you send this way.
Thanks for the asciicinema videos, it was nice to see the results of this work, and certainly helped my motivations :) !
fix(remote): py3 compatibility
Byron commentedon May 26, 2016
I think this is fixed now:
GitPython/git/remote.py
Line 553 in 902679c
guyzmo commentedon May 26, 2016
ok, it looks like the "slowness" of my pulls might be caused by github throttling me, as I'm hammering them a bit too much:
as I'm on a gigabit connection, I'm used to the clone being a lot less :)
guyzmo commentedon May 26, 2016
Though, now that leaves us with this message showing up:
any clues why it is happening? is it related to some other changes in master?
Byron commentedon May 26, 2016
Yes, it's a fix for another issue, which if not there would have caused an assertion error.
It might also show that something is different now. Could you revert my previous two commits to see if the error still occours ?
It could be that indeed we get more progress lines than previously, thanks to the different split characters.
guyzmo commentedon May 26, 2016
it's still happening with
b9a7dc5andb40d4b5reverted. So I guess it's because of the new split mechanism. I guess we're including extra lines in one ofl_filandl_fhi... Now we just need to figure out what, and how to exclude them! :-)Byron commentedon May 26, 2016
You should be able to print these arrays to see what the difference is ... . Maybe an empty line snuck in there.
guyzmo commentedon May 26, 2016
I'm doing a
pdb.set_trace()to print them both, hang on :-)BTW, are you on IRC, to avoid "chatting" over the comments and keep the essential here?
guyzmo commentedon May 26, 2016
here it goes:
for a pull, what I'm doing something is equivalent to:
Byron commentedon May 26, 2016
So the new branch isn't handled as it is not part of the information git puts into the FETCH_HEAD.
I really don't know what the rule is there, but believe the warning can be ignored for now.
Also what I understand is the my two recent commits didn't affect this issue, so we wouldn't have to be concerned with it here.
Does it mean we do have real-time progress now ?
guyzmo commentedon May 26, 2016
I guess we can say so!
well, maybe should we downgrade the warning to debug logging, so it's not in the way looking bad when doing a pull when not in verbose mode? :-)
Byron commentedon May 26, 2016
Good idea ! Would you like to do a PR, just to have your name baked permanently into the authors list of this project :) ?
Changing warning to debug logging, to avoid warning showing off when …
Changing warning to debug logging, to avoid warning showing off when …
guyzmo commentedon May 26, 2016
done :)
BTW, you don't really need to include that PR, as I already had a PR merged, and a new one I just did to be merged :-)
Byron commentedon May 27, 2016
Thank you ! I am super happy to finally see this feature implemented right. Even though I implemented it for my own use, I never got around to actually using it, and thus didn't notice the various shortcomings you now discovered.
guyzmo commentedon May 27, 2016
I have to admit that I've implemented the feature mostly because I saw the
progressparameter to the function and found it fun to implement (I also liked very much the progress bar of pip, so I thought why not do it the same way? :-) ). Anyway, it looks like we've nailed it 👍BTW, if you're on IRC, don't hesitate to ping me, I'm zmo on freenode.
barry-scott commentedon Oct 11, 2016
@Byron I thought this was fixed. I'm not seeing the problem any more. Can this issue me closed?
guyzmo commentedon Oct 11, 2016
worksforme ☺
ankostis commentedon Oct 11, 2016
We can close it then, fixed under the milestone it is currently under!
Thanks.
(do you want to push any AUTHOR changes?)
guyzmo commentedon Oct 11, 2016
sure thanks, I'll do that in a currently pending PR I'm pushing!
mrozekma commentedon Aug 6, 2017
Not sure if I should file a new bug or resurrect this one, but an earlier comment says:
Was cloning just overlooked?
git.Repo.clone_fromseems to have the exact same problem. I fixed it locally by changinggit.remote.add_progressto also setkwargs['universal_newlines'] = True, and changinggit.base.Repo._cloneto passdecode_streams = Falsetohandle_process_outputByron commentedon Sep 28, 2017
@mrozekma I believe creating a new issue would be the way to go, while assuring the issue can be reproduced with the latest version.
fix(remote): real-time reading of lines from stderr