cgl.plugins.perforce.utils package

Submodules

cgl.plugins.perforce.utils.config module

cgl.plugins.perforce.utils.config.get_perforce_user_name() str[source]

function to get the perforce user name defaults to alchemy username

cgl.plugins.perforce.utils.config.get_port()[source]

Gets the port being used by the perforce server

Parameters:
  • company

  • project

Returns:

Port specified in the globals

cgl.plugins.perforce.utils.config.get_server_ip()[source]

Gets the IP address of the perforce server :returns: IP address of the server if found in company globals. False if server IP is not found in globals

cgl.plugins.perforce.utils.depot module

cgl.plugins.perforce.utils.depot.create_depot(company, project, world='world')[source]

Creates a new depot in perforce

Parameters:
  • project – Name of the project

  • world – Name of the world

  • depot_name – Name of the new depot

Returns:

True if depot is created, False if depot is not created

cgl.plugins.perforce.utils.depot.delete_depot(company, project, world)[source]

Deletes a depot in perforce

Parameters:
  • depot_name – Name of depot to be deleted

  • project

  • world

Returns:

False if depot does not exist, returns the output of the p4 delete command if the depot does exist

cgl.plugins.perforce.utils.depot.depot_exists(company, project, world)[source]

Checks to see if a specific depot exists in perforce name

Parameters:
  • depot_name – Name of depot to query

  • exists (True if depot)

  • exist (False if depot does not)

cgl.plugins.perforce.utils.depot.get_depot_name(company, project, world)[source]
Parameters:
  • company

  • project

  • world

Returns:

cgl.plugins.perforce.utils.depot.get_depots()[source]

Gets a list of all depot names registered in Perforce.

Returns:

all depot names (e.g. [“DP_jhcs_ttas_test”, “DP_dev_xyz”])

Return type:

list[str]

cgl.plugins.perforce.utils.depot.get_depots_for_project(company: str, project: str) List[str][source]
Return list of depot names matching pattern:

Depot <depotname> … where depotname follows DP_{company}_{project}_{location}

cgl.plugins.perforce.utils.depot.get_shotgrid_locations(project='ASJ')[source]
cgl.plugins.perforce.utils.depot.get_world_from_depot_name(project, depot_name)[source]
cgl.plugins.perforce.utils.depot.initialize_depot(company, project, location)[source]

Create a workspace locally, then create a depot and sync the local workspace to the depot

cgl.plugins.perforce.utils.depot.initialize_new_location(company, project, location)[source]
Parameters:
  • company

  • project

  • location

Returns:

cgl.plugins.perforce.utils.environment module

cgl.plugins.perforce.utils.environment.alchemy_perforce_startup()[source]
cgl.plugins.perforce.utils.environment.check_peforce_connection()[source]
cgl.plugins.perforce.utils.environment.check_perforce_environment_variables()[source]

Ensures that the p4 environment is setup properly Returns:

cgl.plugins.perforce.utils.environment.get_perforce_env_variables()[source]

Gets all the p4 environmental variables currently set Returns:

cgl.plugins.perforce.utils.environment.setup_perforce_environment_variables()[source]

Initial perforce setup for client computer to be able to connect to the server computer

Parameters:
  • company

  • project

Returns:

None

cgl.plugins.perforce.utils.git_operations module

cgl.plugins.perforce.utils.git_operations.ask_for_overwrite(company, project, world)[source]
Parameters:
  • company

  • project

  • world

Returns:

cgl.plugins.perforce.utils.git_operations.check_out_depot(company, project, depot_name, location_name=None)[source]

Creates a local copy of the depot and opens it in Unreal :param project: :param depot_name:

Returns:

cgl.plugins.perforce.utils.git_operations.commit(company, project, world)[source]

Commit all files within specified folder

Parameters:
  • project – Name of project

  • world – Name of world

  • folder – Absolute file path to folder to be committed

cgl.plugins.perforce.utils.git_operations.make_project_files_read_only(project, world)[source]
cgl.plugins.perforce.utils.git_operations.pull(company, project, location, check_for_writable=True)[source]

Pulls world from depot

Parameters:
  • compay – Name of company world belongs to

  • project – Naame of project world belongs to

  • location

    Name of world to be pulled

    Returns:

    True if pull is successful, False if pull is not successful

cgl.plugins.perforce.utils.git_operations.push()[source]

Push changes from workspace to its corresponding depot with default Push Message

Returns:

True if push is successful, False if push is not successful

cgl.plugins.perforce.utils.git_operations.revert(project, world)[source]

cgl.plugins.perforce.utils.user module

cgl.plugins.perforce.utils.user.check_for_user(username)[source]

Function to check if a perforce user exists :param username: Name of the user

Returns: True if user exists, False if user doesnt exist

cgl.plugins.perforce.utils.user.create_user(user_name, super_user, email=None)[source]

Create a perforce user using the computer’s current user :returns: True if successful, False if failed

cgl.plugins.perforce.utils.workspace module

cgl.plugins.perforce.utils.workspace.create_workspace(company, project, location)[source]

Create a workspace for the current perforce user

Parameters:
  • depot_name – name of the depot that this workspace is mapped to

  • workspace_name – Name of the workspace to be created

  • company

  • project

Returns:

The path to the workspace directory on disk

cgl.plugins.perforce.utils.workspace.delete_workspace(path_object=False, workspace_name='')[source]

Delete workspace

Parameters:
  • path_object – Path object for the current project

  • workspace_name – Name of workspace to be deleted

Returns:

Output of the p4 delete command

cgl.plugins.perforce.utils.workspace.get_all_workspaces()[source]

Gets a list of all workspaces registered in perforce

Returns:

List of workspace names

cgl.plugins.perforce.utils.workspace.get_current_workspace()[source]

Gets the current workspace in perforce

Returns:

Name of the current workspace

cgl.plugins.perforce.utils.workspace.get_workspace_name(company, project, world)[source]
cgl.plugins.perforce.utils.workspace.get_workspace_path(company, project, world)[source]

Get the path to the current workspace

Parameters:

project – Name of the project

cgl.plugins.perforce.utils.workspace.switch_to_workspace(company, project, world)[source]

Switches current workspace in perforce

Parameters:
  • workspace_name – Name of the workspace to switch to

  • project

  • world

cgl.plugins.perforce.utils.workspace.workspace_exists(company, project, world)[source]

Checks if the workspace exists

Parameters:

workspace_name – Name of the workspace to query

Returns:

True if the workspace exists, False if the workspace doesn’t exist

Module contents