Documentation
¶
Overview ¶
Package gotwc implements working copies of Got repositories
Index ¶
- func EditConfig(wcRoot *os.Root, fn func(x Config) Config) error
- func Init(repo *gotrepo.Repo, wcRoot *os.Root, cfg Config) error
- func SaveConfig(wcRoot *os.Root, cfg Config) error
- type CommitParams
- type Config
- type ErrWouldClobber
- type FileOperation
- type Span
- type WC
- func (wc *WC) Add(ctx context.Context, paths ...string) error
- func (wc *WC) Checkout(ctx context.Context, name string) error
- func (wc *WC) Cleanup(ctx context.Context) error
- func (wc *WC) Clear(ctx context.Context) error
- func (wc *WC) Clobber(ctx context.Context, p string) error
- func (wc *WC) Close() error
- func (wc *WC) Commit(ctx context.Context, params CommitParams) error
- func (wc *WC) Dir() string
- func (wc *WC) Discard(ctx context.Context, paths ...string) error
- func (wc *WC) DoWithStore(ctx context.Context, fn func(dst stores.RW) error) error
- func (wc *WC) Export(ctx context.Context) error
- func (wc *WC) ForEachDirty(ctx context.Context, fn func(p string, modtime time.Time) error) error
- func (wc *WC) ForEachStaging(ctx context.Context, fn func(p string, op FileOperation) error) error
- func (wc *WC) Fork(ctx context.Context, next string) error
- func (wc *WC) GetActAs() (string, error)
- func (wc *WC) GetHead() (string, error)
- func (wc *WC) ListSpans(ctx context.Context) ([]Span, error)
- func (wc *WC) Put(ctx context.Context, paths ...string) error
- func (wc *WC) Repo() *gotrepo.Repo
- func (wc *WC) Rm(ctx context.Context, paths ...string) error
- func (wc *WC) SetActAs(idenName string) error
- func (wc *WC) SetHead(ctx context.Context, name string) error
- func (wc *WC) StageIsEmpty(ctx context.Context) (bool, error)
- func (wc *WC) Track(ctx context.Context, span Span) error
- func (wc *WC) Untrack(ctx context.Context, span Span) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommitParams ¶
type CommitParams struct {
// Message is the commit message, it is taken from this value as is.
Message string
// Authors is the list of authors of the commit
// if not-nil, it is taken from this value as is.
// If nil, then the Author will be the same as the committer.
Authors []inet256.ID
// AuthoredAt is the time at which the commit was authored, it is taken from this value as is.
AuthoredAt tai64.TAI64
// CommittedAt, if not zero, overrides the commit time
// If CommittedAt is not zero and not >= that of all the parents,
// then an error is returned.
CommittedAt tai64.TAI64
// Committer if not zero, overrides the ID of the committer
Committer inet256.ID
}
type Config ¶
type Config struct {
ID gotrepo.WorkingCopyID `json:"id"`
Head string `json:"head"`
ActAs string `json:"act_as"`
RepoDir string `json:"repo"`
// Tracking is a list of tracked prefixes
Tracking []string `json:"tracking"`
}
func DefaultConfig ¶
func DefaultConfig() Config
type ErrWouldClobber ¶
type ErrWouldClobber = porting.ErrWouldClobber
type FileOperation ¶
type WC ¶
type WC struct {
// contains filtered or unexported fields
}
WC is a Working Copy A WC is a directory in the local filesystem, which has a .got/wc.db file WC are associated with a single repository each.
func Open ¶
Open opens a directory as a WorkingCopy `wcdir` is a directory containing a .got/wc-config file
func (*WC) Add ¶
Add adds paths from the working directory to the staging area. Directories are traversed, and only paths are added. Adding a directory will update any existing paths and add new ones, it will not remove paths from version control
func (*WC) DoWithStore ¶
DoWithStore runs fn with a store for the desired branch
func (*WC) Export ¶
Export overwrites data in the filesystem with data from the Snapshot at HEAD. Only tracked paths are overwritten.
func (*WC) ForEachDirty ¶
ForEachDirty lists all the files which are not in either:
- the staging area
- the active branch head
func (*WC) ForEachStaging ¶
func (*WC) Fork ¶
Fork calls CloneMark on the repo with the current head, creating a new mark `next`. Then the WC's head is set to next.
func (*WC) Put ¶
Put replaces a path (file or directory) with whatever is in the working directory Adding a file updates the file. Adding a directory will delete paths not in the working directory, and add paths in the working directory.
func (*WC) SetHead ¶
SetHead sets HEAD to name SetHead will check if the staging area is not empty, and if it's not the it will check that the desired branch has the same content parameters as the current branch. If one branch is a fork of another, or they have a common ancestor somewhere, the it is very likely that they have the same content parameters.
func (*WC) StageIsEmpty ¶
StageIsEmpty returns (true, nil) IFF there are no changes staged.