-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checking for git repo produces confusing messages #594
Comments
Hi @julie777, thank you very much for investigating that. That is a tricky one... I think we want to know exactly what is happening when the flag For example a few months ago @FlorianWilhelm managed to fix a very scary bug that was happening because Maybe we should change the text in the message instead, in a way it is less confusing? What do you think? Question, does the message appear with the regular |
Hi @julie777, thanks for looking into this. It's exactly as @abravalheri explained, we see I think in this context the actual culprit is the fact that we call shell commands, i.e. git. This is a very bad style and I always tell my junior programmer colleagues to never to this :-) In our case, there is no other way as Linus Torvalds decided to not have Git separated into a library and a small frontend application. For this reason there is no proper way to call Git from Python at least not that I know of. Maybe things changed and there is now? |
I understand now. One of the things that confused me was that in the code I saw I really like the use of the logging module to provide verbose output. It is infinitely configurable. I also like the addition of indent nesting. I have always found that python logging is a good way to both produce actual log files and to provide output to the user in a very configurable way. I think there are things that could help, and they relate to this issue (although perhaps the issue should be renamed):
I will attempt to explain what I mean now. Don't think of this as criticism as much as just how a new person might interpret the current output and some possible ways that it could be changed. Debug LoggingNow that I understand the purpose of Indentation Indicates GroupingHere is a chunk of my log that has the original failure that confused me.
If I ignore the first column then I can easily see that invoking the
But, to a newcomer the first column right justification obscures the single space indent and nothing says anything about action and the verbose If I change the output to
it becomes obvious that Logging What in Addition to HowLooking at this part of the log
Several things aren't as clear as they could be. I see
There are still some inconsistencies, such as Using python wraps to format captured stdout and stderr and presenting in a way that doesn't just wrap in an uncontrolled way making the output messy can help. (This conflicts with the standard of keeping log entries to a single line, but I believe that only applies to applications like web servers that run continuously and have log aggregated and processed by other tools. I think pyscaffold logs will only be used by people.) Please remember that the example output is both fictional and not tied to actual current output, and that I tried to keep it brief. I haven't yet spent the time to understand the log wrapper that is doing all the logging, why it is there, what all it does, etc. I will do that before my next comment. |
That sounds like a very interesting change! |
Years ago when I was using bazaar for SCM I used a python library to access it. It worked quite well. I know that there are at least two git libraries for python. I will take a look at them and let you know. I don't have any real objection to running sub-processes when necessary. As you suggest libraries can be nicer in many ways. I did notice that shell.py default to running subprocesses with shell=True. I am curios if you remember the reason for this. I have always tried to avoid it for a couple of reasons.
|
At some point I studied running the command just from a list of string without I think the main reason here is to maximise compatibility. Git might be tricky to run. The program in $EDITOR as well... |
After doing some looking for a python git package, I only found one, GitPython. As for GitPython I will look at it more closely to see if it provides anything that helps us. Since git isn't written in Python it is a wrapper using subprocess just like we already are doing. It might provide an easier to use API so I will review it. |
Yes it does. I have tried all the possible options, but for a simple |
I think that last time we had a bug, we made all the log messages more verbose because it was hard to find out what was going on. Maybe we can hide some of the lines that can be confusing and just display them on |
Description of your problem
putup -vv myprojects
Please provide the full traceback using the
--very-verbose
flag.Please provide any additional information below.
In this instance the output of the command is not important because the normal case is that the new project directory is not in an existing git repo. The error/return code of the git command is all that matters. This will be confusing to most users. It was to me.
I am running many scenarios trying to learn the codebase so that I can contribute. It took me a few minutes to look at the code and understand. I doubt all users want to do that.
I am working on a pull request.
Versions and main components
The text was updated successfully, but these errors were encountered: