]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/repo.py
Add repo abstraction and use it in join
[bup.git] / lib / bup / repo.py
diff --git a/lib/bup/repo.py b/lib/bup/repo.py
new file mode 100644 (file)
index 0000000..20dbfcb
--- /dev/null
@@ -0,0 +1,19 @@
+
+from bup import client, git
+
+
+class LocalRepo:
+    def __init__(self, repo_dir=None):
+        self.repo_dir = repo_dir or git.repo()
+        self._cp = git.cp(repo_dir)
+
+    def join(self, ref):
+        return self._cp.join(ref)
+
+class RemoteRepo:
+    def __init__(self, address):
+        self.address = address
+        self.client = client.Client(address)
+
+    def join(self, ref):
+        return self.client.cat(ref)