Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/patchbomb.py @ 1670:fe19c54ee403
add _ to several strings
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Tue, 31 Jan 2006 08:08:43 -0800 |
parents | 91d40fc959f0 |
children | ba30c17d55f6 07f931af5f40 |
comparison
equal
deleted
inserted
replaced
1669:91d40fc959f0 | 1670:fe19c54ee403 |
---|---|
93 while True: | 93 while True: |
94 r = raw_input(prompt) | 94 r = raw_input(prompt) |
95 if r: return r | 95 if r: return r |
96 if default is not None: return default | 96 if default is not None: return default |
97 if empty_ok: return r | 97 if empty_ok: return r |
98 ui.warn('Please enter a valid value.\n') | 98 ui.warn(_('Please enter a valid value.\n')) |
99 | 99 |
100 def confirm(s): | 100 def confirm(s): |
101 if not prompt(s, default = 'y', rest = '? ').lower().startswith('y'): | 101 if not prompt(s, default = 'y', rest = '? ').lower().startswith('y'): |
102 raise ValueError | 102 raise ValueError |
103 | 103 |
105 s = diffstat(patch) | 105 s = diffstat(patch) |
106 if s: | 106 if s: |
107 if summary: | 107 if summary: |
108 ui.write(summary, '\n') | 108 ui.write(summary, '\n') |
109 ui.write(s, '\n') | 109 ui.write(s, '\n') |
110 confirm('Does the diffstat above look okay') | 110 confirm(_('Does the diffstat above look okay')) |
111 return s | 111 return s |
112 | 112 |
113 def makepatch(patch, idx, total): | 113 def makepatch(patch, idx, total): |
114 desc = [] | 114 desc = [] |
115 node = None | 115 node = None |
165 'text': None}) | 165 'text': None}) |
166 | 166 |
167 jumbo = [] | 167 jumbo = [] |
168 msgs = [] | 168 msgs = [] |
169 | 169 |
170 ui.write('This patch series consists of %d patches.\n\n' % len(patches)) | 170 ui.write(_('This patch series consists of %d patches.\n\n') % len(patches)) |
171 | 171 |
172 for p, i in zip(patches, range(len(patches))): | 172 for p, i in zip(patches, range(len(patches))): |
173 jumbo.extend(p) | 173 jumbo.extend(p) |
174 msgs.append(makepatch(p, i + 1, len(patches))) | 174 msgs.append(makepatch(p, i + 1, len(patches))) |
175 | 175 |
176 ui.write('\nWrite the introductory message for the patch series.\n\n') | 176 ui.write(_('\nWrite the introductory message for the patch series.\n\n')) |
177 | 177 |
178 sender = (opts['from'] or ui.config('patchbomb', 'from') or | 178 sender = (opts['from'] or ui.config('patchbomb', 'from') or |
179 prompt('From', ui.username())) | 179 prompt('From', ui.username())) |
180 | 180 |
181 msg = MIMEMultipart() | 181 msg = MIMEMultipart() |
189 prompt(prpt, default = default)).split(',') | 189 prompt(prpt, default = default)).split(',') |
190 return [a.strip() for a in addrs if a.strip()] | 190 return [a.strip() for a in addrs if a.strip()] |
191 to = getaddrs('to', 'To') | 191 to = getaddrs('to', 'To') |
192 cc = getaddrs('cc', 'Cc', '') | 192 cc = getaddrs('cc', 'Cc', '') |
193 | 193 |
194 ui.write('Finish with ^D or a dot on a line by itself.\n\n') | 194 ui.write(_('Finish with ^D or a dot on a line by itself.\n\n')) |
195 | 195 |
196 body = [] | 196 body = [] |
197 | 197 |
198 while True: | 198 while True: |
199 try: l = raw_input() | 199 try: l = raw_input() |
204 msg.attach(MIMEText('\n'.join(body) + '\n')) | 204 msg.attach(MIMEText('\n'.join(body) + '\n')) |
205 | 205 |
206 ui.write('\n') | 206 ui.write('\n') |
207 | 207 |
208 if opts['diffstat']: | 208 if opts['diffstat']: |
209 d = cdiffstat('Final summary:\n', jumbo) | 209 d = cdiffstat(_('Final summary:\n'), jumbo) |
210 if d: msg.attach(MIMEText(d)) | 210 if d: msg.attach(MIMEText(d)) |
211 | 211 |
212 msgs.insert(0, msg) | 212 msgs.insert(0, msg) |
213 | 213 |
214 if not opts['test']: | 214 if not opts['test']: |