~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/__init__.py

  • Committer: Martin Pool
  • Date: 2006-03-10 06:29:53 UTC
  • mfrom: (1608 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1611.
  • Revision ID: mbp@sourcefrog.net-20060310062953-bc1c7ade75c89a7a
[merge] bzr.dev; pycurl not updated for readv yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import bzrlib
33
33
import bzrlib.errors as errors
34
34
from bzrlib.errors import BzrError, UnlistableStore, TransportNotPossible
 
35
from bzrlib.symbol_versioning import *
35
36
from bzrlib.trace import mutter
36
37
import bzrlib.transport as transport
37
38
from bzrlib.transport.local import LocalTransport
87
88
        """Return True if this store is able to be listed."""
88
89
        return hasattr(self, "__iter__")
89
90
 
 
91
    def copy_all_ids(self, store_from, pb=None):
 
92
        """Copy all the file ids from store_from into self."""
 
93
        if not store_from.listable():
 
94
            raise UnlistableStore(store_from)
 
95
        ids = []
 
96
        for count, file_id in enumerate(store_from):
 
97
            if pb:
 
98
                pb.update('listing files', count, count)
 
99
            ids.append(file_id)
 
100
        if pb:
 
101
            pb.clear()
 
102
        mutter('copy_all ids: %r', ids)
 
103
        self.copy_multi(store_from, ids, pb=pb)
 
104
 
90
105
    def copy_multi(self, other, ids, pb=None, permit_failure=False):
91
106
        """Copy texts for ids from other into self.
92
107
 
312
327
    return bzrlib.store.text.TextStore(transport.memory.MemoryTransport())
313
328
        
314
329
 
 
330
@deprecated_function(zero_eight)
315
331
def copy_all(store_from, store_to, pb=None):
316
332
    """Copy all ids from one store to another."""
317
 
    # TODO: Optional progress indicator
318
 
    if not store_from.listable():
319
 
        raise UnlistableStore(store_from)
320
 
    ids = []
321
 
    for count, file_id in enumerate(store_from):
322
 
        if pb:
323
 
            pb.update('listing files', count, count)
324
 
        ids.append(file_id)
325
 
    if pb:
326
 
        pb.clear()
327
 
    mutter('copy_all ids: %r', ids)
328
 
    store_to.copy_multi(store_from, ids, pb=pb)
 
333
    store_to.copy_all_ids(store_from, pb)
329
334
 
330
335
 
331
336
def hash_prefix(fileid):