mirror of
https://gitlab.com/bashrc2/epicyon
synced 2026-10-30 17:43:44 +00:00
Extract patch description
This commit is contained in:
1 parent
0beeb438ca
commit
dc68e2c20b
1 file changed
+17
-1
@@ -91,6 +91,22 @@ def getGitHash(patchStr: str) -> str:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def getPatchDescription(patchStr: str) -> str:
|
||||||
|
"""Returns the description from a given patch
|
||||||
|
"""
|
||||||
|
patchLines = patchStr.split('\n')
|
||||||
|
description = ''
|
||||||
|
started = False
|
||||||
|
for line in patchLines:
|
||||||
|
if started:
|
||||||
|
if line.strip() == '---':
|
||||||
|
break
|
||||||
|
description += line + '\n'
|
||||||
|
if line.startswith('Subject:'):
|
||||||
|
started = True
|
||||||
|
return description
|
||||||
|
|
||||||
|
|
||||||
def convertPostToPatch(baseDir: str, nickname: str, domain: str,
|
def convertPostToPatch(baseDir: str, nickname: str, domain: str,
|
||||||
postJsonObject: {}) -> bool:
|
postJsonObject: {}) -> bool:
|
||||||
"""Detects whether the given post contains a patch
|
"""Detects whether the given post contains a patch
|
||||||
@@ -128,7 +144,7 @@ def convertPostToPatch(baseDir: str, nickname: str, domain: str,
|
|||||||
postJsonObject['object']['hash'] = commitHash
|
postJsonObject['object']['hash'] = commitHash
|
||||||
postJsonObject['object']['description'] = {
|
postJsonObject['object']['description'] = {
|
||||||
"mediaType": "text/plain",
|
"mediaType": "text/plain",
|
||||||
"content": patchStr
|
"content": getPatchDescription(patchStr)
|
||||||
}
|
}
|
||||||
# remove content map
|
# remove content map
|
||||||
if postJsonObject['object'].get('contentMap'):
|
if postJsonObject['object'].get('contentMap'):
|
||||||
|
|||||||
Reference in new issue
Block a user