phabricator

Phabricator module.

class spicerack.phabricator.Phabricator(phabricator_client, dry_run=True)[source]

Bases: object

Class to interact with a Phabricator website.

__init__(phabricator_client, dry_run=True)[source]

Initialize the Phabricator client from the bot config file.

Parameters:
  • phabricator_client (phabricator.Phabricator) -- a Phabricator client instance.
  • dry_run (bool, optional) -- whether this is a DRY-RUN.
task_comment(task_id, comment)[source]

Add a comment on a Phabricator task.

Parameters:
  • task_id (str) -- the Phabricator task ID (T12345) to be updated.
  • comment (str) -- the message to add to the task.
Raises:

spicerack.phabricator.PhabricatorError -- if unable to update the task.

exception spicerack.phabricator.PhabricatorError[source]

Bases: spicerack.exceptions.SpicerackError

Custom exception class for errors of the Phabricator class.

spicerack.phabricator.create_phabricator(bot_config_file, section='phabricator_bot', dry_run=True)[source]

Initialize the Phabricator client from the bot config file.

Parameters:
  • bot_config_file (str) --

    the path to the configuration file for the Phabricator bot, with the following structure:

    [section_name]
    host = https://phabricator.example.org/api/
    username = phab-bot
    token = api-12345
    
  • section (str, optional) -- the name of the section of the configuration file where to find the required parameters.
  • dry_run (bool, optional) -- whether this is a DRY-RUN.
Returns:

a Phabricator instance.

Return type:

spicerack.phabricator.Phabricator

Raises:

spicerack.phabricator.PhabricatorError -- if unable to get all the required parameters from the bot configuration file, or to initialize the Phabricator client.