P4Python

#Needs p4python installed
#P4Utility
import os
import sys
from P4 import P4

class P4Utils:
    def __init__(self,user,port,client):
        self.p4 = P4()
        self.p4.user = user
        self.p4.port = port
        self.p4.client = client
    def connectToP4(self):
        try:
            self.p4.connect()
        except:
            print "Error in Connecting to P4"
    def do_sync(self,depot):
        try:
            output = self.p4.run("sync",depot)
            return output
        except:
            output = "Files up-to-date"
            return output
    def do_changes(self,depot):
        output = self.p4.run("changes",depot)
        return output

No comments: