roller.repository

Repository operations for changes-roller.

Exceptions

RepositoryError

Exception raised for repository operation errors.

Classes

Repository

Handles Git repository operations.

Module Contents

exception roller.repository.RepositoryError[source]

Bases: Exception

Exception raised for repository operation errors.

class roller.repository.Repository(url, workspace_path)[source]

Handles Git repository operations.

url[source]
workspace_path[source]
name[source]
path[source]
clone()[source]

Clone the repository. Returns True on success.

setup_review()[source]

Setup git-review for Gerrit. Returns True on success.

has_changes()[source]

Check if repository has uncommitted changes.

stage_all()[source]

Stage all changes. Returns True on success.

commit(message)[source]

Create a commit with the given message (signed-off). Returns commit hash.

submit_review(topic=None)[source]

Submit changes for review using git-review.

run_command(command)[source]

Run a shell command in the repository directory. Returns (success, stdout, stderr).

get_current_branch()[source]

Get the current branch name. Returns empty string if in detached HEAD.

branch_exists(branch_name)[source]

Check if a branch exists locally or remotely (on origin).

branch_exists_locally(branch_name)[source]

Check if a branch exists locally.

create_branch(branch_name)[source]

Create a new branch. Returns True on success.

checkout_branch(branch_name)[source]

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.

has_uncommitted_changes()[source]

Check if repository has uncommitted changes (both staged and unstaged). This is the same as has_changes() but with a more descriptive name.