merge

package
v0.0.0-...-094e3b7 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package merge defines methods for merging two snapshots together.

Package merge defines methods for merging two snapshots together.

Package merge defines methods for merging two snapshots together.

Package merge defines methods for merging two snapshots together.

Index

Constants

View Source
const (
	HelperEnvironmentVariable     = "RVCS_MERGE_HELPER_COMMAND"
	HelperArgsEnvironmentVariable = "RVCS_MERGE_HELPER_ARGS"
)

Variables

This section is empty.

Functions

func Base

func Base(ctx context.Context, s *storage.LocalFiles, lhs, rhs *snapshot.Hash) (*snapshot.Hash, error)

Base identifies the "merge base" between two snapshots; the most recent common ancestor of both.

Ancestry for snapshots is defined as follows:

  1. The nil snapshot is an ancestor of every snapshot
  2. Every snapshot is an ancestor of itself
  3. If a snapshot has parents, then every ancestor of one of the parents is also an ancestor of the snapshot.

This means there is always a common ancestor for any two given snapshots, because the nil hash/snapshot is considered an ancestor for all snapshots.

Regardless, this method can still return an error in cases where the snapshot storage is incomplete and some snapshots are missing.

func Checkout

func Checkout(ctx context.Context, s *storage.LocalFiles, h *snapshot.Hash, p snapshot.Path) error

Checkout "checks out" the given snapshot to a new file location.

If any files already exist at the given location, they will be overwritten.

If there are any nested files under the given location that do not exist in the checked out snapshot, then they will be removed.

For regular files and directories, the checked out file permissions will match what the corresponding permissions are in the snapshot. However, for symbolic links, the file permissions from the snapshot are ignored.

If there are any errors during the checkout, then the applied filesystem changes are not rolled back and the local file system can be left in an inconsistent state.

func IsAncestor

func IsAncestor(ctx context.Context, s *storage.LocalFiles, base, h *snapshot.Hash) (bool, error)

func Merge

func Merge(ctx context.Context, s *storage.LocalFiles, src *snapshot.Hash, dest snapshot.Path) error

Merge attempts to automatically merge the given snapshot into the local filesystem at the specified destination path.

If there are any conflicts between the specified snapshot and the local filesystem contents, then the `Merge` method retursn an error without modifying the local filesystem.

In case there are no conflicts but the local storage is missing some referenced snapshots, then it is possible for this method to both modify the local filesystem contents *and* to also return an error. In that case the previous version of the local filesystem contents will be retrievable using the `rvcs log` command.

Types

This section is empty.

Jump to

Keyboard shortcuts

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