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
- func Base(ctx context.Context, s *storage.LocalFiles, lhs, rhs *snapshot.Hash) (*snapshot.Hash, error)
- func Checkout(ctx context.Context, s *storage.LocalFiles, h *snapshot.Hash, p snapshot.Path) error
- func IsAncestor(ctx context.Context, s *storage.LocalFiles, base, h *snapshot.Hash) (bool, error)
- func Merge(ctx context.Context, s *storage.LocalFiles, src *snapshot.Hash, ...) error
Constants ¶
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:
- The nil snapshot is an ancestor of every snapshot
- Every snapshot is an ancestor of itself
- 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 ¶
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 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.