mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 17:44:59 +09:00
GO-3273: fix debug tree cmd
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
This commit is contained in:
parent
02d9f662b5
commit
e5671e2cb7
4 changed files with 12 additions and 8 deletions
|
@ -51,7 +51,7 @@ func main() {
|
|||
|
||||
importer := treearchive.NewTreeImporter(archive.ListStorage(), archive.TreeStorage())
|
||||
st = time.Now()
|
||||
err = importer.Import("")
|
||||
err = importer.Import(*fromRoot, "")
|
||||
if err != nil {
|
||||
log.Fatal("can't import the tree", err)
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ func main() {
|
|||
}
|
||||
fmt.Println("Change:")
|
||||
fmt.Println(pbtypes.Sprint(ch.Model))
|
||||
err = importer.Import(ch.Id)
|
||||
err = importer.Import(false, ch.Id)
|
||||
if err != nil {
|
||||
log.Fatal("can't import the tree before", ch.Id, err)
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ func testBuildFast(b *testing.T, filepath string) {
|
|||
|
||||
importer := treearchive.NewTreeImporter(archive.ListStorage(), archive.TreeStorage())
|
||||
|
||||
err = importer.Import("")
|
||||
err = importer.Import(false, "")
|
||||
if err != nil {
|
||||
log.Fatal("can't import the tree", err)
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ func testBuildFast(b *testing.T, filepath string) {
|
|||
|
||||
importer2 := treearchive.NewTreeImporter(archive.ListStorage(), archive.TreeStorage())
|
||||
|
||||
err = importer2.Import("")
|
||||
err = importer2.Import(false, "")
|
||||
if err != nil {
|
||||
log.Fatal("can't import the tree", err)
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ func (d *debug) TreeHeads(ctx context.Context, id string) (info TreeInfo, err er
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
tree, err := spc.TreeBuilder().BuildHistoryTree(ctx, id, objecttreebuilder.HistoryTreeOpts{})
|
||||
tree, err := spc.TreeBuilder().BuildHistoryTree(ctx, id, objecttreebuilder.HistoryTreeOpts{Heads: []string{""}})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ func (m MarshalledJsonChange) MarshalJSON() ([]byte, error) {
|
|||
type TreeImporter interface {
|
||||
ObjectTree() objecttree.ReadableObjectTree
|
||||
State() (*state.State, error) // set fullStateChain to true to get full state chain, otherwise only the last state will be returned
|
||||
Import(beforeId string) error
|
||||
Import(fromRoot bool, beforeId string) error
|
||||
Json() (TreeJson, error)
|
||||
ChangeAt(idx int) (IdChange, error)
|
||||
}
|
||||
|
@ -83,15 +83,19 @@ func (t *treeImporter) State() (*state.State, error) {
|
|||
return st, nil
|
||||
}
|
||||
|
||||
func (t *treeImporter) Import(beforeId string) (err error) {
|
||||
func (t *treeImporter) Import(fullTree bool, beforeId string) (err error) {
|
||||
aclList, err := list.BuildAclList(t.listStorage, list.NoOpAcceptorVerifier{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var heads []string
|
||||
if !fullTree {
|
||||
heads = []string{beforeId}
|
||||
}
|
||||
t.objectTree, err = objecttree.BuildNonVerifiableHistoryTree(objecttree.HistoryTreeParams{
|
||||
TreeStorage: t.treeStorage,
|
||||
AclList: aclList,
|
||||
Heads: []string{beforeId},
|
||||
Heads: heads,
|
||||
IncludeBeforeId: true,
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue