/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 breezy/plugins/fastimport/exporter.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-04 12:29:00 UTC
  • mfrom: (7490.40.42 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200704122900-o0y82e758ci5jie4
Merge lp:brz/3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
353
353
    def emit_baseline(self, revobj, ref):
354
354
        # Emit a full source tree of the first commit's parent
355
355
        mark = 1
356
 
        self.revid_to_mark[revobj.revision_id] = mark
 
356
        self.revid_to_mark[revobj.revision_id] = b"%d" % mark
357
357
        tree_old = self.branch.repository.revision_tree(
358
358
            breezy.revision.NULL_REVISION)
359
359
        [tree_new] = list(self._get_revision_trees([revobj.revision_id]))
362
362
        self.print_cmd(self._get_commit_command(ref, mark, revobj, file_cmds))
363
363
 
364
364
    def preprocess_commit(self, revid, revobj, ref):
365
 
        if revid in self.revid_to_mark or revid in self.excluded_revisions:
366
 
            return
 
365
        if self.revid_to_mark.get(revid) or revid in self.excluded_revisions:
 
366
            return []
367
367
        if revobj is None:
368
368
            # This is a ghost revision. Mark it as not found and next!
369
 
            self.revid_to_mark[revid] = -1
370
 
            return
 
369
            self.revid_to_mark[revid] = None
 
370
            return []
371
371
        # Get the primary parent
372
372
        # TODO: Consider the excluded revisions when deciding the parents.
373
373
        # Currently, a commit with parents that are excluded ought to be
379
379
            parent = revobj.parent_ids[0]
380
380
 
381
381
        # Print the commit
382
 
        mark = len(self.revid_to_mark) + 1
383
 
        self.revid_to_mark[revobj.revision_id] = mark
384
 
 
 
382
        self.revid_to_mark[revobj.revision_id] = b"%d" % (
 
383
            len(self.revid_to_mark) + 1)
385
384
        return [parent, revobj.revision_id]
386
385
 
387
386
    def emit_commit(self, revobj, ref, tree_old, tree_new):
449
448
                continue
450
449
            try:
451
450
                parent_mark = self.revid_to_mark[p]
452
 
                non_ghost_parents.append(b":%d" % parent_mark)
 
451
                non_ghost_parents.append(b":%s" % parent_mark)
453
452
            except KeyError:
454
453
                # ghost - ignore
455
454
                continue
669
668
                        self.warning('not creating tag %r as its name would not be '
670
669
                                     'valid in git.', git_ref)
671
670
                        continue
672
 
                self.print_cmd(commands.ResetCommand(git_ref, b":%d" % mark))
 
671
                self.print_cmd(commands.ResetCommand(git_ref, b":%s" % mark))