/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/git/send.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-10-27 04:51:12 UTC
  • mfrom: (7406.1.1 fix-git-send)
  • Revision ID: breezy.the.bot@gmail.com-20191027045112-5wioq3zlwexakxqh
Fix "bzr send" on git repositories.

Merged from https://code.launchpad.net/~jelmer/brz/fix-git-send/+merge/374755

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
        return self.patch.splitlines(True)
127
127
 
128
128
    def to_files(self):
129
 
        return self.patches
 
129
        return ((summary, patch.splitlines(True)) for (summary, patch) in self.patches)
130
130
 
131
131
    @classmethod
132
 
    def _generate_commit(cls, repository, revision_id, num, total):
 
132
    def _generate_commit(cls, repository, revision_id, num, total,
 
133
                         context=_mod_diff.DEFAULT_CONTEXT_AMOUNT):
133
134
        s = BytesIO()
134
135
        store = get_object_store(repository)
135
136
        with store.lock_read():
136
 
            commit = store[store._lookup_revision_sha1(revision_id)]
 
137
            commit = store[repository.lookup_bzr_revision_id(revision_id)[0]]
137
138
        from dulwich.patch import write_commit_patch, get_summary
138
139
        try:
139
140
            lhs_parent = repository.get_revision(revision_id).parent_ids[0]
143
144
        tree_2 = repository.revision_tree(revision_id)
144
145
        contents = BytesIO()
145
146
        differ = GitDiffTree.from_trees_options(
146
 
            tree_1, tree_2, contents, 'utf8', None, 'a/', 'b/', None)
 
147
            tree_1, tree_2, contents, 'utf8', None, 'a/', 'b/', None,
 
148
            context_lines=context)
147
149
        differ.show_diff(None, None)
148
150
        write_commit_patch(s, commit, contents.getvalue(), (num, total),
149
151
                           version_tail)