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

Properly ignore directories when creating bundles, deal with new files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    branch as _mod_branch,
27
27
    diff as _mod_diff,
28
28
    errors,
 
29
    merge_directive,
29
30
    osutils,
30
31
    revision as _mod_revision,
31
32
    )
32
33
 
33
 
try:
34
 
    from bzrlib.merge_directive import BaseMergeDirective
35
 
except ImportError:
36
 
    from bzrlib.merge_directive import (
37
 
        _BaseMergeDirective as BaseMergeDirective,
38
 
        )
39
 
 
40
34
from bzrlib.plugins.git import (
41
35
    version_info as bzr_git_version_info,
42
36
    )
108
102
        return has_changes
109
103
 
110
104
 
111
 
class GitMergeDirective(BaseMergeDirective):
112
 
 
113
 
    multiple_output_files = True
114
 
 
115
 
    def __init__(self, revision_id, testament_sha1, time, timezone,
116
 
                 target_branch, source_branch=None, message=None,
117
 
                 patches=None):
118
 
        super(GitMergeDirective, self).__init__(revision_id=revision_id,
119
 
            testament_sha1=testament_sha1, time=time, timezone=timezone,
120
 
            target_branch=target_branch, patch=None,
121
 
            source_branch=source_branch, message=message, bundle=None)
122
 
        self.patches = patches
 
105
class GitMergeDirective(merge_directive._BaseMergeDirective):
123
106
 
124
107
    def to_lines(self):
125
108
        return self.patch.splitlines(True)
126
109
 
127
 
    def to_files(self):
128
 
        return self.patches
129
 
 
130
110
    @classmethod
131
111
    def _generate_commit(cls, repository, revision_id, num, total):
132
112
        s = StringIO()
145
125
        differ.show_diff(None, None)
146
126
        write_commit_patch(s, commit, contents.getvalue(), (num, total),
147
127
                           version_tail)
148
 
        summary = "%04d-%s.patch" % (num, get_summary(commit).rstrip("."))
 
128
        summary = "%04d-%s" % (num, get_summary(commit))
149
129
        return summary, s.getvalue()
150
130
 
151
131
    @classmethod
163
143
            total = len(todo)
164
144
            for i, revid in enumerate(graph.iter_topo_order(todo)):
165
145
                patches.append(cls._generate_commit(repository, revid, i+1,
166
 
                    total))
 
146
                                                    total))
167
147
        finally:
168
148
            submit_branch.unlock()
169
 
        return cls(revision_id, None, time, timezone,
170
 
            target_branch=target_branch, source_branch=public_branch,
171
 
            message=message, patches=patches)
 
149
        return cls(revision_id, None, time, timezone, target_branch,
 
150
            "".join([patch for (summary, patch) in patches]),
 
151
            None, public_branch, message)
172
152
 
173
153
 
174
154
def send_git(branch, revision_id, submit_branch, public_branch, no_patch,