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