mirror

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mirror implements push/pull mirroring between an EasyVCS repository (revision-native) and an external git server over the local git CLI (no inbound git smart protocol). A push mirror exports a single branch's tree to an external branch; a pull mirror reads a single external branch as a read-only snapshot inside EasyVCS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pull

func Pull(ctx context.Context, repo *store.Repo, cfg PullConfig) (*store.Revision, error)

Pull clones the external branch and records a single snapshot revision for it, repositioning the mirror's branch (default branch) onto that revision. History is not accumulated: each pull replaces the tip tree, so a mirror never exposes a commit-graph of its own (option B).

Types

type PullConfig

type PullConfig struct {
	URL      string
	Branch   string // external branch to snapshot (default "main")
	Token    string
	Interval int // seconds between scheduled pulls; <=0 = manual only
}

PullConfig configures one read-only mirror import of an external branch.

type PushResult

type PushResult struct {
	Target string
	RevID  string
	TreeID string
}

PushResult reports the outcome of a single push.

func Push

func Push(ctx context.Context, repo *store.Repo, t PushTarget) (*PushResult, error)

Push exports the tree of PushTarget.Branch to the external URL with `git push --force`. The target branch keeps exactly that tree; any divergence on the remote is overwritten (mirror semantics).

type PushTarget

type PushTarget struct {
	Name    string
	URL     string
	Branch  string // branch name to export (default "main")
	Token   string
	LastRev string // last pushed revision id (may be empty on first push)
}

PushTarget configures one force-push destination bound to a branch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL