Burgerlib Python
Loading...
Searching...
No Matches
Functions | Variables
burger.perforce Namespace Reference

Package that contains functions to help perforce. More...

Functions

def where_is_p4 (verbose=False, refresh=False, path=None)
 Return the location of the p4 executable. More...
 
def is_under_p4_control (working_directory)
 Test if the directory is under Perforce source control. More...
 
def perforce_command (files, command, verbose=False)
 Given a list of files, send a command to execute on them in perforce. More...
 
def perforce_edit (files, verbose=False)
 Given a list of files, checkout (Edit) them in perforce. More...
 
def perforce_add (files, verbose=False)
 Given a list of files, add them in perforce. More...
 
def perforce_opened (files=None, verbose=False)
 Get the list of opened files in Perforce. More...
 
def make_version_header (working_dir, outputfilename, verbose=False)
 Create a C header with the perforce version. More...
 

Variables

 _PERFORCE_PATH
 Cached location of p4 from Perforce.
 

Detailed Description

Package that contains functions to help perforce.

Function Documentation

◆ is_under_p4_control()

def burger.perforce.is_under_p4_control (   working_directory)

Test if the directory is under Perforce source control.

First test if p4 is installed by calling where_is_p4(). Then use the p4 tool to query if the working directory is under Perforce source control.

Note
On folders that are not under Perforce control, p4 may take as much as 15 seconds to return a result, so use this call with caution.
Parameters
working_directoryDirectory to test.
Returns
True if the directory is under Perforce control, False if not.
See also
where_is_p4

◆ make_version_header()

def burger.perforce.make_version_header (   working_dir,
  outputfilename,
  verbose = False 
)

Create a C header with the perforce version.

This function assumes version control is with perforce!

Get the last change list and create a header with this information (Only modify the output file if the contents have changed)

C++ defines are declared for P4_CHANGELIST, P4_CHANGEDATE, P4_CHANGETIME, P4_CLIENT P4_USER

Parameters
working_dirstring with the path of the folder to obtain the perforce version for
outputfilenamestring with the path of the generated header
verbosePrint perforce commands and other informational messages
Returns
Zero if no error, non-zero on error

◆ perforce_add()

def burger.perforce.perforce_add (   files,
  verbose = False 
)

Given a list of files, add them in perforce.

Pass either a single string or a string list of pathnames of files to checkout in perforce using the "p4 add" command

Parameters
fileslist or string object of file(s) to add
verboseIf True, print the command line and warnings
Returns
Zero if no error, non-zero on error
See also
where_is_p4

◆ perforce_command()

def burger.perforce.perforce_command (   files,
  command,
  verbose = False 
)

Given a list of files, send a command to execute on them in perforce.

Pass either a single string or a string list of pathnames of files to checkout in perforce using the "p4" command with the command name

Parameters
fileslist or string object of file(s) to checkout
commandstring to pass to p4 such as "edit" or "add"
verboseIf True, print the command line and warnings
Returns
Zero if no error, non-zero on error
See also
where_is_p4

◆ perforce_edit()

def burger.perforce.perforce_edit (   files,
  verbose = False 
)

Given a list of files, checkout (Edit) them in perforce.

Pass either a single string or a string list of pathnames of files to checkout in perforce using the "p4 edit" command

Parameters
fileslist or string object of file(s) to checkout
verboseIf True, print the command line and warnings
Returns
Zero if no error, non-zero on error
See also
where_is_p4

◆ perforce_opened()

def burger.perforce.perforce_opened (   files = None,
  verbose = False 
)

Get the list of opened files in Perforce.

Check perforce if any files are opened and if so, return the list of files in Perforce format that are currently opened.

Parameters
filesList of files or directories to check, None for all.
verboseIf True, print the command line and warnings.
Returns
List of opened files, can be empty if no files are opened.
See also
where_is_p4

◆ where_is_p4()

def burger.perforce.where_is_p4 (   verbose = False,
  refresh = False,
  path = None 
)

Return the location of the p4 executable.

Look for an environment variable PERFORCE and determine if the executable resides there, if so, return the string to the path.

PATH is then searched for p4, and if it's not found, None is returned.

Parameters
verboseIf True, print a message if Perforce was not found
refreshIf True, reset the cache and force a reload.
pathPath to Perforce to place in the cache
Returns
A path to the Perforce command line executable or None if not found.
See also
perforce_edit
perforce_add
where_is_git
is_under_p4_control