~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Martin Pool
  • Date: 2005-08-29 04:53:09 UTC
  • Revision ID: mbp@sourcefrog.net-20050829045309-6609704fdb44b600
- fix up logging for history2weaves tool

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import os, tempfile, types, osutils, gzip, errno
25
25
from stat import ST_SIZE
26
26
from StringIO import StringIO
27
 
from bzrlib.errors import BzrError
28
27
from bzrlib.trace import mutter
29
28
import bzrlib.ui
30
29
 
92
91
            
93
92
        p = self._path(fileid)
94
93
        if os.access(p, os.F_OK) or os.access(p + '.gz', os.F_OK):
 
94
            from bzrlib.errors import bailout
95
95
            raise BzrError("store %r already contains id %r" % (self._basedir, fileid))
96
96
 
97
97
        fn = p
126
126
        if isinstance(other, ImmutableStore):
127
127
            return self.copy_multi_immutable(other, to_copy, pb)
128
128
        count = 0
129
 
        failed = set()
130
129
        for id in to_copy:
131
130
            count += 1
132
131
            pb.update('copy', count, len(to_copy))
136
135
                try:
137
136
                    entry = other[id]
138
137
                except IndexError:
139
 
                    failed.add(id)
 
138
                    failures.add(id)
140
139
                    continue
141
140
                self.add(entry, id)
142
141
                
143
 
        if not permit_failure:
144
 
            assert count == len(to_copy)
 
142
        assert count == len(to_copy)
145
143
        pb.clear()
146
 
        return count, failed
 
144
        return count, []
 
145
 
147
146
 
148
147
    def copy_multi_immutable(self, other, to_copy, pb, permit_failure=False):
149
148
        from shutil import copyfile