~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Martin Pool
  • Date: 2005-06-22 06:37:43 UTC
  • Revision ID: mbp@sourcefrog.net-20050622063743-e395f04c4db8977f
- move old blackbox code from testbzr into bzrlib.selftest.blackbox

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
        pb = ProgressBar()
120
120
        pb.update('preparing to copy')
121
121
        to_copy = [id for id in ids if id not in self]
122
 
        if isinstance(other, ImmutableStore):
123
 
            return self.copy_multi_immutable(other, to_copy, pb)
124
122
        count = 0
125
123
        for id in to_copy:
126
124
            count += 1
129
127
        assert count == len(to_copy)
130
128
        pb.clear()
131
129
        return count
132
 
 
133
 
 
134
 
    def copy_multi_immutable(self, other, to_copy, pb):
135
 
        from shutil import copyfile
136
 
        count = 0
137
 
        for id in to_copy:
138
 
            p = self._path(id)
139
 
            other_p = other._path(id)
140
 
            try:
141
 
                copyfile(other_p, p)
142
 
            except IOError, e:
143
 
                if e.errno == errno.ENOENT:
144
 
                    copyfile(other_p+".gz", p+".gz")
145
 
                else:
146
 
                    raise
147
 
            
148
 
            count += 1
149
 
            pb.update('copy', count, len(to_copy))
150
 
        assert count == len(to_copy)
151
 
        pb.clear()
152
 
        return count
153
130
    
154
131
 
155
132
    def __contains__(self, fileid):