Created
March 22, 2019 11:21
-
-
Save ExtremeGTX/1ebadf80003d7b8969a3966b10501340 to your computer and use it in GitHub Desktop.
Python process communication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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