I want to manupulate the output of the git show in python.
I use the follow to get the output of the git show.
sh.git.show('b24f6f825324fb939210077c02a8944b59399510')
out.stdout
But the out is in one line.
b'\x1b[33mcommit b24f6f825324fb939210077c02a8944b59399510\x1b[m\nAuthor: Nuno Lopes <nlopess@php.net>\nDate: Sun Jul 6 15:23:44 2008 +0000\n\n MFB: fix CVE-2008-2371\n\n\x1b[1mdiff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c\x1b[m\n\x1b[1mindex 51a51e1253..0f3ebf93fd 100644\x1b[m\n\x1b[1m--- a/ext/pcre/pcrelib/pcre_compile.c\x1b[m\n\x1b[1m+++ b/ext/pcre/pcrelib/pcre_compile.c\x1b[m\n\x1b[36m@@ -4929,7 +4929,7 @@\x1b[m \x1b[mwe set the flag only if there is a literal "\\r" or "\\n" in the class. */\x1b[m\n (lengthptr == NULL || *lengthptr == 2 + 2*LINK_SIZE))\x1b[m\n {\x1b[m\n cd->external_options = newoptions;\x1b[m\n\x1b[31m- options = newoptions;\x1b[m\n\x1b[32m+\x1b[m\x1b[32m options = *optionsptr = newoptions;\x1b[m\n }\x1b[m\n else\x1b[m\n {\x1b[m\n'
So is there any way to get the format output just like command output in shell. So that I can get the any line I would like.
commit b24f6f825324fb939210077c02a8944b59399510
Author: Nuno Lopes <nlopess@php.net>
Date: Sun Jul 6 15:23:44 2008 +0000
MFB: fix CVE-2008-2371
diff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c
index 51a51e1253..0f3ebf93fd 100644
--- a/ext/pcre/pcrelib/pcre_compile.c
+++ b/ext/pcre/pcrelib/pcre_compile.c
@@ -4929,7 +4929,7 @@ we set the flag only if there is a literal "\r" or "\n" in the class. */
(lengthptr == NULL || *lengthptr == 2 + 2*LINK_SIZE))
{
cd->external_options = newoptions;
- options = newoptions;
+ options = *optionsptr = newoptions;
}
else
{