/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Andrew Bennetts
  • Date: 2008-11-28 02:33:04 UTC
  • mfrom: (3869 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3871.
  • Revision ID: andrew.bennetts@canonical.com-20081128023304-ffcfuwrau3nswe78
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
    """
78
78
 
79
79
    def __init__(self, to_repository, from_repository, last_revision=None, pb=None,
80
 
        find_ghosts=True):
 
80
        find_ghosts=True, _write_group_acquired_callable=None):
81
81
        """Create a repo fetcher.
82
82
 
83
83
        :param find_ghosts: If True search the entire history for ghosts.
 
84
        :param _write_group_acquired_callable: Don't use; this parameter only
 
85
            exists to facilitate a hack done in InterPackRepo.fetch.  We would
 
86
            like to remove this parameter.
84
87
        """
85
88
        # result variables.
86
89
        self.failed_revisions = []
95
98
        # must not mutate self._last_revision as its potentially a shared instance
96
99
        self._last_revision = last_revision
97
100
        self.find_ghosts = find_ghosts
 
101
        self._write_group_acquired_callable = _write_group_acquired_callable
98
102
        if pb is None:
99
103
            self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
100
104
            self.nested_pb = self.pb
107
111
            try:
108
112
                self.to_repository.start_write_group()
109
113
                try:
 
114
                    if self._write_group_acquired_callable is not None:
 
115
                        # Used by InterPackRepo.fetch to set_write_cache_size
 
116
                        # on the new pack.
 
117
                        self._write_group_acquired_callable()
110
118
                    self.__fetch()
111
119
                except:
112
 
                    self.to_repository.abort_write_group()
 
120
                    self.to_repository.abort_write_group(suppress_errors=True)
113
121
                    raise
114
122
                else:
115
123
                    self.to_repository.commit_write_group()
248
256
            child_pb.finished()
249
257
 
250
258
    def _fetch_revision_texts(self, revs, pb):
 
259
        # fetch signatures first and then the revision texts
251
260
        # may need to be a InterRevisionStore call here.
252
261
        to_sf = self.to_repository.signatures
253
262
        from_sf = self.from_repository.signatures
255
264
        to_sf.insert_record_stream(filter_absent(from_sf.get_record_stream(
256
265
            [(rev_id,) for rev_id in revs],
257
266
            self.to_repository._fetch_order,
258
 
            True)))
259
 
        # Bug #261339, some knit repositories accidentally had deltas in their
260
 
        # revision stream, when you weren't ever supposed to have deltas.
261
 
        # So we now *force* fulltext copying for signatures and revisions
 
267
            not self.to_repository._fetch_uses_deltas)))
262
268
        self._fetch_just_revision_texts(revs)
263
269
 
264
270
    def _fetch_just_revision_texts(self, version_ids):
265
271
        to_rf = self.to_repository.revisions
266
272
        from_rf = self.from_repository.revisions
 
273
        # If a revision has a delta, this is actually expanded inside the
 
274
        # insert_record_stream code now, which is an alternate fix for
 
275
        # bug #261339
267
276
        to_rf.insert_record_stream(from_rf.get_record_stream(
268
277
            [(rev_id,) for rev_id in version_ids],
269
278
            self.to_repository._fetch_order,
270
 
            True))
271
 
        # Bug #261339, some knit repositories accidentally had deltas in their
272
 
        # revision stream, when you weren't ever supposed to have deltas.
273
 
        # So we now *force* fulltext copying for signatures and revisions
 
279
            not self.to_repository._fetch_uses_deltas))
274
280
 
275
281
    def _generate_root_texts(self, revs):
276
282
        """This will be called by __fetch between fetching weave texts and