Page MenuHomePhabricator
Diviner libphutil Tech Docs ArcanistMercurialParser

final class ArcanistMercurialParser
libphutil Technical Documentation ()

Parses output from various "hg" commands into structured data. This class provides low-level APIs for reading "hg" output.

Tasks

Parsing "hg" Output

  • public static function parseMercurialStatusDetails($stdout) — Parse the output of "hg status". This provides detailed information, you can get less detailed information with @{method:parseMercurialStatus}. In particular, this will parse copy sources as per "hg status -C".
  • public static function parseMercurialStatus($stdout) — Parse the output of "hg status". This provides only basic information, you can get more detailed information by invoking @{method:parseMercurialStatusDetails}.
  • public static function parseMercurialLog($stdout) — Parse the output of "hg log". This also parses "hg outgoing", "hg parents", and other similar commands. This assumes "--style default".
  • public static function parseMercurialBranches($stdout) — Parse the output of "hg branches".

Methods

public static function parseMercurialStatusDetails($stdout)

Parse the output of "hg status". This provides detailed information, you can get less detailed information with parseMercurialStatus(). In particular, this will parse copy sources as per "hg status -C".

Parameters
string$stdoutThe stdout from running an "hg status" command.
Return
dictMap of paths to status dictionaries.

public static function parseMercurialStatus($stdout)

Parse the output of "hg status". This provides only basic information, you can get more detailed information by invoking parseMercurialStatusDetails().

Parameters
string$stdoutThe stdout from running an "hg status" command.
Return
dictMap of paths to ArcanistRepositoryAPI status flags.

public static function parseMercurialLog($stdout)

Parse the output of "hg log". This also parses "hg outgoing", "hg parents", and other similar commands. This assumes "--style default".

Parameters
string$stdoutThe stdout from running an "hg log" command.
Return
listList of dictionaries with commit information.

public static function parseMercurialBranches($stdout)

Parse the output of "hg branches".

Parameters
string$stdoutThe stdout from running an "hg branches" command.
Return
listA list of dictionaries with branch information.