Mintu
Mintu

Reputation: 1

Python script for checkout from perforce

I want to write the script in python that will check out the particular tool from perforce. It should also notify when there is any checking related to tools.

Upvotes: 0

Views: 1754

Answers (1)

tkosinski
tkosinski

Reputation: 1696

Two separate items, but first, install P4Python. Once you have that installed, write a python script to do the checkout for you, e.g.,

from P4 import P4,P4Exception 
p4 = P4()                     
p4.port = "perforce:1666"
p4.user = "myuser"
p4.client = "myclient"  
p4.connect()                

p4.run("edit", "//depot/alltools/mytool/mytool.txt")

For the second task, write a new trigger, e.g.,

Triggers:
    toolsubmit change-commit //depot/alltools/... C:\mytriggers\tool_checked_in.py

...where the latter part of the path would be the path to "what you want to run" when something is submitted to the //depot/alltools/... part of the depot (in this case, I would have an email sent to interested parties.

Then again, if only interested parties want to know about something like this, they can add the path to the "Reviews" section of their User.

Upvotes: 2

Related Questions