addNewerRevisionsToRevTreeHistory will add any newer rev tree id's to the local document history
(newDoc *Document, currentRevIndex int, parent string, docHistory []string)
| 3824 | |
| 3825 | // addNewerRevisionsToRevTreeHistory will add any newer rev tree id's to the local document history |
| 3826 | func (doc *Document) addNewerRevisionsToRevTreeHistory(newDoc *Document, currentRevIndex int, parent string, docHistory []string) (string, error) { |
| 3827 | // currentRevIndex here is the index of the incoming rev tree list to start from. |
| 3828 | for i := currentRevIndex - 1; i >= 0; i-- { |
| 3829 | err := doc.History.addRevision(newDoc.ID, |
| 3830 | RevInfo{ |
| 3831 | ID: docHistory[i], |
| 3832 | Parent: parent, // set the parent of this revision to the element of docHistory from the last iteration |
| 3833 | Deleted: i == 0 && newDoc.Deleted}) |
| 3834 | |
| 3835 | if err != nil { |
| 3836 | return "", err |
| 3837 | } |
| 3838 | parent = docHistory[i] |
| 3839 | } |
| 3840 | // return last element added from docHistory, this will be the doc's new current rev for writes that are aligning rev tree |
| 3841 | return parent, nil |
| 3842 | } |
| 3843 | |
| 3844 | const ( |
| 3845 | xattrMacroCas = "cas" // SyncData.Cas |
no test coverage detected