Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
// Path is the relative path to the local file
Path string `json:"path"`
// URL to the remote file
URL string `json:"url"`
// ETag header used for conditional updates
ETag string `json:"etag,omitempty"`
// LastModified header used for conditional updates
LastModified string `json:"last_modified,omitempty"`
// VersionRemote used to compare when listing
VersionRemote string `json:"version_remote,omitempty"`
// VersionLocal tracks the local copy of the file
VersionLocal string `json:"version_local,omitempty"`
// Schema is used to describe the type of the resource, if available.
Schema string `json:"schema,omitempty"`
// Hash is used for detecting local changes
Hash []byte `json:"hash,omitempty"`
}
File represents a checked out file with metadata about the remote and local version(s) of the file.
func (*File) IsChangedLocal ¶
IsChangedLocal returns whether a file has been modified locally. The `ignoreDeleted` parameter sets whether deleted files are considered to be changed or not.
func (*File) IsChangedRemote ¶
IsChangedRemote returns whether the local and remote versions mismatch.
func (*File) Write ¶
Write writes the file to disk. This also updates the local file hash used to determine if the file has been modified.
func (*File) WriteCached ¶
WriteCached writes the file to disk in the special cache directory.
type Meta ¶
type Meta struct {
URL string `json:"url"`
Filter string `json:"filter,omitempty"`
Base string `json:"base,omitempty"`
Schema string `json:"schema,omitempty"`
URLTemplate string `json:"url_template,omitempty"`
Files map[string]*File `json:"files,omitempty"`
}
Meta represents metadata about the remote and local status of the checkout.
func (*Meta) GetChanged ¶
GetChanged calculates all the changed local and remote files using the following rules after refreshing the index: Remote: - Added: No local version or file - Changed: Local version != remote version - Removed: No remote version Local: - Added: Local file with no metadata entry - Changed: Local file hash != remote file hash - Removed: Metadata entry without local file
func (*Meta) Init ¶
Init initializes the metadata file, saves it to disk, and then performs the initial pull to fetch each file.
func (*Meta) Pull ¶
Pull files from the remote. In the case of local changes this will update the index but *not* overwrite the local file containing the edits. When the pull completes, the metadata file is saved.
func (*Meta) PullIndex ¶
PullIndex updates the index of remote files and their versions. It does not save the metadata file.