phabricator

Phabricator module.

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

Bases: object

Class to interact with a Phabricator website.

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: str, comment: str) → None[source]

Add a comment on a Phabricator task.

Parameters
  • task_id (str) -- the Phabricator task ID (e.g. 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: str, section: str = 'phabricator_bot', dry_run: bool = True) → phabricator.Phabricator[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.com/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.