]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/repo.py
repo: add VFS resolve(); test resolve() via local and remote repos
[bup.git] / lib / bup / repo.py
index cc8a3fd2e7161043b2bb158b0c2d25b55081a28a..3b178257b1d1a5197c6520104a0c9362b3653746 100644 (file)
@@ -3,7 +3,7 @@ from __future__ import absolute_import
 from os.path import realpath
 from functools import partial
 
-from bup import client, git
+from bup import client, git, vfs
 
 
 _next_repo_id = 0
@@ -43,6 +43,9 @@ class LocalRepo:
         (e.g. refs, tags, etc.)."""
         return self._id
 
+    def is_remote(self):
+        return False
+
     def cat(self, ref):
         """If ref does not exist, yield (None, None, None).  Otherwise yield
         (oidx, type, size), and then all of the data associated with
@@ -67,6 +70,13 @@ class LocalRepo:
                                  repo_dir=self.repo_dir):
             yield ref
 
+    ## Of course, the vfs better not call this...
+    def resolve(self, path, parent=None, want_meta=True, follow=True):
+        ## FIXME: mode_only=?
+        return vfs.resolve(self, path,
+                           parent=parent, want_meta=want_meta, follow=follow)
+
+
 class RemoteRepo:
     def __init__(self, address):
         self.address = address
@@ -94,6 +104,9 @@ class RemoteRepo:
         (e.g. refs, tags, etc.)."""
         return self._id
 
+    def is_remote(self):
+        return True
+
     def cat(self, ref):
         """If ref does not exist, yield (None, None, None).  Otherwise yield
         (oidx, type, size), and then all of the data associated with
@@ -120,3 +133,8 @@ class RemoteRepo:
                                     limit_to_heads=limit_to_heads,
                                     limit_to_tags=limit_to_tags):
             yield ref
+
+    def resolve(self, path, parent=None, want_meta=True, follow=True):
+        ## FIXME: mode_only=?
+        return self.client.resolve(path, parent=parent, want_meta=want_meta,
+                                   follow=follow)