blob: 8a371570021130e6674470def8e311b344acf1ec [file] [log] [blame]
package model
// TODO: implement weak references or something equivalent
// TODO: missing proper logging
type Branch struct {
node *Node
Txid string
origin *Revision
revisions map[string]*Revision
Latest *Revision
}
func NewBranch(node *Node, txid string, origin *Revision, autoPrune bool) *Branch {
cb := &Branch{}
cb.node = node
cb.Txid = txid
cb.origin = origin
cb.revisions = make(map[string]*Revision)
cb.Latest = origin
return cb
}
// TODO: Check if the following are required
func (cb *Branch) get(hash string) *Revision {
return cb.revisions[hash]
}
func (cb *Branch) GetLatest() *Revision {
return cb.Latest
}
func (cb *Branch) GetOrigin() *Revision {
return cb.origin
}