Replies: 2 comments 1 reply
-
Using When dealing with remotes there are facilities in place which capture stderr to make progress messages easier to use. Have a look at the p'progress' portion of the advanced usage docs for some details. If the script is mostly for calling the git command, a shell script might be easier to work with than GitPython which has its own peculiarities when calling git. |
Beta Was this translation helpful? Give feedback.
-
Yes we currently do have a shell script but due to some requirements we have decided to switch to python, so Essentially I also want all the return containers for use in further processing, in the process I just want the user to see the direct output of the called git actions. For the repo.git. commands I think I understand how to use stdout, but where does stderr end up? and for the remot.push/pull I have read the section you suggested, but I stil no not quite get on how to just print what would've been printed by the git command (and still receive the FetchInfo objects that contain success info) |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am using gitpython for a small helper tool to manage somewhat complicated submodule setups.
I want it to work alongside standard git, not agaionst or around it.
Hence I want users to see the output of the commands. as they know it from plain vanilla git
e.g. a "Everything up to date" after a push without changes.
From the docs I was not really able to figure out a consistent way to do it.
For commit, I was able to achieve it like this:
print(toprepo.git.commit(a=pa.add, m=msg, with_stdout=True))
For push, the same does not work, because it ends up on stderr
print(toprepo.git.push(pa.remote, with_stdout=True))
:Logger produces this:
INFO:git.cmd:git push origin -> 0; stdout: '<OUTPUT_STREAM>'; stderr: 'Everything up-to-date'
When using the built in remote.push() and remote.pull() methosds I cannot find a way to retrieve the output at all, as with_stdout=False is hardcoded without a way to override it via kwargs.
Can you give guidance on how to cover my use-case?
Beta Was this translation helpful? Give feedback.
All reactions