Page MenuHomePhorge
Diviner libphutil Tech Docs ArcanistWorkingCopyIdentity

final class ArcanistWorkingCopyIdentity
libphutil Technical Documentation ()

Interfaces with basic information about the working copy.

Tasks

  • public function getProjectConfig($key, $default) — Read a configuration directive from project configuration. This reads ONLY permanent project configuration (i.e., ".arcconfig"), not other configuration sources. See @{method:getConfigFromAnySource} to read from user configuration.
  • public function getLocalConfig($key, $default) — Read a configuration directive from local configuration. This reads ONLY the per-working copy configuration, i.e. .(git|hg|svn)/arc/config, and not other configuration sources. See @{method:getConfigFromAnySource} to read from any config source or @{method:getProjectConfig} to read permanent project-level config.

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.

public static function newDummyWorkingCopy()

This method is not documented.
Return
wild

public static function newFromPath($path)

This method is not documented.
Parameters
$path
Return
wild

private static function newFromPathWithConfig($path, $config)

Locate all the information we need about a directory which we presume to be a working copy. Particularly, we want to discover:

  • Is the directory inside a working copy (hg, git, svn)?
  • If so, what is the root of the working copy?
  • Is there a .arcconfig file?

This is complicated, mostly because Subversion has special rules. In particular:

  • Until 1.7, Subversion put a .svn/ directory inside every directory in a working copy. After 1.7, it only puts one at the root.
  • We allow .arcconfig to appear anywhere in a Subversion working copy, and use the one closest to the directory.
  • Although we may use a .arcconfig from a subdirectory, we store metadata in the root's .svn/, because it's the only one guaranteed to exist.

Users also do these kinds of things in the wild:

  • Put working copies inside other working copies.
  • Put working copies inside .git/ directories.
  • Create .arcconfig files at /.arcconfig, /home/.arcconfig, etc.

This method attempts to be robust against all sorts of possible misconfiguration.

Parameters
string$pathPath to load information for, usually the current working directory (unless running unit tests).
map|null$configPass `null` to locate and load a `.arcconfig` file if one exists. Pass a map to use it to set configuration.
Return
ArcanistWorkingCopyIdentityConstructed working copy identity.

public static function newFromRootAndConfigFile($root, $config_raw, $from_where)

This method is not documented.
Parameters
$root
$config_raw
$from_where
Return
wild

private static function parseRawConfigFile($raw_config, $from_where)

This method is not documented.
Parameters
$raw_config
$from_where
Return
wild

private function __construct($root, $config)

This method is not documented.
Parameters
$root
array$config
Return
this//Implicit.//

public function getProjectRoot()

This method is not documented.
Return
wild

public function getProjectPath($to_file)

This method is not documented.
Parameters
$to_file
Return
wild

public function getVCSType()

This method is not documented.
Return
wild

public function getVCSRoot()

This method is not documented.
Return
wild

public function readProjectConfig()

This method is not documented.
Return
wild

public function getProjectConfig($key, $default)

Read a configuration directive from project configuration. This reads ONLY permanent project configuration (i.e., ".arcconfig"), not other configuration sources. See getConfigFromAnySource() to read from user configuration.

Parameters
key$keyKey to read.
wild$defaultDefault value if key is not found.
Return
wildValue, or default value if not found.

public function getLocalConfig($key, $default)

Read a configuration directive from local configuration. This reads ONLY the per-working copy configuration, i.e. .(git|hg|svn)/arc/config, and not other configuration sources. See getConfigFromAnySource() to read from any config source or getProjectConfig() to read permanent project-level config.

Parameters
$key
$default
Return
wild

public function readLocalArcConfig()

This method is not documented.
Return
wild

public function writeLocalArcConfig($config)

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