pythonperforcep4python

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+"/...@"+ Changelist, destination)

Where do I write the description? Right now the description is the command itself.


Solution

  • C:\Perforce\test\python>p4 help populate
    
        populate -- Branch a set of files as a one-step operation
    
        p4 populate [options] fromFile[rev] toFile
        p4 populate [options] -b branch [-r] [toFile[rev]]
        p4 populate [options] -b branch -s fromFile[rev] [toFile]
        p4 populate [options] -S stream [-P parent] [-r] [toFile[rev]]
    
            options: -d description -f -m max -n -o
    

    so:

       result = p4.run(
           "populate", 
           "-d",
           "My awesome description",
           f"{src_path}/...@{changelist}", 
           f"{dst_path}/..."
        )
    

    You can also use the integrate and submit commands (note that this requires that dst_path is part of your client view since the files will be opened on your client prior to submit):

    p4.run("integrate", f"{src_path}/...@{changelist}", f"{dst_path}/...")
    p4.run("submit", "-d", "My awesome description")