/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-18 23:14:00 UTC
  • mfrom: (7490.40.62 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200718231400-jaes9qltn8oi8xss
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
341
341
    def emit_baseline(self, revobj, ref):
342
342
        # Emit a full source tree of the first commit's parent
343
343
        mark = 1
344
 
        self.revid_to_mark[revobj.revision_id] = mark
 
344
        self.revid_to_mark[revobj.revision_id] = b"%d" % mark
345
345
        tree_old = self.branch.repository.revision_tree(
346
346
            breezy.revision.NULL_REVISION)
347
347
        [tree_new] = list(self._get_revision_trees([revobj.revision_id]))
350
350
        self.print_cmd(self._get_commit_command(ref, mark, revobj, file_cmds))
351
351
 
352
352
    def preprocess_commit(self, revid, revobj, ref):
353
 
        if revid in self.revid_to_mark or revid in self.excluded_revisions:
354
 
            return
 
353
        if self.revid_to_mark.get(revid) or revid in self.excluded_revisions:
 
354
            return []
355
355
        if revobj is None:
356
356
            # This is a ghost revision. Mark it as not found and next!
357
 
            self.revid_to_mark[revid] = -1
358
 
            return
 
357
            self.revid_to_mark[revid] = None
 
358
            return []
359
359
        # Get the primary parent
360
360
        # TODO: Consider the excluded revisions when deciding the parents.
361
361
        # Currently, a commit with parents that are excluded ought to be
367
367
            parent = revobj.parent_ids[0]
368
368
 
369
369
        # Print the commit
370
 
        mark = len(self.revid_to_mark) + 1
371
 
        self.revid_to_mark[revobj.revision_id] = mark
372
 
 
 
370
        self.revid_to_mark[revobj.revision_id] = b"%d" % (
 
371
            len(self.revid_to_mark) + 1)
373
372
        return [parent, revobj.revision_id]
374
373
 
375
374
    def emit_commit(self, revobj, ref, tree_old, tree_new):
437
436
                continue
438
437
            try:
439
438
                parent_mark = self.revid_to_mark[p]
440
 
                non_ghost_parents.append(b":%d" % parent_mark)
 
439
                non_ghost_parents.append(b":%s" % parent_mark)
441
440
            except KeyError:
442
441
                # ghost - ignore
443
442
                continue
657
656
                        self.warning('not creating tag %r as its name would not be '
658
657
                                     'valid in git.', git_ref)
659
658
                        continue
660
 
                self.print_cmd(commands.ResetCommand(git_ref, b":%d" % mark))
 
659
                self.print_cmd(commands.ResetCommand(git_ref, b":%s" % mark))