Showing posts with label Perforce. Show all posts
Showing posts with label Perforce. Show all posts

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

Add a folder with all files and subfolders to Perforce

Files will be added to default changelist,

dir /b /s /a-d | p4 -x - add