/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 push.py

  • Committer: Jelmer Vernooij
  • Date: 2018-03-06 01:46:14 UTC
  • mfrom: (0.200.1819 work)
  • mto: (0.200.1820 work)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180306014614-w4yooagw6ufouzf4
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
from .errors import (
36
36
    NoPushSupport,
37
37
    )
 
38
from .mapping import (
 
39
    needs_roundtripping,
 
40
    )
38
41
from .object_store import (
39
42
    get_object_store,
40
43
    )
255
258
        return bzr_refs
256
259
 
257
260
    def fetch_refs(self, update_refs, lossy):
258
 
        if not lossy and not self.mapping.roundtripping:
259
 
            raise NoPushSupport(self.source, self.target, self.mapping)
260
261
        with self.source_store.lock_read():
261
262
            old_refs = self._get_target_bzr_refs()
262
263
            new_refs = update_refs(old_refs)
274
275
 
275
276
    def fetch_objects(self, revs, lossy, limit=None):
276
277
        if not lossy and not self.mapping.roundtripping:
277
 
            raise NoPushSupport(self.source, self.target, self.mapping)
 
278
            for git_sha, bzr_revid in revs:
 
279
                if bzr_revid is not None and needs_roundtripping(self.source, bzr_revid):
 
280
                    raise NoPushSupport(self.source, self.target, self.mapping,
 
281
                                        bzr_revid)
278
282
        with self.source_store.lock_read():
279
283
            todo = list(self.missing_revisions(revs))[:limit]
280
284
            revidmap = {}
301
305
 
302
306
    def fetch(self, revision_id=None, pb=None, find_ghosts=False,
303
307
            fetch_spec=None, mapped_refs=None):
304
 
        if not self.mapping.roundtripping:
305
 
            raise NoPushSupport(self.source, self.target, self.mapping)
306
308
        if mapped_refs is not None:
307
309
            stop_revisions = mapped_refs
308
310
        elif revision_id is not None:
315
317
                raise AssertionError("Unsupported search result type %s" % recipe[0])
316
318
        else:
317
319
            stop_revisions = [(None, revid) for revid in self.source.all_revision_ids()]
318
 
        self.fetch_objects(stop_revisions, lossy=False)
 
320
        try:
 
321
            self.fetch_objects(stop_revisions, lossy=False)
 
322
        except NoPushSupport:
 
323
            raise errors.NoRoundtrippingSupport(self.source, self.target)
319
324
 
320
325
    @staticmethod
321
326
    def is_compatible(source, target):