Documentation ¶
Index ¶
- Variables
- func Register(iface Interface)
- type Branch
- type Interface
- type Revision
- type Tag
- type Tester
- type VCS
- func (v *VCS) Branches() ([]*Branch, error)
- func (v *VCS) Checkout(rev string) error
- func (v *VCS) CheckoutAt(rev string, dir string) (*VCS, error)
- func (v *VCS) History(since string) ([]*Revision, error)
- func (v *VCS) Last() (*Revision, error)
- func (v *VCS) Name() string
- func (v *VCS) Revision(id string) (*Revision, error)
- func (v *VCS) Tags() ([]*Tag, error)
- func (v *VCS) Update() error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoVCS is returned when no VCS can be found at the given // path. ErrNoVCS = errors.New("could not find an VCS at the given path") )
Functions ¶
Types ¶
type Interface ¶
type Interface interface { Cmd() string Dir() string Head() string Revision(id string) []string History(since string) []string Checkout(rev string) []string Clone(src string, dst string) []string Update() []string ParseRevisions(since string, data []byte) ([]*Revision, error) Branches() []string Tags() []string ParseBranches(data []byte) ([]*Branch, error) ParseTags(data []byte) ([]*Tag, error) }
Interface is the interface implemented by VCS systems. To register a new one, use Register.
type Tester ¶
type Tester interface { // Test returns true if the absolute directory dir // contains a repository. Test(dir string) bool }
Tester is an optional interface which Interfaces might implement to test if a dir contains a repository which they can understand.
type VCS ¶
type VCS struct { // Dir is the absolute path of the repository root. Dir string // contains filtered or unexported fields }
VCS represents a VCS system on a given directory.
func New ¶
New starts at the given directory and walks up until it finds an VCS. If no VCS could be found, an error is returned.
func NewAt ¶
NewAt works like New, but does not walk up into the the parent directories. Id est, it will only succeed if the given directory is the root directory of a VCS checkout.
func (*VCS) Checkout ¶
Checkout discards all local changes in VCS and updates the working copy to the given revision. If no revision is given, the one returned by v.Last() will be checked out.
func (*VCS) CheckoutAt ¶
CheckoutAt works like Checkout, but creates a copy of the repository at the given directory before perforing the Checkout. The returned VCS is the new one created at dir.
func (*VCS) History ¶
History returns all the revisions from the VCS which are newer than the revision identified by the since parameter, which might be either a short or a long revision identifier. If since is empty, all the history is returned.
func (*VCS) Last ¶
Last returns the last revision from the default branch, known as HEAD in git or tip in mercurial.
func (*VCS) Revision ¶
Revision returns the revision identified by the given id, which might be either a short or a long revision identifier.