Skip to main content
Enqueue a sync for a repository that has an upstream remote. Required scope: write
sync = await mesa.repos.sync_upstream(repo="app", direction="pull")
print(sync.id, sync.status)

await mesa.repos.sync_upstream(
    repo="app",
    direction="pull",
    ref_globs={
        "branches": "main",
    },
)

Options

repo
str
required
Repository name.
direction
'pull' | 'push'
required
pull fetches from upstream into Mesa. push sends Mesa branches and tags to upstream.
ref_globs
dict | None
Branch and tag glob filters for this sync. Omit this field to sync all supported branches and tags. If provided, include at least one of branches or tags.
ref_globs.branches
str
Glob matched against upstream branch names, such as main, release/*, or *. Omit or use an empty string to match no branches. Do not include refs/heads/.
ref_globs.tags
str
Glob matched against upstream tag names, such as v1.* or *. Omit or use an empty string to match no tags. Do not include refs/tags/.
org
str | None
Organization override.

Response

id
str
Sync ID.
repo_id
str
Repository ID.
direction
'pull' | 'push'
Sync direction.
status
'queued' | 'in_progress' | 'completed' | 'failed'
Current sync status.
attempt
int
Attempt number for this run.
ref_globs
SyncRefGlobs
Branch and tag glob filters for this run.
stats
SyncRunStats | None
Per-ref sync stats, or null until the run reaches a terminal state.
error
str | None
Failure message, or null when no error is present.
created_at
datetime
Creation time.
started_at
datetime | None
Start time, or null if the run has not started.
finished_at
datetime | None
Finish time, or null if the run has not finished.

SyncRefGlobs

branches
str
Branch-name glob for this sync.
tags
str
Tag-name glob for this sync.

SyncRunStats

refs
list[SyncRunRef]
Per-ref sync outcomes. This contains only source refs that matched ref_globs.

SyncRunRef

name
str
Git ref name.
before
str | None
Previous OID, or null when the ref was newly created.
after
str
OID after the sync attempt.
outcome
'updated' | 'unchanged' | 'filtered' | 'rejected'
Result for this ref.