Show More
@@ -108,13 +108,14 def introneeded(opts, number): | |||
|
108 | 108 | '''is an introductory message required?''' |
|
109 | 109 | return number > 1 or opts.get('intro') or opts.get('desc') |
|
110 | 110 | |
|
111 |
def makepatch(ui, repo, patch, opts, _charsets, idx, total, |
|
|
111 | def makepatch(ui, repo, patchlines, opts, _charsets, idx, total, | |
|
112 | patchname=None): | |
|
112 | 113 | |
|
113 | 114 | desc = [] |
|
114 | 115 | node = None |
|
115 | 116 | body = '' |
|
116 | 117 | |
|
117 | for line in patch: | |
|
118 | for line in patchlines: | |
|
118 | 119 | if line.startswith('#'): |
|
119 | 120 | if line.startswith('# Node ID'): |
|
120 | 121 | node = line.split()[-1] |
@@ -132,21 +133,21 def makepatch(ui, repo, patch, opts, _ch | |||
|
132 | 133 | body += '\n\n\n' |
|
133 | 134 | |
|
134 | 135 | if opts.get('plain'): |
|
135 | while patch and patch[0].startswith('# '): | |
|
136 | patch.pop(0) | |
|
137 | if patch: | |
|
138 | patch.pop(0) | |
|
139 | while patch and not patch[0].strip(): | |
|
140 | patch.pop(0) | |
|
136 | while patchlines and patchlines[0].startswith('# '): | |
|
137 | patchlines.pop(0) | |
|
138 | if patchlines: | |
|
139 | patchlines.pop(0) | |
|
140 | while patchlines and not patchlines[0].strip(): | |
|
141 | patchlines.pop(0) | |
|
141 | 142 | |
|
142 | 143 | if opts.get('diffstat'): |
|
143 | body += cdiffstat(ui, '\n'.join(desc), patch) + '\n\n' | |
|
144 | body += cdiffstat(ui, '\n'.join(desc), patchlines) + '\n\n' | |
|
144 | 145 | |
|
145 | 146 | if opts.get('attach') or opts.get('inline'): |
|
146 | 147 | msg = email.MIMEMultipart.MIMEMultipart() |
|
147 | 148 | if body: |
|
148 | 149 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) |
|
149 | p = mail.mimetextpatch('\n'.join(patch), 'x-patch', opts.get('test')) | |
|
150 | p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', opts.get('test')) | |
|
150 | 151 | binnode = bin(node) |
|
151 | 152 | # if node is mq patch, it will have the patch file's name as a tag |
|
152 | 153 | if not patchname: |
@@ -165,7 +166,7 def makepatch(ui, repo, patch, opts, _ch | |||
|
165 | 166 | p['Content-Disposition'] = disposition + '; filename=' + patchname |
|
166 | 167 | msg.attach(p) |
|
167 | 168 | else: |
|
168 | body += '\n'.join(patch) | |
|
169 | body += '\n'.join(patchlines) | |
|
169 | 170 | msg = mail.mimetextpatch(body, display=opts.get('test')) |
|
170 | 171 | |
|
171 | 172 | flag = ' '.join(opts.get('flag')) |
General Comments 0
You need to be logged in to leave comments.
Login now