Opened 7 years ago

Last modified 4 years ago

#2069 new enhancement

Information on improving P4 object

Reported by: johnwbyrd Owned by:
Priority: patches-accepted Milestone: 0.9.+
Version: 0.8.4p2 Keywords: p4
Cc:

Description

I don't think that this is a "bug" per se -- it's more of information on how I worked around a behavior.

When using Perforce, it is often useful to be able to specify the current branch to the build environment on the target. There are commands like "p4 changes" that report changes on an existing branch.

At least on my Buildbot, I haven't been able to figure out a way to do that with the existing P4 architecture. The following object works around this behavior, and provides a new object that records the current working branch as a property p4branch.

class P4RememberBranch(P4):

""" P4RememberBranch is a class for accessing perforce revision control and recording the working branch. """ name = "P4RememberBranch"

def init(self, kwargs):

P4.init(self, kwargs) self.p4branch = self.p4base + self.branch + r'/'

def startVC(self, branch, revision, patch):

self.build.setProperty('p4branch', self.p4branch, "Source") P4.startVC( self, branch, revision, patch )

Change History (7)

comment:1 Changed 7 years ago by johnwbyrd

Whoops, cut and paste failed. Let's try again.

class P4RememberBranch(P4):
        """ P4RememberBranch is a class for accessing perforce revision control.  """

        name = "P4RememberBranch"
        
        def __init__(self, **kwargs):    
                P4.__init__(self, **kwargs)
                self.p4branch = self.p4base + self.branch + r'/'
                
        def startVC(self, branch, revision, patch):
                self.build.setProperty('p4branch', self.p4branch, "Source")     

                P4.startVC( self, branch, revision, patch )
Last edited 7 years ago by dustin (previous) (diff)

comment:2 Changed 7 years ago by dustin

Can you turn that into a patch? Perforce support in Buildbot is currently orphaned (see https://github.com/buildbot/buildbot/blob/master/MAINTAINERS.txt), but if the patch looks reasonable, and you assure me it works, I don't mind merging it.

comment:3 Changed 7 years ago by dustin

  • Keywords perforce changes removed
  • Milestone changed from undecided to 0.8.+

johnwbyrd - any word?

comment:4 Changed 7 years ago by johnwbyrd

Give me a week or so to understand how Buildbot accepts code into mainline, and I may be able to take over the Perforce port. It does need a touch of help...

comment:5 Changed 7 years ago by dustin

Sure - let me know if you have any questions. Mechanically, I'll take any format you find easiest - github pull request, patch on Trac, emailed patch, ..

Given that I can't test with a real perforce install, tests are pretty critical. Hopefully the test framework on the slave is pretty clear and easy to adapt?

comment:6 Changed 6 years ago by dustin

Any updates here?

comment:7 Changed 4 years ago by dustin

  • Milestone changed from 0.8.+ to 0.9.+

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.