cli

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Root

func Root() *cobra.Command

Root builds and returns the root cobra command with all subcommands attached.

func RunAdd

func RunAdd(s *store.Store, idx *index.Index, repoRoot string, paths []string) error

RunAdd stages the given paths (relative to repoRoot, or "." for everything).

func RunCheckout

func RunCheckout(s *store.Store, idx *index.Index, repoRoot, commitID, storePath string) error

RunCheckout restores storePath to the version it had at commitID's position in history, writing it to disk and staging the change (aligns with git, which stages on checkout of a path).

func RunCheckoutRepo

func RunCheckoutRepo(s *store.Store, idx *index.Index, repoRoot, commitID string) error

RunCheckoutRepo restores the entire working tree to the state at commitID, staging every resulting change (restores, modifications, and deletions).

func RunClone

func RunClone(repoURL, repoRoot string, id *client.Identity) error

RunClone downloads the server repo at repoURL into repoRoot.

func RunCommit

func RunCommit(s *store.Store, idx *index.Index, message string) (string, error)

RunCommit creates a commit from the current staged entries. Returns the new commit ID.

func RunDiff

func RunDiff(w interface{ WriteString(string) (int, error) }, s *store.Store, idx *index.Index, repoRoot string, stagedMode bool, filterPath string) error

RunDiff writes a unified diff to w. If stagedMode is true, compares staged vs HEAD. Otherwise compares working tree vs HEAD.

func RunInit

func RunInit(repoRoot, repoURL string, id *client.Identity) error

RunInit creates a repo on the server and initialises a local checkout at repoRoot.

func RunMergeAbort

func RunMergeAbort(s *store.Store, idx *index.Index, repoRoot string) error

RunMergeAbort discards an in-progress merge and restores the last committed state.

func RunMirror

func RunMirror(sourceURL, targetURL string, sourceID *client.Identity) (server.MirrorResponse, error)

RunMirror relocates a repo from sourceURL to an empty targetURL. The caller must be an admin (only an admin's view is complete). It reads the full source state — roster, history, objects, grants, roles — and uploads it verbatim to the target, preserving commit ids and seqs. The mirror request is signed with the admin's source key and self-authenticated against the roster it carries. It returns the signer's resulting identity on the target (principal_id preserved; username may be auto-renamed) plus any roster renames.

func RunPull

func RunPull(s *store.Store, idx *index.Index, repoRoot, remoteURL string, id *client.Identity) error

RunPull fetches new server commits and merges them with the local working tree.

func RunPush

func RunPush(s *store.Store, remoteURL string, id *client.Identity) (client.PushResult, error)

RunPush pushes all unpushed local commits to remoteURL, oldest first. If any commit is rejected by OCC, it stops and returns the conflict. Returns the result of the last successfully pushed commit.

func RunReset

func RunReset(s *store.Store, idx *index.Index, repoRoot string) error

RunReset discards all unpushed commits and restores the working tree to the last server-confirmed state.

func RunRm

func RunRm(s *store.Store, idx *index.Index, repoRoot, path string) error

RunRm stages a deletion for the given path.

func RunShow

func RunShow(w interface{ WriteString(string) (int, error) }, s *store.Store, commitID string) error

RunShow prints a single commit to w.

func RunStatus

func RunStatus(w interface{ Write([]byte) (int, error) }, s *store.Store, idx *index.Index, repoRoot string) error

RunStatus writes a git-style status report to w.

func RunWatch

func RunWatch(ctx context.Context, cl *client.Client, pathPrefix, events string, cursor int64, onEvent func(server.EventJSON)) error

RunWatch streams events to onEvent, reconnecting with the last cursor after a disconnect. On each (re)connect the server replays missed commits from the durable log (catch-up), so no accepted commit is missed — the live stream is the fast path, the seq cursor is the recovery anchor.

Types

This section is empty.

Jump to

Keyboard shortcuts

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