[Pkg-bazaar-commits] ./bzr/unstable r534: - new RemoteStore class

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:19:09 UTC 2009


------------------------------------------------------------
revno: 534
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Tue 2005-05-17 18:34:38 +1000
message:
  - new RemoteStore class
  - use this for inventory_store and text_store in RemoteBranch
  - log -v now works (slowly)  on remote branches
modified:
  bzrlib/remotebranch.py
-------------- next part --------------
=== modified file 'bzrlib/remotebranch.py'
--- a/bzrlib/remotebranch.py	2005-05-11 01:06:07 +0000
+++ b/bzrlib/remotebranch.py	2005-05-17 08:34:38 +0000
@@ -112,6 +112,9 @@
             self.baseurl = baseurl
             self._check_format()
 
+        self.inventory_store = RemoteStore(baseurl + '/.bzr/inventory-store/')
+        self.text_store = RemoteStore(baseurl + '/.bzr/text-store/')
+
     def __str__(self):
         return '%s(%r)' % (self.__class__.__name__, self.baseurl)
 
@@ -145,9 +148,25 @@
             raise BzrCheckError('revision stored as {%s} actually contains {%s}'
                                 % (revision_id, r.revision_id))
         return r
+
+
+class RemoteStore:
+    def __init__(self, baseurl):
+        self._baseurl = baseurl
+        
+
+    def _path(self, name):
+        if '/' in name:
+            raise ValueError('invalid store id', name)
+        return self._baseurl + '/' + name
+        
+    def __getitem__(self, fileid):
+        p = self._path(fileid)
+        return get_url(p, compressed=True)
     
 
 def simple_walk():
+    """For experimental purposes, traverse many parts of a remote branch"""
     from revision import Revision
     from branch import Branch
     from inventory import Inventory



More information about the Pkg-bazaar-commits mailing list