Remove debug

main
Bob Mottram 2020-05-02 18:15:48 +00:00
parent 25971816a0
commit 0bea2ab9f9
2 changed files with 0 additions and 24 deletions

18
git.py
View File

@ -29,7 +29,6 @@ def getGitProjectName(baseDir: str, nickname: str, domain: str,
and should match against a list of projects which the account and should match against a list of projects which the account
holder wants to receive holder wants to receive
""" """
print('Debug git subject ' + subject)
gitProjectsFilename = \ gitProjectsFilename = \
baseDir + '/accounts/' + nickname + '@' + domain + '/gitprojects.txt' baseDir + '/accounts/' + nickname + '@' + domain + '/gitprojects.txt'
if not os.path.isfile(gitProjectsFilename): if not os.path.isfile(gitProjectsFilename):
@ -46,38 +45,28 @@ def isGitPatch(baseDir: str, nickname: str, domain: str,
"""Is the given post content a git patch? """Is the given post content a git patch?
""" """
# must have a subject line # must have a subject line
print('Debug git 11: ' + content)
if not subject: if not subject:
return False return False
print('Debug git 12')
if '[PATCH]' not in content: if '[PATCH]' not in content:
return False return False
print('Debug git 13')
if '---' not in content: if '---' not in content:
return False return False
print('Debug git 14')
if 'diff ' not in content: if 'diff ' not in content:
return False return False
print('Debug git 15')
if 'From:' not in content: if 'From:' not in content:
return False return False
print('Debug git 16')
if 'Date:' not in content: if 'Date:' not in content:
return False return False
print('Debug git 17')
if 'Subject:' not in content: if 'Subject:' not in content:
return False return False
print('Debug git 18')
if '<br>' not in content: if '<br>' not in content:
if '<br />' not in content: if '<br />' not in content:
return False return False
print('Debug git 19')
projectName = \ projectName = \
getGitProjectName(baseDir, nickname, domain, getGitProjectName(baseDir, nickname, domain,
subject) subject)
if not projectName: if not projectName:
return False return False
print('Debug git 20')
return True return True
@ -85,15 +74,12 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str,
subject: str, content: str) -> bool: subject: str, content: str) -> bool:
"""Receive a git patch """Receive a git patch
""" """
print('Debug git 21')
if not isGitPatch(baseDir, nickname, domain, if not isGitPatch(baseDir, nickname, domain,
subject, content): subject, content):
return False return False
print('Debug git 22')
contentStr = gitFormatContent(content) contentStr = gitFormatContent(content)
print('Debug git 23: ' + contentStr)
patchLines = contentStr.split('\n') patchLines = contentStr.split('\n')
patchFilename = None patchFilename = None
projectDir = None projectDir = None
@ -101,7 +87,6 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str,
baseDir + '/accounts/' + nickname + '@' + domain + \ baseDir + '/accounts/' + nickname + '@' + domain + \
'/patches' '/patches'
# get the subject line and turn it into a filename # get the subject line and turn it into a filename
print('Debug git 24: ' + str(patchLines))
for line in patchLines: for line in patchLines:
if line.startswith('Subject:'): if line.startswith('Subject:'):
patchSubject = \ patchSubject = \
@ -119,9 +104,7 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str,
projectDir + '/' + patchSubject + '.patch' projectDir + '/' + patchSubject + '.patch'
break break
if not patchFilename: if not patchFilename:
print('Debug git 25')
return False return False
print('Debug git 26')
with open(patchFilename, "w") as patchFile: with open(patchFilename, "w") as patchFile:
patchFile.write(contentStr) patchFile.write(contentStr)
patchNotifyFilename = \ patchNotifyFilename = \
@ -130,5 +113,4 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str,
with open(patchNotifyFilename, "w") as patchFile: with open(patchNotifyFilename, "w") as patchFile:
patchFile.write(contentStr) patchFile.write(contentStr)
return True return True
print('Debug git 27')
return False return False

View File

@ -2047,26 +2047,20 @@ def inboxAfterCapabilities(recentPostsCache: {}, maxRecentPosts: int,
postJsonObject, maxMentions, maxEmoji): postJsonObject, maxMentions, maxEmoji):
# check for incoming git patches # check for incoming git patches
print('Debug git 1')
if isinstance(postJsonObject['object'], dict): if isinstance(postJsonObject['object'], dict):
print('Debug git 2')
pprint(postJsonObject) pprint(postJsonObject)
if postJsonObject['object'].get('content') and \ if postJsonObject['object'].get('content') and \
postJsonObject['object'].get('summary'): postJsonObject['object'].get('summary'):
print('Debug git 3')
if receiveGitPatch(baseDir, nickname, domain, if receiveGitPatch(baseDir, nickname, domain,
postJsonObject['object']['summary'], postJsonObject['object']['summary'],
postJsonObject['object']['content']): postJsonObject['object']['content']):
print('Debug git 4')
gitPatchNotify(baseDir, handle, gitPatchNotify(baseDir, handle,
postJsonObject['object']['summary'], postJsonObject['object']['summary'],
postJsonObject['object']['content']) postJsonObject['object']['content'])
elif '[PATCH]' in postJsonObject['object']['content']: elif '[PATCH]' in postJsonObject['object']['content']:
print('Debug git 5')
print('WARN: git patch not accepted - ' + print('WARN: git patch not accepted - ' +
postJsonObject['object']['summary']) postJsonObject['object']['summary'])
return False return False
print('Debug git 6')
# replace YouTube links, so they get less tracking data # replace YouTube links, so they get less tracking data
replaceYouTube(postJsonObject) replaceYouTube(postJsonObject)