~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Martin Pool
  • Date: 2005-09-06 02:26:28 UTC
  • Revision ID: mbp@sourcefrog.net-20050906022628-66d65f0feb4a9e80
- implement version 5 xml storage, and tests

  This stores files identified by the version that introduced the 
  text, and the version that introduced the name.  Entry kinds are
  given by the xml tag not an explicit kind field.

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
27
28
from bzrlib.trace import mutter
28
29
import bzrlib.ui
29
30
 
91
92
            
92
93
        p = self._path(fileid)
93
94
        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()
129
130
        for id in to_copy:
130
131
            count += 1
131
132
            pb.update('copy', count, len(to_copy))
135
136
                try:
136
137
                    entry = other[id]
137
138
                except IndexError:
138
 
                    failures.add(id)
 
139
                    failed.add(id)
139
140
                    continue
140
141
                self.add(entry, id)
141
142
                
142
 
        assert count == len(to_copy)
 
143
        if not permit_failure:
 
144
            assert count == len(to_copy)
143
145
        pb.clear()
144
 
        return count, []
145
 
 
 
146
        return count, failed
146
147
 
147
148
    def copy_multi_immutable(self, other, to_copy, pb, permit_failure=False):
148
149
        from shutil import copyfile