~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Martin Pool
  • Date: 2005-08-25 05:58:05 UTC
  • mfrom: (974.1.36)
  • Revision ID: mbp@sourcefrog.net-20050825055805-8c892bc3c2d75131
- merge aaron's merge improvements:

  * When merging, pull in all missing revisions from the source
    branch. 

  * Detect common ancestors by looking at the whole ancestry graph, 
    rather than just mainline history.

  Some changes to reconcile this with parallel updates to the test and
  trace code.

aaron.bentley@utoronto.ca-20050823052551-f3401a8b57d9126f

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
            af.close()
112
112
 
113
113
 
114
 
    def copy_multi(self, other, ids):
 
114
    def copy_multi(self, other, ids, permit_failure=False):
115
115
        """Copy texts for ids from other into self.
116
116
 
117
117
        If an id is present in self, it is skipped.  A count of copied
127
127
        for id in to_copy:
128
128
            count += 1
129
129
            pb.update('copy', count, len(to_copy))
130
 
            self.add(other[id], id)
 
130
            if not permit_failure:
 
131
                self.add(other[id], id)
 
132
            else:
 
133
                try:
 
134
                    entry = other[id]
 
135
                except IndexError:
 
136
                    failures.add(id)
 
137
                    continue
 
138
                self.add(entry, id)
 
139
                
131
140
        assert count == len(to_copy)
132
141
        pb.clear()
133
142
        return count
134
143
 
135
144
 
136
 
    def copy_multi_immutable(self, other, to_copy, pb):
 
145
    def copy_multi_immutable(self, other, to_copy, pb, permit_failure=False):
137
146
        from shutil import copyfile
138
147
        count = 0
 
148
        failed = set()
139
149
        for id in to_copy:
140
150
            p = self._path(id)
141
151
            other_p = other._path(id)
143
153
                copyfile(other_p, p)
144
154
            except IOError, e:
145
155
                if e.errno == errno.ENOENT:
146
 
                    copyfile(other_p+".gz", p+".gz")
 
156
                    if not permit_failure:
 
157
                        copyfile(other_p+".gz", p+".gz")
 
158
                    else:
 
159
                        try:
 
160
                            copyfile(other_p+".gz", p+".gz")
 
161
                        except IOError, e:
 
162
                            if e.errno == errno.ENOENT:
 
163
                                failed.add(id)
 
164
                            else:
 
165
                                raise
147
166
                else:
148
167
                    raise
149
168
            
151
170
            pb.update('copy', count, len(to_copy))
152
171
        assert count == len(to_copy)
153
172
        pb.clear()
154
 
        return count
 
173
        return count, failed
155
174
    
156
175
 
157
176
    def __contains__(self, fileid):