~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/weave.py

  • Committer: Robert Collins
  • Date: 2005-10-09 23:52:04 UTC
  • Revision ID: robertc@robertcollins.net-20051009235204-0abf18346c658e34
touchup the prefixed-store patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
 
23
23
from cStringIO import StringIO
24
 
from stat import ST_MODE, S_ISDIR
25
24
import os
26
25
import errno
27
26
 
28
27
from bzrlib.weavefile import read_weave, write_weave_v5
29
28
from bzrlib.weave import Weave
30
 
from bzrlib.store import Store, hash_prefix
 
29
from bzrlib.store import TransportStore, hash_prefix
31
30
from bzrlib.atomicfile import AtomicFile
32
31
from bzrlib.errors import NoSuchFile, FileExists
33
32
from bzrlib.trace import mutter
34
33
 
35
34
 
36
 
class WeaveStore(Store):
 
35
class WeaveStore(TransportStore):
37
36
    """Collection of several weave files in a directory.
38
37
 
39
38
    This has some shortcuts for reading and writing them.
51
50
        else:
52
51
            return file_id + WeaveStore.FILE_SUFFIX
53
52
 
54
 
    def _iter_relpaths(self):
55
 
        transport = self._transport
56
 
        queue = list(transport.list_dir('.'))
57
 
        while queue:
58
 
            relpath = queue.pop(0)
59
 
            st = transport.stat(relpath)
60
 
            if S_ISDIR(st[ST_MODE]):
61
 
                for i, basename in enumerate(transport.list_dir(relpath)):
62
 
                    queue.insert(i, relpath+'/'+basename)
63
 
            else:
64
 
                yield relpath, st
65
 
 
66
53
    def __iter__(self):
67
54
        l = len(WeaveStore.FILE_SUFFIX)
68
55
        for relpath, st in self._iter_relpaths():