Mercurial > public > mercurial-scm > hg
comparison hgext/patchbomb.py @ 5786:c69ef6fdb092
patchbomb: simplify some line continuations
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Sun, 30 Dec 2007 14:43:03 +0100 |
parents | 38cd1ce8650d |
children | a88b1b62fcdc |
comparison
equal
deleted
inserted
replaced
5785:38cd1ce8650d | 5786:c69ef6fdb092 |
---|---|
154 for line in patch: | 154 for line in patch: |
155 if line.startswith('#'): | 155 if line.startswith('#'): |
156 if line.startswith('# Node ID'): | 156 if line.startswith('# Node ID'): |
157 node = line.split()[-1] | 157 node = line.split()[-1] |
158 continue | 158 continue |
159 if (line.startswith('diff -r') | 159 if line.startswith('diff -r') or line.startswith('diff --git'): |
160 or line.startswith('diff --git')): | |
161 break | 160 break |
162 desc.append(line) | 161 desc.append(line) |
163 if not node: | 162 if not node: |
164 raise ValueError | 163 raise ValueError |
165 | 164 |
187 if t.endswith('.patch') or t.endswith('.diff')] | 186 if t.endswith('.patch') or t.endswith('.diff')] |
188 if patchname: | 187 if patchname: |
189 patchname = patchname[0] | 188 patchname = patchname[0] |
190 elif total > 1: | 189 elif total > 1: |
191 patchname = cmdutil.make_filename(repo, '%b-%n.patch', | 190 patchname = cmdutil.make_filename(repo, '%b-%n.patch', |
192 binnode, idx, total) | 191 binnode, idx, total) |
193 else: | 192 else: |
194 patchname = cmdutil.make_filename(repo, '%b.patch', binnode) | 193 patchname = cmdutil.make_filename(repo, '%b.patch', binnode) |
195 p['Content-Disposition'] = 'inline; filename=' + patchname | 194 p['Content-Disposition'] = 'inline; filename=' + patchname |
196 msg.attach(p) | 195 msg.attach(p) |
197 else: | 196 else: |
314 | 313 |
315 if len(patches) > 1: | 314 if len(patches) > 1: |
316 tlen = len(str(len(patches))) | 315 tlen = len(str(len(patches))) |
317 | 316 |
318 subj = '[PATCH %0*d of %d] %s' % ( | 317 subj = '[PATCH %0*d of %d] %s' % ( |
319 tlen, 0, | 318 tlen, 0, len(patches), |
320 len(patches), | |
321 opts['subject'] or | 319 opts['subject'] or |
322 prompt('Subject:', rest = ' [PATCH %0*d of %d] ' % (tlen, 0, | 320 prompt('Subject:', |
323 len(patches)))) | 321 rest=' [PATCH %0*d of %d] ' % (tlen, 0, len(patches)))) |
324 | 322 |
325 body = '' | 323 body = '' |
326 if opts['diffstat']: | 324 if opts['diffstat']: |
327 d = cdiffstat(_('Final summary:\n'), jumbo) | 325 d = cdiffstat(_('Final summary:\n'), jumbo) |
328 if d: | 326 if d: |