~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Aaron Bentley
  • Date: 2005-09-25 23:51:03 UTC
  • mto: (1185.14.1) (1393.1.21)
  • mto: This revision was merged to the branch mainline in revision 1391.
  • Revision ID: aaron.bentley@utoronto.ca-20050925235103-08e4e26ee781cb74
Made copy_multi_immutable create hardlinks opportunistically

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
        return count, failed
150
150
 
151
151
    def copy_multi_immutable(self, other, to_copy, pb, permit_failure=False):
152
 
        from shutil import copyfile
153
152
        count = 0
154
153
        failed = set()
155
154
        for id in to_copy:
156
155
            p = self._path(id)
157
156
            other_p = other._path(id)
158
157
            try:
159
 
                copyfile(other_p, p)
160
 
            except IOError, e:
 
158
                osutils.link_or_copy(other_p, p)
 
159
            except (IOError, OSError), e:
161
160
                if e.errno == errno.ENOENT:
162
161
                    if not permit_failure:
163
 
                        copyfile(other_p+".gz", p+".gz")
 
162
                        osutils.link_or_copy(other_p+".gz", p+".gz")
164
163
                    else:
165
164
                        try:
166
 
                            copyfile(other_p+".gz", p+".gz")
 
165
                            osutils.link_or_copy(other_p+".gz", p+".gz")
167
166
                        except IOError, e:
168
167
                            if e.errno == errno.ENOENT:
169
168
                                failed.add(id)