Returns the history of a revid as an array of revids in reverse chronological order. Returns error if detects cycle(s) in rev tree
(revid string)
| 764 | // Returns the history of a revid as an array of revids in reverse chronological order. |
| 765 | // Returns error if detects cycle(s) in rev tree |
| 766 | func (tree RevTree) getHistory(revid string) ([]string, error) { |
| 767 | maxHistory := len(tree) |
| 768 | |
| 769 | history := make([]string, 0, 5) |
| 770 | for revid != "" { |
| 771 | info, err := tree.getInfo(revid) |
| 772 | if err != nil { |
| 773 | break |
| 774 | } |
| 775 | history = append(history, revid) |
| 776 | if len(history) > maxHistory { |
| 777 | return history, fmt.Errorf("getHistory found cycle in revision tree, history calculated as: %v", history) |
| 778 | } |
| 779 | revid = info.Parent |
| 780 | } |
| 781 | return history, nil |
| 782 | } |
| 783 | |
| 784 | // ////// ENCODED REVISION LISTS (_revisions): |
| 785 |