forked from indymedia/epicyon
Function for extracting commit hash
parent
08f19f2e8d
commit
555c80a0a9
14
git.py
14
git.py
|
@ -74,6 +74,20 @@ def isGitPatch(baseDir: str, nickname: str, domain: str,
|
|||
return True
|
||||
|
||||
|
||||
def getGitHash(contentStr: str) -> str:
|
||||
"""Returns the commit hash from a given patch
|
||||
"""
|
||||
patchLines = contentStr.split('\n')
|
||||
for line in patchLines:
|
||||
if line.startswith('From '):
|
||||
words = line.split(' ')
|
||||
if len(words) > 1:
|
||||
if len(words[1]) > 20:
|
||||
return words[1]
|
||||
break
|
||||
return None
|
||||
|
||||
|
||||
def gitAddFromHandle(contentStr: str, handle: str) -> str:
|
||||
"""Adds the activitypub handle of the sender to the patch
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue