Documentation
¶
Index ¶
- Constants
- Variables
- func CommitHead(s Store, name string, sum []byte, commit *objects.Commit, txid *uuid.UUID) error
- func CommitMerge(s Store, branch string, sum []byte, commit *objects.Commit) error
- func CopyRef(s Store, srcName, dstName string) (sum []byte, err error)
- func DeleteAllRemoteRefs(s Store, remote string) error
- func DeleteHead(s Store, name string) error
- func DeleteRef(s Store, name string) error
- func DeleteRemoteRef(s Store, remote, name string) error
- func DeleteTag(s Store, name string) error
- func DeleteTransactionRefs(s Store, id uuid.UUID) error
- func FirstLine(s string) string
- func GetHead(s Store, name string) ([]byte, error)
- func GetRef(s Store, name string) ([]byte, error)
- func GetRemoteRef(s Store, remote, name string) ([]byte, error)
- func GetTag(s Store, name string) ([]byte, error)
- func HeadRef(name string) string
- func InterpretCommitName(db objects.Store, rs Store, commitStr string, excludeTag bool) (name string, hash []byte, commit *objects.Commit, err error)
- func IsAncestorOf(db objects.Store, commit1, commit2 []byte) (ok bool, err error)
- func ListAllRefs(s Store) (map[string][]byte, error)
- func ListHeads(s Store) (map[string][]byte, error)
- func ListLocalRefs(s Store, prefixes, notPrefixes []string) (map[string][]byte, error)
- func ListRemoteRefs(s Store, remote string) (map[string][]byte, error)
- func ListTags(s Store) (map[string][]byte, error)
- func ListTransactionRefs(s Store, id uuid.UUID) (map[string][]byte, error)
- func ParseNavigationChars(commitStr string) (commitName string, numPeel int, err error)
- func PeelCommit(db objects.Store, hash []byte, commit *objects.Commit, numPeel int) ([]byte, *objects.Commit, error)
- func RemoteRef(remote, name string) string
- func RenameAllRemoteRefs(s Store, oldRemote, newRemote string) error
- func RenameRef(s Store, oldName, newName string) (sum []byte, err error)
- func SaveFetchRef(s Store, name string, commit []byte, ...) error
- func SaveRef(s Store, name string, commit []byte, ...) error
- func SaveRemoteRef(s Store, remote, name string, commit []byte, ...) error
- func SaveTag(s Store, name string, sum []byte) error
- func SaveTransactionRef(s Store, tid uuid.UUID, branch string, sum []byte) error
- func SeekCommonAncestor(db objects.Store, commits ...[]byte) (baseCommit []byte, err error)
- func TransactionRef(tid, branch string) string
- type CommitsQueue
- func (q *CommitsQueue) Insert(sum []byte) (err error)
- func (q *CommitsQueue) InsertParents(c *objects.Commit) (err error)
- func (q *CommitsQueue) Len() int
- func (q *CommitsQueue) Less(i, j int) bool
- func (q *CommitsQueue) Pop() (sum []byte, commit *objects.Commit, err error)
- func (q *CommitsQueue) PopInsertParents() (sum []byte, commit *objects.Commit, err error)
- func (q *CommitsQueue) PopUntil(b []byte) (sum []byte, commit *objects.Commit, err error)
- func (q *CommitsQueue) RemoveAncestors(sums [][]byte) error
- func (q *CommitsQueue) Reset(initialSums [][]byte) error
- func (q *CommitsQueue) Seen(b []byte) bool
- func (q *CommitsQueue) Swap(i, j int)
- type Reflog
- type ReflogReader
- type Store
- type Transaction
- type TransactionStatus
- type Traveller
Constants ¶
View Source
const ( HeadPrefix = "heads/" TagPrefix = "tags/" RemoteRefPrefix = "remotes/" TransactionRefPrefix = "txs/" )
Variables ¶
View Source
var ( HeadPattern = regexp.MustCompile(`^[-_0-9a-zA-Z/]+$`) HashPattern = regexp.MustCompile(`^[a-f0-9]{32}$`) )
View Source
var ErrKeyNotFound = fmt.Errorf("key not found")
Functions ¶
func CommitHead ¶
func CommitMerge ¶
func DeleteAllRemoteRefs ¶
func DeleteHead ¶
func DeleteRemoteRef ¶
func DeleteTransactionRefs ¶ added in v0.10.1
func InterpretCommitName ¶
func IsAncestorOf ¶
IsAncestorOf returns true if "commit1" is ancestor of "commit2"
func ListLocalRefs ¶
func ListTransactionRefs ¶ added in v0.10.1
func ParseNavigationChars ¶
func PeelCommit ¶
func RenameAllRemoteRefs ¶
func SaveFetchRef ¶ added in v0.8.4
func SaveRemoteRef ¶
func SaveTransactionRef ¶ added in v0.10.1
func SeekCommonAncestor ¶
func TransactionRef ¶ added in v0.10.1
Types ¶
type CommitsQueue ¶
type CommitsQueue struct {
// contains filtered or unexported fields
}
CommitsQueue is a queue sorted by commit time (newer commit first, older commit last).
func NewCommitsQueue ¶
func NewCommitsQueue(db objects.Store, initialSums [][]byte) (*CommitsQueue, error)
func (*CommitsQueue) Insert ¶
func (q *CommitsQueue) Insert(sum []byte) (err error)
func (*CommitsQueue) InsertParents ¶
func (q *CommitsQueue) InsertParents(c *objects.Commit) (err error)
func (*CommitsQueue) Len ¶
func (q *CommitsQueue) Len() int
func (*CommitsQueue) Less ¶
func (q *CommitsQueue) Less(i, j int) bool
func (*CommitsQueue) Pop ¶
func (q *CommitsQueue) Pop() (sum []byte, commit *objects.Commit, err error)
func (*CommitsQueue) PopInsertParents ¶
func (q *CommitsQueue) PopInsertParents() (sum []byte, commit *objects.Commit, err error)
func (*CommitsQueue) RemoveAncestors ¶
func (q *CommitsQueue) RemoveAncestors(sums [][]byte) error
func (*CommitsQueue) Reset ¶ added in v0.12.1
func (q *CommitsQueue) Reset(initialSums [][]byte) error
func (*CommitsQueue) Seen ¶
func (q *CommitsQueue) Seen(b []byte) bool
func (*CommitsQueue) Swap ¶
func (q *CommitsQueue) Swap(i, j int)
type Reflog ¶
type Reflog struct { OldOID []byte NewOID []byte AuthorName string AuthorEmail string Time time.Time Action string Message string Txid *uuid.UUID }
func (*Reflog) FetchRemote ¶ added in v0.8.4
type ReflogReader ¶
type Store ¶
type Store interface { SetWithLog(key string, val []byte, log *Reflog) error Set(key string, val []byte) error Get(key string) (val []byte, err error) Delete(key string) error Filter(prefixes, notPrefixes []string) (m map[string][]byte, err error) FilterKey(prefixes, notPrefixes []string) (keys []string, err error) Rename(oldKey, newKey string) (err error) Copy(srcKey, dstKey string) (err error) LogReader(key string) (ReflogReader, error) NewTransaction(tx *Transaction) (*uuid.UUID, error) GetTransaction(id uuid.UUID) (*Transaction, error) UpdateTransaction(tx *Transaction) error DeleteTransaction(id uuid.UUID) error GCTransactions(txTTL time.Duration) (ids []uuid.UUID, err error) GetTransactionLogs(txid uuid.UUID) (logs map[string]*Reflog, err error) ListTransactions(offset, limit int) (txs []*Transaction, err error) }
type Transaction ¶ added in v0.10.1
type TransactionStatus ¶ added in v0.10.1
type TransactionStatus string
const ( TSInProgress TransactionStatus = "in-progress" TSCommitted TransactionStatus = "committed" )
type Traveller ¶ added in v0.8.4
type Traveller struct { // Reflog is the closest reflog to the current commit, provided that all traversal is done via Parent() Reflog *Reflog // contains filtered or unexported fields }
Traveller travels a ref from the latest commit to the very first commit of that ref
func NewTraveller ¶ added in v0.8.4
NewTraveller creates a new BranchTraveller
Source Files
¶
Click to show internal directories.
Click to hide internal directories.