~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/weave.py

  • Committer: Aaron Bentley
  • Date: 2006-02-22 14:39:42 UTC
  • mto: (2027.1.2 revert-subpath-56549)
  • mto: This revision was merged to the branch mainline in revision 1570.
  • Revision ID: abentley@panoramicfeedback.com-20060222143942-ae72299f2de66767
Fixed build_tree with symlinks

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        return self._transport.get(self.filename(file_id))
68
68
 
69
69
    def _put(self, file_id, f):
70
 
        if self._prefixed:
71
 
            try:
72
 
                self._transport.mkdir(hash_prefix(file_id), mode=self._dir_mode)
73
 
            except FileExists:
74
 
                pass
75
 
        return self._transport.put(self.filename(file_id), f, mode=self._file_mode)
 
70
        # less round trips to mkdir on failure than mkdir always
 
71
        try:
 
72
            return self._transport.put(self.filename(file_id), f, mode=self._file_mode)
 
73
        except NoSuchFile:
 
74
            if not self._prefixed:
 
75
                raise
 
76
            self._transport.mkdir(hash_prefix(file_id), mode=self._dir_mode)
 
77
            return self._transport.put(self.filename(file_id), f, mode=self._file_mode)
76
78
 
77
79
    def get_weave(self, file_id, transaction):
78
80
        weave = transaction.map.find_weave(file_id)
162
164
        w.add_identical(old_rev_id, new_rev_id, parent_idxs)
163
165
        self.put_weave(file_id, w, transaction)
164
166
     
165
 
    def copy_multi(self, from_store, file_ids):
 
167
    def copy_multi(self, from_store, file_ids, pb=None):
166
168
        assert isinstance(from_store, WeaveStore)
167
 
        for f in file_ids:
 
169
        for count, f in enumerate(file_ids):
168
170
            mutter("copy weave {%s} into %s", f, self)
 
171
            if pb:
 
172
                pb.update('copy', count, len(file_ids))
169
173
            self._put(f, from_store._get(f))
 
174
        if pb:
 
175
            pb.clear()