You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
960 B

1 month ago
import os
import sys
import re
class P4GetProcess():
def __init__(self, p4path):
self.p4path = p4path
self.clobber = "Can't clobber writable file"
def Run(self):
os.system("p4 sync %s 2> p4log" % self.p4path)
flog=open("p4log",'rb')
lines = flog.readlines()
flog.close()
print(lines)
sys.stdout.flush()
for line in lines:
line = line.decode("utf8","ignore")
if re.search(self.clobber, line):
line = line.replace(self.clobber, "")
print("start force sync %s" % line)
sys.stdout.flush()
os.system("p4 sync -f %s" % line)
return 0
if __name__ == '__main__':
if (2 > len(sys.argv)):
print("args err!")
os._exit(-1)
p4path = sys.argv[1]
p4get = P4GetProcess(p4path)
ret = p4get.Run()
os._exit(ret)