So i need to parse thing like this :
commit e397a6e988c05d6fd87ae904303ec0e17f4d79a2
Author: Name <email@email.com>
Date: Sat Jul 9 21:29:10 2011 +0400
commit message
1 files changed, 21 insertions(+), 11 deletions(-)
and get Author name and number of insertions and deletions.
For the name i have this:
re.findall(r"Author: (.+) <",gitLog)
For the numbers i have this:
re.findall(r" (\d+) insertions\S+, (\d+) deletions",gitLog)
But i want to get a list of tuples of name,insertions and delitions with one regular-expression.
I tryed to do somthing like
re.findall(r"Author: (.+) <.+ (\d+) insertions\S+, (\d+) deletions",gitLog,re.DOTALL)
but it returns nothing…
So what is my mistake? How regular-expression should look like?
UPADTE:
wRAR is right, but somehow when i read i file and try to parse it i get the whole file as a name , and then last insertion and deletion, so it matches the whole file but not a single commit… [.+] gets the whole file but not a part of a commit…
If you have access to the repo and not some text dump of
git log, save yourself the parsing trouble and generate different log output:Will produce output of the form:
Which you don’t even need regex for. If you want to keep with regex, you need to match the
(+)after insertions or else it will not match at all and not capture the numbers.