Questions tagged [p4python]

p4python is a Python interface to Perforce, a source-code control system.

P4Python: Perforce's API for Python allows you to write Python scripts that directly execute Perforce commands. Documentation can be found here: Helix Core P4Python Developer Guide.

98 questions
1
vote
1 answer

Adding description when branchen in Perforce using P4python

I already figured out how to branch and submit my changes however since I use a project management platform like Jira I also need to write a description on each check ins. This is my code for branching : result = p4.run("populate", Path+"/...@"+…
Payam30
  • 689
  • 1
  • 5
  • 20
1
vote
1 answer

Extract branch name from p4 depot path

Is there any perforce command or p4 util available to extract the branch name out of depot path. For ex I have depot location as "//depot/folder/suffix" and the branch name as "b-folder-suffix". How do I get the branch name from the depot? Is it…
sha
  • 55
  • 2
1
vote
0 answers

P4python needs to check what files are changed in a specific changelist

Using python and p4python I'm trying to shows the files that are changed in a changelist. I result = p4.run_describe("2631893", tagged = 0) This shows the files in a change list and not what is result = p4.run_diff("-sa") shows all the changed…
Payam30
  • 689
  • 1
  • 5
  • 20
1
vote
1 answer

p4python create and submit a new file

How to create and submit a new file using p4python? create_and_submit_file(full_path_in_depot, new_file_text_content): logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) p4 = get_p4() # implemented try: # Catch exceptions with…
user2809176
  • 1,042
  • 12
  • 29
1
vote
1 answer

P4Python issue: p4run("files", 'path') returns - no such file(s) although returns single item dict for "dirs"

I'm trying to read depot structure without syncing and got stuck on files listing. Why this returns single-item dict: p4.run("dirs", '//folder1/Trunk/projects') but this: p4.run("files", '//folder1/Trunk/projects') Error: [Warning]:…
w.wa
  • 35
  • 6
1
vote
3 answers

P4Python check if file is modified after check-out

I need to check-in the file which is in client workspace. Before check-in i need to verify if the file has been changed. Please tell me how to check this.
Rachan R K
  • 211
  • 2
  • 13
1
vote
0 answers

P4Python having trouble deleting client - [Error]: To delete the client, delete any pending changes first

While i am trying to delete a client. I am encountering error What i am doing here is, 1) I create a temp client workspace. (Success) 2) I checkout a file for edit. (Success) 3) I checkin the file. (Success) 4) When i try to delete the client…
Rachan R K
  • 211
  • 2
  • 13
1
vote
0 answers

Login to another user as admin

As a Perforce administrator, I can log in as another user without a password and perform actions: p4 login joe p4 -u joe revert //... I'd like to do this in a Python script, using P4Python. I've tried setting the user field per this answer: from…
jpyams
  • 4,030
  • 9
  • 41
  • 66
1
vote
1 answer

How to download p4 files locally?

I have a problem with downloading files from Perforce. I need to use python for it, so p4python is the best solution i found. Here what I have: def connect(username, password): p4 = P4() p4.port = 'bla.bla.bla.bla:port' p4.user =…
Alex
  • 1,221
  • 2
  • 26
  • 42
1
vote
3 answers

How to use p4tickets with p4python

There's a large number of examples of using your user/pass as credentials to connect to the p4 server using p4python, but very little describing how to use a p4ticket. It's unclear how to use a p4tickets file with p4python.
thechao
  • 367
  • 2
  • 13
1
vote
1 answer

p4python reconcile and fetch_change

I'm trying to use p4python's run_reconcile() combined with a changelist I have from fetch_change(). The code is something like this: p4con.client = 'clientName' p4con.cwd = '//' + location changeList = p4con.fetch_change() # update some…
thechao
  • 367
  • 2
  • 13
1
vote
0 answers

Error while submitting using p4python

I am working with p4python for the first time, running into an issue where i am not able to submit my changes to perforce server. I am able to connect to the server and open files for editing. change_spec = p4.fetch_change() change_spec["Files"] =…
skameswa
  • 33
  • 1
  • 4
1
vote
2 answers

No module named P4API when trying to import P4

I am trying to use Perforce with python. When I did the line: import P4 The error message I got was: Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\P4.py", line 410, in
Dino
  • 23
  • 1
  • 3
1
vote
1 answer

P4Python and global parameters: -d

I'm trying to create a workspace with P4 for Python. Command that works in terminal: p4 -d path client -S //stream name do not work in P4 version: p4.run('-d', path, 'client', '-S', //stream, name) I'm getting "[Error]: "Unknown command. Try…
Kowalski Paweł
  • 594
  • 1
  • 6
  • 27
1
vote
1 answer

Not able to install p4python

I'm trying to install p4python on a freebsd which runs python 2.7.5. Im getting the following error. Using cached p4python-2016.1.1447008.tar.gz Complete output from command python setup.py egg_info: Attempting to load API from…
Mano_mano
  • 13
  • 4