Skip to content

Instantly share code, notes, and snippets.

@ExtremeGTX
Created March 22, 2019 11:21
Show Gist options
  • Save ExtremeGTX/1ebadf80003d7b8969a3966b10501340 to your computer and use it in GitHub Desktop.
Save ExtremeGTX/1ebadf80003d7b8969a3966b10501340 to your computer and use it in GitHub Desktop.
Python process communication
def ReadSVNLog(BaseRev,rev,variant):
FoundRev = ""
p = subprocess.Popen("svn log --stop-on-copy -r HEAD:{} --search r{} https://mysvn/{}".format(BaseRev,rev,variant) , stdout=subprocess.PIPE, shell=True)
for stdout_line in p.stdout: #Loop on lines printed to stdout
tmp = re.findall(r'r\d+\s|',str(stdout_line.decode('utf-8')))[0] #This is to match rXXXXX in commit msg header
if len(tmp) > 1: #at least rXXXXX
FoundRev = tmp.replace('r','').rstrip()
print("Debug {}".format(FoundRev))
if rev in str(stdout_line):
p.stdout.close()
p.kill()
return FoundRev
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment