Page MenuHomePhorge

abstract class PhageWorkflow
libphutil Technical Documentation (Phage)

This class is not documented.

Tasks

Conduit

  • final public function setConduitURI($conduit_uri) — Set the URI which the workflow will open a conduit connection to when @{method:establishConduit} is called. Arcanist makes an effort to set this by default for all workflows (by reading ##.arcconfig## and/or the value of ##--conduit-uri##) even if they don't need Conduit, so a workflow can generally upgrade into a conduit workflow later by just calling @{method:establishConduit}.
  • final public function getConduitURI() — Returns the URI the conduit connection within the workflow uses.
  • final public function establishConduit() — Open a conduit channel to the server which was previously configured by calling @{method:setConduitURI}. Arcanist will do this automatically if the workflow returns ##true## from @{method:requiresConduit}, or you can later upgrade a workflow and build a conduit by invoking it manually.
  • final public function setConduitCredentials($credentials) — Set credentials which will be used to authenticate against Conduit. These credentials can then be used to establish an authenticated connection to conduit by calling @{method:authenticateConduit}. Arcanist sets some defaults for all workflows regardless of whether or not they return true from @{method:requireAuthentication}, based on the ##~/.arcrc## and ##.arcconf## files if they are present. Thus, you can generally upgrade a workflow which does not require authentication into an authenticated workflow by later invoking @{method:requireAuthentication}. You should not normally need to call this method unless you are specifically overriding the defaults.
  • final public function getConduitVersion() — Get the protocol version the client should identify with.
  • final public function authenticateConduit() — Open and authenticate a conduit connection to a Phabricator server using provided credentials. Normally, Arcanist does this for you automatically when you return true from @{method:requiresAuthentication}, but you can also upgrade an existing workflow to one with an authenticated conduit by invoking this method manually.
  • final protected function isConduitAuthenticated()
  • public function requiresConduit() — Override this to return true if your workflow requires a conduit channel. Arc will build the channel for you before your workflow executes. This implies that you only need an unauthenticated channel; if you need authentication, override @{method:requiresAuthentication}.
  • public function requiresAuthentication() — Override this to return true if your workflow requires an authenticated conduit channel. This implies that it requires a conduit. Arc will build and authenticate the channel for you before the workflow executes.
  • final public function getUserPHID() — Returns the PHID for the user once they've authenticated via Conduit.
  • final public function getUserName() — Return the username for the user once they've authenticated via Conduit.
  • final public function getConduit() — Get the established @{class@libphutil:ConduitClient} in order to make Conduit method calls. Before the client is available it must be connected, either implicitly by making @{method:requireConduit} or @{method:requireAuthentication} return true, or explicitly by calling @{method:establishConduit} or @{method:authenticateConduit}.

Scratch Files

  • final protected function readScratchFile($path) — Try to read a scratch file, if it exists and is readable.
  • final protected function readScratchJSONFile($path) — Try to read a scratch JSON file, if it exists and is readable.
  • final protected function writeScratchFile($path, $data) — Try to write a scratch file, if there's somewhere to put it and we can write there.
  • final protected function writeScratchJSONFile($path, $data) — Try to write a scratch JSON file, if there's somewhere to put it and we can write there.
  • final protected function removeScratchFile($path) — Try to remove a scratch file.
  • final protected function getReadableScratchFilePath($path) — Get a human-readable description of the scratch file location.
  • final protected function getScratchFilePath($path) — Get the path to a scratch file, if possible.

Phabricator Repositories

  • final protected function getRepositoryPHID() — Get the PHID of the Phabricator repository this working copy corresponds to. Returns `null` if no repository can be identified.
  • final protected function getRepositoryName() — Get the name of the Phabricator repository this working copy corresponds to. Returns `null` if no repository can be identified.
  • final protected function getRepositoryURI() — Get the URI of the Phabricator repository this working copy corresponds to. Returns `null` if no repository can be identified.
  • final protected function getRepositoryReasons() — Get human-readable reasoning explaining how `arc` evaluated which Phabricator repository corresponds to this working copy. Used by `arc which` to explain the process to users.
  • private function getRepositoryInformation()
  • private function loadRepositoryInformation()
  • private function getRepositoryQuery()

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

final public function setToolset($toolset)
Inherited

This method is not documented.
Parameters
ArcanistToolset$toolset
Return
wild

final public function getToolset()
Inherited

This method is not documented.
Return
wild

final public function setRuntime($runtime)
Inherited

This method is not documented.
Parameters
ArcanistRuntime$runtime
Return
wild

final public function getRuntime()
Inherited

This method is not documented.
Return
wild

final public function setConfigurationEngine($engine)
Inherited

This method is not documented.
Parameters
ArcanistConfigurationEngine$engine
Return
wild

final public function getConfigurationEngine()
Inherited

This method is not documented.
Return
wild

final public function setConfigurationSourceList($list)
Inherited

This method is not documented.
Parameters
ArcanistConfigurationSourceList$list
Return
wild

final public function getConfigurationSourceList()
Inherited

This method is not documented.
Return
wild

public function newPhutilWorkflow()
Inherited

This method is not documented.
Return
wild

final public function newLegacyPhutilWorkflow()
Inherited

This method is not documented.
Return
wild

final protected function newWorkflowArgument($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

final protected function newWorkflowInformation()
Inherited

This method is not documented.
Return
wild

final public function executeWorkflow($args)
Inherited

This method is not documented.
Parameters
PhutilArgumentParser$args
Return
wild

final public function getLogEngine()
Inherited

This method is not documented.
Return
wild

protected function runWorkflowCleanup()
Inherited

This method is not documented.
Return
wild

public function __construct()
Inherited

This method is not documented.
Return
this//Implicit.//

public function run()
Inherited

This method is not documented.
Return
wild

public function finalize()
Inherited

ArcanistWorkflow

Finalizes any cleanup operations that need to occur regardless of whether the command succeeded or failed.

Return
wild

abstract public function getWorkflowName()
Inherited

ArcanistWorkflow

Return the command used to invoke this workflow from the command like, e.g. "help" for ArcanistHelpWorkflow.

Return
stringThe command a user types to invoke this workflow.

public function getCommandSynopses()
Inherited

ArcanistWorkflow

Return console formatted string with all command synopses.

Return
string6-space indented list of available command synopses.

public function getCommandHelp()
Inherited

ArcanistWorkflow

Return console formatted string with command help printed in arc help.

Return
string10-space indented help to use the command.

public function supportsToolset($toolset)

This method is not documented.
Parameters
ArcanistToolset$toolset
Return
wild

final public function setConduitURI($conduit_uri)
Inherited

ArcanistWorkflow

Set the URI which the workflow will open a conduit connection to when establishConduit() is called. Arcanist makes an effort to set this by default for all workflows (by reading .arcconfig and/or the value of --conduit-uri) even if they don't need Conduit, so a workflow can generally upgrade into a conduit workflow later by just calling establishConduit().

You generally should not need to call this method unless you are specifically overriding the default URI. It is normally sufficient to just invoke establishConduit().

NOTE: You can not call this after a conduit has been established.
Parameters
string$conduit_uriThe URI to open a conduit to when @{method:establishConduit} is called.
Return
this

final public function getConduitURI()
Inherited

ArcanistWorkflow

Returns the URI the conduit connection within the workflow uses.

Return
string

final public function establishConduit()
Inherited

ArcanistWorkflow

Open a conduit channel to the server which was previously configured by calling setConduitURI(). Arcanist will do this automatically if the workflow returns true from requiresConduit(), or you can later upgrade a workflow and build a conduit by invoking it manually.

You must establish a conduit before you can make conduit calls.

NOTE: You must call setConduitURI() before you can call this method.
Return
this

final public function getConfigFromAnySource($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

final public function setConduitCredentials($credentials)
Inherited

ArcanistWorkflow

Set credentials which will be used to authenticate against Conduit. These credentials can then be used to establish an authenticated connection to conduit by calling authenticateConduit(). Arcanist sets some defaults for all workflows regardless of whether or not they return true from requireAuthentication(), based on the ~/.arcrc and

.arcconf## files if they are present. Thus, you can generally upgrade a

workflow which does not require authentication into an authenticated workflow by later invoking requireAuthentication(). You should not normally need to call this method unless you are specifically overriding the defaults.

NOTE: You can not call this method after calling authenticateConduit().
Parameters
dict$credentialsA credential dictionary, see @{method:authenticateConduit}.
Return
this

final public function getConduitVersion()
Inherited

ArcanistWorkflow

Get the protocol version the client should identify with.

Return
intVersion the client should claim to be.

final public function authenticateConduit()
Inherited

ArcanistWorkflow

Open and authenticate a conduit connection to a Phabricator server using provided credentials. Normally, Arcanist does this for you automatically when you return true from requiresAuthentication(), but you can also upgrade an existing workflow to one with an authenticated conduit by invoking this method manually.

You must authenticate the conduit before you can make authenticated conduit calls (almost all calls require authentication).

This method uses credentials provided via setConduitCredentials() to authenticate to the server:

  • user (required) The username to authenticate with.
  • certificate (required) The Conduit certificate to use.
  • description (optional) Description of the invoking command.

Successful authentication allows you to call getUserPHID() and getUserName(), as well as use the client you access with getConduit() to make authenticated calls.

NOTE: You must call setConduitURI() and setConduitCredentials() before you invoke this method.
Return
this

final protected function isConduitAuthenticated()
Inherited

This method is not documented.
Return
boolTrue if conduit is authenticated, false otherwise.

public function requiresConduit()
Inherited

ArcanistWorkflow

Override this to return true if your workflow requires a conduit channel. Arc will build the channel for you before your workflow executes. This implies that you only need an unauthenticated channel; if you need authentication, override requiresAuthentication().

Return
boolTrue if arc should build a conduit channel before running the workflow.

public function requiresAuthentication()
Inherited

ArcanistWorkflow

Override this to return true if your workflow requires an authenticated conduit channel. This implies that it requires a conduit. Arc will build and authenticate the channel for you before the workflow executes.

Return
boolTrue if arc should build an authenticated conduit channel before running the workflow.

final public function getUserPHID()
Inherited

ArcanistWorkflow

Returns the PHID for the user once they've authenticated via Conduit.

Return
phidAuthenticated user PHID.

final public function getUserName()
Inherited

ArcanistWorkflow

Return the username for the user once they've authenticated via Conduit.

Return
stringAuthenticated username.

final public function getConduit()
Inherited

ArcanistWorkflow

Get the established ConduitClient in order to make Conduit method calls. Before the client is available it must be connected, either implicitly by making requireConduit() or requireAuthentication() return true, or explicitly by calling establishConduit() or authenticateConduit().

Return
@{class@libphutil:ConduitClient}Live conduit client.

final public function setArcanistConfiguration($arcanist_configuration)
Inherited

This method is not documented.
Parameters
ArcanistConfiguration$arcanist_configuration
Return
wild

final public function getArcanistConfiguration()
Inherited

This method is not documented.
Return
wild

final public function setConfigurationManager($arcanist_configuration_manager)
Inherited

This method is not documented.
Parameters
ArcanistConfigurationManager$arcanist_configuration_manager
Return
wild

final public function getConfigurationManager()
Inherited

This method is not documented.
Return
wild

public function requiresWorkingCopy()
Inherited

This method is not documented.
Return
wild

public function desiresWorkingCopy()
Inherited

This method is not documented.
Return
wild

public function requiresRepositoryAPI()
Inherited

This method is not documented.
Return
wild

public function desiresRepositoryAPI()
Inherited

This method is not documented.
Return
wild

final public function setCommand($command)
Inherited

This method is not documented.
Parameters
$command
Return
wild

final public function getCommand()
Inherited

This method is not documented.
Return
wild

public function getArguments()
Inherited

This method is not documented.
Return
wild

final public function setWorkingDirectory($working_directory)
Inherited

This method is not documented.
Parameters
$working_directory
Return
wild

final public function getWorkingDirectory()
Inherited

This method is not documented.
Return
wild

private function setParentWorkflow($parent_workflow)
Inherited

This method is not documented.
Parameters
$parent_workflow
Return
wild

final protected function getParentWorkflow()
Inherited

This method is not documented.
Return
wild

final public function buildChildWorkflow($command, $argv)
Inherited

This method is not documented.
Parameters
$command
array$argv
Return
wild

final public function getArgument($key, $default)
Inherited

This method is not documented.
Parameters
$key
$default
Return
wild

final public function getCompleteArgumentSpecification()
Inherited

This method is not documented.
Return
wild

final public function parseArguments($args)
Inherited

This method is not documented.
Parameters
array$args
Return
wild

protected function didParseArguments()
Inherited

This method is not documented.
Return
wild

final public function getWorkingCopy()
Inherited

This method is not documented.
Return
wild

final public function getWorkingCopyIdentity()
Inherited

This method is not documented.
Return
wild

final public function setRepositoryAPI($api)
Inherited

This method is not documented.
Parameters
$api
Return
wild

final public function hasRepositoryAPI()
Inherited

This method is not documented.
Return
wild

final public function getRepositoryAPI()
Inherited

This method is not documented.
Return
wild

final protected function shouldRequireCleanUntrackedFiles()
Inherited

This method is not documented.
Return
wild

final public function setCommitMode($mode)
Inherited

This method is not documented.
Parameters
$mode
Return
wild

final public function finalizeWorkingCopy()
Inherited

This method is not documented.
Return
wild

final public function requireCleanWorkingCopy()
Inherited

This method is not documented.
Return
wild

private function getShouldAmend()
Inherited

This method is not documented.
Return
wild

private function calculateShouldAmend()
Inherited

This method is not documented.
Return
wild

private function askForAdd($files)
Inherited

This method is not documented.
Parameters
array$files
Return
wild

private function getAskForAddPrompt($files)
Inherited

This method is not documented.
Parameters
array$files
Return
wild

final protected function loadDiffBundleFromConduit($conduit, $diff_id)
Inherited

This method is not documented.
Parameters
ConduitClient$conduit
$diff_id
Return
wild

final protected function loadRevisionBundleFromConduit($conduit, $revision_id)
Inherited

This method is not documented.
Parameters
ConduitClient$conduit
$revision_id
Return
wild

private function loadBundleFromConduit($conduit, $params)
Inherited

This method is not documented.
Parameters
ConduitClient$conduit
$params
Return
wild

final protected function getChangedLines($path, $mode)
Inherited

ArcanistWorkflow

Return a list of lines changed by the current diff, or null if the change list is meaningless (for example, because the path is a directory or binary file).

Parameters
string$pathPath within the repository.
string$modeChange selection mode (see ArcanistDiffHunk).
Return
list|nullList of changed line numbers, or null to indicate that the path is not a line-oriented text file.

final protected function getChange($path)
Inherited

This method is not documented.
Parameters
$path
Return
wild

final public function willRunWorkflow()
Inherited

This method is not documented.
Return
wild

final protected function normalizeRevisionID($revision_id)
Inherited

This method is not documented.
Parameters
$revision_id
Return
wild

protected function shouldShellComplete()
Inherited

This method is not documented.
Return
wild

protected function getShellCompletions($argv)
Inherited

This method is not documented.
Parameters
array$argv
Return
wild

public function getSupportedRevisionControlSystems()
Inherited

This method is not documented.
Return
wild

final protected function getPassthruArgumentsAsMap($command)
Inherited

This method is not documented.
Parameters
$command
Return
wild

final protected function getPassthruArgumentsAsArgv($command)
Inherited

This method is not documented.
Parameters
$command
Return
wild

final protected function writeStatusMessage($msg)
Inherited

ArcanistWorkflow

Write a message to stderr so that '--json' flags or stdout which is meant to be piped somewhere aren't disrupted.

Parameters
string$msgMessage to write to stderr.
Return
void

final public function writeInfo($title, $message)
Inherited

This method is not documented.
Parameters
$title
$message
Return
wild

final public function writeWarn($title, $message)
Inherited

This method is not documented.
Parameters
$title
$message
Return
wild

final public function writeOkay($title, $message)
Inherited

This method is not documented.
Parameters
$title
$message
Return
wild

final protected function isHistoryImmutable()
Inherited

This method is not documented.
Return
wild

final protected function selectPathsForWorkflow($paths, $rev, $omit_mask)
Inherited

ArcanistWorkflow

Workflows like 'lint' and 'unit' operate on a list of working copy paths. The user can either specify the paths explicitly ("a.js b.php"), or by specifying a revision ("--rev a3f10f1f") to select all paths modified since that revision, or by omitting both and letting arc choose the default relative revision.

This method takes the user's selections and returns the paths that the workflow should act upon.

Parameters
list$pathsList of explicitly provided paths.
string|null$revRevision name, if provided.
mask$omit_maskMask of ArcanistRepositoryAPI flags to exclude. Defaults to ArcanistRepositoryAPI::FLAG_UNTRACKED.
Return
listList of paths the workflow should act on.

final protected function renderRevisionList($revisions)
Inherited

This method is not documented.
Parameters
array$revisions
Return
wild

final protected function readScratchFile($path)
Inherited

ArcanistWorkflow

Try to read a scratch file, if it exists and is readable.

Parameters
string$pathScratch file name.
Return
mixedString for file contents, or false for failure.

final protected function readScratchJSONFile($path)
Inherited

ArcanistWorkflow

Try to read a scratch JSON file, if it exists and is readable.

Parameters
string$pathScratch file name.
Return
arrayEmpty array for failure.

final protected function writeScratchFile($path, $data)
Inherited

ArcanistWorkflow

Try to write a scratch file, if there's somewhere to put it and we can write there.

Parameters
string$pathScratch file name to write.
string$dataData to write.
Return
boolTrue on success, false on failure.

final protected function writeScratchJSONFile($path, $data)
Inherited

ArcanistWorkflow

Try to write a scratch JSON file, if there's somewhere to put it and we can write there.

Parameters
string$pathScratch file name to write.
array$dataData to write.
Return
boolTrue on success, false on failure.

final protected function removeScratchFile($path)
Inherited

ArcanistWorkflow

Try to remove a scratch file.

Parameters
string$pathScratch file name to remove.
Return
boolTrue if the file was removed successfully.

final protected function getReadableScratchFilePath($path)
Inherited

ArcanistWorkflow

Get a human-readable description of the scratch file location.

Parameters
string$pathScratch file name.
Return
mixedString, or false on failure.

final protected function getScratchFilePath($path)
Inherited

ArcanistWorkflow

Get the path to a scratch file, if possible.

Parameters
string$pathScratch file name.
Return
mixedFile path, or false on failure.

final protected function getRepositoryEncoding()
Inherited

This method is not documented.
Return
wild

final protected function loadProjectRepository()
Inherited

This method is not documented.
Return
wild

final protected function newInteractiveEditor($text)
Inherited

This method is not documented.
Parameters
$text
Return
wild

final protected function newDiffParser()
Inherited

This method is not documented.
Return
wild

final protected function dispatchEvent($type, $data)
Inherited

This method is not documented.
Parameters
$type
array$data
Return
wild

final public function parseBaseCommitArgument($argv)
Inherited

This method is not documented.
Parameters
array$argv
Return
wild

final protected function getRepositoryVersion()
Inherited

This method is not documented.
Return
wild

final protected function getRepositoryPHID()
Inherited

ArcanistWorkflow

Get the PHID of the Phabricator repository this working copy corresponds to. Returns null if no repository can be identified.

Return
phid|nullRepository PHID, or null if no repository can be identified.

final protected function getRepositoryName()
Inherited

ArcanistWorkflow

Get the name of the Phabricator repository this working copy corresponds to. Returns null if no repository can be identified.

Return
string|nullRepository name, or null if no repository can be identified.

final protected function getRepositoryURI()
Inherited

ArcanistWorkflow

Get the URI of the Phabricator repository this working copy corresponds to. Returns null if no repository can be identified.

Return
string|nullRepository URI, or null if no repository can be identified.

final protected function getRepositoryStagingConfiguration()
Inherited

This method is not documented.
Return
wild

final protected function getRepositoryReasons()
Inherited

ArcanistWorkflow

Get human-readable reasoning explaining how arc evaluated which Phabricator repository corresponds to this working copy. Used by arc which to explain the process to users.

Return
list<string>Human-readable explanation of the repository association process.

private function getRepositoryInformation()
Inherited

This method is not documented.
Return
wild

private function loadRepositoryInformation()
Inherited

This method is not documented.
Return
wild

private function getRepositoryQuery()
Inherited

This method is not documented.
Return
wild

protected function newLintEngine($engine_class)
Inherited

ArcanistWorkflow

Build a new lint engine for the current working copy.

Optionally, you can pass an explicit engine class name to build an engine of a particular class. Normally this is used to implement an --engine flag from the CLI.

Parameters
string$engine_classOptional explicit engine class name.
Return
ArcanistLintEngineConstructed engine.

protected function newUnitTestEngine($engine_class)
Inherited

ArcanistWorkflow

Build a new unit test engine for the current working copy.

Optionally, you can pass an explicit engine class name to build an engine of a particular class. Normally this is used to implement an --engine flag from the CLI.

Parameters
string$engine_classOptional explicit engine class name.
Return
ArcanistUnitTestEngineConstructed engine.

protected function openURIsInBrowser($uris)
Inherited

This method is not documented.
Parameters
array$uris
Return
wild

private function getBrowserCommand()
Inherited

This method is not documented.
Return
wild

protected function askForRepositoryUpdate()
Inherited

ArcanistWorkflow

Ask Phabricator to update the current repository as soon as possible.

Calling this method after pushing commits allows Phabricator to discover the commits more quickly, so the system overall is more responsive.

Return
void

protected function getModernLintDictionary($map)
Inherited

This method is not documented.
Parameters
array$map
Return
wild

protected function getModernUnitDictionary($map)
Inherited

This method is not documented.
Parameters
array$map
Return
wild

private function getModernCommonDictionary($map)
Inherited

This method is not documented.
Parameters
array$map
Return
wild

final public function setConduitEngine($conduit_engine)
Inherited

This method is not documented.
Parameters
ArcanistConduitEngine$conduit_engine
Return
wild

final public function getConduitEngine()
Inherited

This method is not documented.
Return
wild

final public function getRepositoryRef()
Inherited

This method is not documented.
Return
wild

final public function getToolsetKey()
Inherited

This method is not documented.
Return
wild

final public function getConfig($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

public function canHandleSignal($signo)
Inherited

This method is not documented.
Parameters
$signo
Return
wild

public function handleSignal($signo)
Inherited

This method is not documented.
Parameters
$signo
Return
wild

final public function newCommand($future)
Inherited

This method is not documented.
Parameters
PhutilExecutableFuture$future
Return
wild

final public function loadHardpoints($objects, $requests)
Inherited

This method is not documented.
Parameters
$objects
$requests
Return
wild

protected function newPrompts()
Inherited

This method is not documented.
Return
wild

protected function newPrompt($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

public function hasPrompt($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

public function getPromptMap()
Inherited

This method is not documented.
Return
wild

final public function getPrompt($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

final protected function getSymbolEngine()
Inherited

This method is not documented.
Return
wild

final protected function getViewer()
Inherited

This method is not documented.
Return
wild

final protected function readStdin()
Inherited

This method is not documented.
Return
wild

final public function getAbsoluteURI($raw_uri)
Inherited

This method is not documented.
Parameters
$raw_uri
Return
wild

final public function writeToPager($corpus)
Inherited

This method is not documented.
Parameters
$corpus
Return
wild