Skip to content

Commit 3779aac

Browse files
committed
Add list support for snapshots
1 parent 76cf51c commit 3779aac

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

s3git.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,22 @@ func s3git_snapshot_checkout(path, commit *C.char, dedupe bool) int {
265265
return 0
266266
}
267267

268+
//export s3git_snapshot_list
269+
func s3git_snapshot_list(path, commit *C.char) int {
270+
271+
repo, err := s3git.OpenRepository(C.GoString(path))
272+
if err != nil {
273+
return -1
274+
}
275+
276+
options := []s3git.SnapshotListOptions{}
277+
278+
err = repo.SnapshotList(C.GoString(commit), options...)
279+
if err != nil {
280+
return -1
281+
}
282+
283+
return 0
284+
}
285+
268286
func main() {}

s3git.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
extern GoInt s3git_snapshot_create(char* p0, char* p1);
5959
6060
extern GoInt s3git_snapshot_checkout(char* p0, char* p1, GoUint8 p2);
61+
62+
extern GoInt s3git_snapshot_list(char* p0, char* p1);
6163
""")
6264

6365
__s3gitlib__ = ffi.dlopen("s3git-py.so")
@@ -130,6 +132,11 @@ def snapshot_checkout(self, commit, dedupe=False):
130132
ffi.new("char[]", commit.encode('utf-8')), arg_dedupe)
131133
return ret
132134

135+
def snapshot_list(self, commit):
136+
ret = __s3gitlib__.s3git_snapshot_list(ffi.new("char[]", self.path.encode('utf-8')),
137+
ffi.new("char[]", commit.encode('utf-8')))
138+
return ret
139+
133140
def init_repository(path):
134141
repo = Repository(path)
135142
__s3gitlib__.s3git_init_repository(ffi.new("char[]", repo.path.encode('utf-8')))

0 commit comments

Comments
 (0)