Skip to contents

Branches, tags, ancestry and diffs

Usage

ic_branches(repo)

ic_tags(repo)

ic_ancestry(repo, branch = NULL, tag = NULL, snapshot = NULL)

ic_branch_create(repo, name, snapshot_id)

ic_branch_reset(repo, name, snapshot_id, from = NULL)

ic_branch_delete(repo, name)

ic_tag_create(repo, name, snapshot_id)

ic_tag_delete(repo, name)

ic_lookup(repo, branch = "main", tag = NULL)

ic_diff(repo, from, to)

Arguments

repo

an icechunk_repo.

branch, tag, snapshot

select one version (default branch "main").

name

branch or tag name.

snapshot_id

a snapshot id.

from

for ic_branch_reset(): optional expected current tip (the reset fails if the branch has moved); for ic_diff(): the starting version, as for to.

to

for ic_diff(): a list like list(branch = "main"), list(tag = "v1") or list(snapshot = id), or a snapshot id.

Value

data frames for listings; snapshot ids as character.

Examples

ex <- ic_example_repo()
repo <- ic_repo_open(ex$path, authorize = ex$authorize)
ic_branches(repo)
#>   name          snapshot_id
#> 1 main 0ATC6T82ZPV61SEEY5KG
ic_tags(repo)
#>   name          snapshot_id
#> 1   v1 FR79RD1KEBKRJV3BA420
ic_ancestry(repo, branch = "main")[, c("snapshot_id", "message")]
#>            snapshot_id                          message
#> 1 0ATC6T82ZPV61SEEY5KG                    a small array
#> 2 FR79RD1KEBKRJV3BA420 two arrays of virtual references
#> 3 1CECHNKREP0F1RSTCMT0           Repository initialized

# a branch from the tagged snapshot, and what changed since
v1 <- ic_lookup(repo, tag = "v1")
ic_branch_create(repo, "dev", v1)
ic_diff(repo, from = list(tag = "v1"), to = list(branch = "main"))
#> <icechunk_diff>
#>   new_arrays: /small
#>   updated chunks: 4 
ic_branch_delete(repo, "dev")

# a real repository: a metadata repair recorded as a commit, no references rewritten
oisst <- ic_repo_open(ic_example_oisst()$path)
ic_ancestry(oisst, tag = "cf-repaired")[, c("snapshot_id", "message")]
#>            snapshot_id
#> 1 7G4W5KJ1X6XG8A5BBWA0
#> 2 FE61C35T4WZMAX8MACDG
#> 3 1CECHNKREP0F1RSTCMT0
#>                                                                   message
#> 1              Add CF time units (metadata-only repair of as-virtualized)
#> 2 OISST 1981-09-01..10: virtual refs, cell=https (units defect preserved)
#> 3                                                  Repository initialized
ic_diff(oisst, from = list(tag = "as-virtualized"), to = list(tag = "cf-repaired"))
#> <icechunk_diff>
#>   updated_arrays: /time