roller.repository ================= .. py:module:: roller.repository .. autoapi-nested-parse:: Repository operations for changes-roller. Exceptions ---------- .. autoapisummary:: roller.repository.RepositoryError Classes ------- .. autoapisummary:: roller.repository.Repository Module Contents --------------- .. py:exception:: RepositoryError Bases: :py:obj:`Exception` Exception raised for repository operation errors. .. py:class:: Repository(url, workspace_path) Handles Git repository operations. .. py:attribute:: url .. py:attribute:: workspace_path .. py:attribute:: name .. py:attribute:: path .. py:method:: clone() Clone the repository. Returns True on success. .. py:method:: setup_review() Setup git-review for Gerrit. Returns True on success. .. py:method:: has_changes() Check if repository has uncommitted changes. .. py:method:: stage_all() Stage all changes. Returns True on success. .. py:method:: commit(message) Create a commit with the given message (signed-off). Returns commit hash. .. py:method:: submit_review(topic = None) Submit changes for review using git-review. .. py:method:: run_command(command) Run a shell command in the repository directory. Returns (success, stdout, stderr). .. py:method:: get_current_branch() Get the current branch name. Returns empty string if in detached HEAD. .. py:method:: branch_exists(branch_name) Check if a branch exists locally or remotely (on origin). .. py:method:: branch_exists_locally(branch_name) Check if a branch exists locally. .. py:method:: create_branch(branch_name) Create a new branch. Returns True on success. .. py:method:: checkout_branch(branch_name) Switch to an existing branch. Returns True on success. If the branch exists locally, checks it out directly. If it only exists remotely (on origin), creates a local tracking branch. .. py:method:: has_uncommitted_changes() Check if repository has uncommitted changes (both staged and unstaged). This is the same as has_changes() but with a more descriptive name.