comparison hgext/convert/convcmd.py @ 6956:12472a240398

i18n: mark strings for translation in convert extension
author Martin Geisler <mg@daimi.au.dk>
date Sun, 31 Aug 2008 16:12:02 +0200
parents 580d5e6bfc1f
children b072266a83d1
comparison
equal deleted inserted replaced
6955:a9411e29773f 6956:12472a240398
182 return s 182 return s
183 183
184 def writeauthormap(self): 184 def writeauthormap(self):
185 authorfile = self.authorfile 185 authorfile = self.authorfile
186 if authorfile: 186 if authorfile:
187 self.ui.status('Writing author map file %s\n' % authorfile) 187 self.ui.status(_('Writing author map file %s\n') % authorfile)
188 ofile = open(authorfile, 'w+') 188 ofile = open(authorfile, 'w+')
189 for author in self.authors: 189 for author in self.authors:
190 ofile.write("%s=%s\n" % (author, self.authors[author])) 190 ofile.write("%s=%s\n" % (author, self.authors[author]))
191 ofile.close() 191 ofile.close()
192 192
199 srcauthor, dstauthor = line.split('=', 1) 199 srcauthor, dstauthor = line.split('=', 1)
200 srcauthor = srcauthor.strip() 200 srcauthor = srcauthor.strip()
201 dstauthor = dstauthor.strip() 201 dstauthor = dstauthor.strip()
202 if srcauthor in self.authors and dstauthor != self.authors[srcauthor]: 202 if srcauthor in self.authors and dstauthor != self.authors[srcauthor]:
203 self.ui.status( 203 self.ui.status(
204 'Overriding mapping for author %s, was %s, will be %s\n' 204 _('Overriding mapping for author %s, was %s, will be %s\n')
205 % (srcauthor, self.authors[srcauthor], dstauthor)) 205 % (srcauthor, self.authors[srcauthor], dstauthor))
206 else: 206 else:
207 self.ui.debug('Mapping author %s to %s\n' 207 self.ui.debug(_('Mapping author %s to %s\n')
208 % (srcauthor, dstauthor)) 208 % (srcauthor, dstauthor))
209 self.authors[srcauthor] = dstauthor 209 self.authors[srcauthor] = dstauthor
210 except IndexError: 210 except IndexError:
211 self.ui.warn( 211 self.ui.warn(
212 'Ignoring bad line in author map file %s: %s\n' 212 _('Ignoring bad line in author map file %s: %s\n')
213 % (authorfile, line.rstrip())) 213 % (authorfile, line.rstrip()))
214 afile.close() 214 afile.close()
215 215
216 def cachecommit(self, rev): 216 def cachecommit(self, rev):
217 commit = self.source.getcommit(rev) 217 commit = self.source.getcommit(rev)
239 pbranches.append((self.map[prev], 239 pbranches.append((self.map[prev],
240 self.commitcache[prev].branch)) 240 self.commitcache[prev].branch))
241 self.dest.setbranch(commit.branch, pbranches) 241 self.dest.setbranch(commit.branch, pbranches)
242 try: 242 try:
243 parents = self.splicemap[rev].replace(',', ' ').split() 243 parents = self.splicemap[rev].replace(',', ' ').split()
244 self.ui.status('spliced in %s as parents of %s\n' % 244 self.ui.status(_('spliced in %s as parents of %s\n') %
245 (parents, rev)) 245 (parents, rev))
246 parents = [self.map.get(p, p) for p in parents] 246 parents = [self.map.get(p, p) for p in parents]
247 except KeyError: 247 except KeyError:
248 parents = [b[0] for b in pbranches] 248 parents = [b[0] for b in pbranches]
249 newnode = self.dest.putcommit(files, copies, parents, commit, self.source) 249 newnode = self.dest.putcommit(files, copies, parents, commit, self.source)
254 254
255 try: 255 try:
256 self.source.before() 256 self.source.before()
257 self.dest.before() 257 self.dest.before()
258 self.source.setrevmap(self.map) 258 self.source.setrevmap(self.map)
259 self.ui.status("scanning source...\n") 259 self.ui.status(_("scanning source...\n"))
260 heads = self.source.getheads() 260 heads = self.source.getheads()
261 parents = self.walktree(heads) 261 parents = self.walktree(heads)
262 self.ui.status("sorting...\n") 262 self.ui.status(_("sorting...\n"))
263 t = self.toposort(parents) 263 t = self.toposort(parents)
264 num = len(t) 264 num = len(t)
265 c = None 265 c = None
266 266
267 self.ui.status("converting...\n") 267 self.ui.status(_("converting...\n"))
268 for c in t: 268 for c in t:
269 num -= 1 269 num -= 1
270 desc = self.commitcache[c].desc 270 desc = self.commitcache[c].desc
271 if "\n" in desc: 271 if "\n" in desc:
272 desc = desc.splitlines()[0] 272 desc = desc.splitlines()[0]
307 orig_encoding = util._encoding 307 orig_encoding = util._encoding
308 util._encoding = 'UTF-8' 308 util._encoding = 'UTF-8'
309 309
310 if not dest: 310 if not dest:
311 dest = hg.defaultdest(src) + "-hg" 311 dest = hg.defaultdest(src) + "-hg"
312 ui.status("assuming destination %s\n" % dest) 312 ui.status(_("assuming destination %s\n") % dest)
313 313
314 destc = convertsink(ui, dest, opts.get('dest_type')) 314 destc = convertsink(ui, dest, opts.get('dest_type'))
315 315
316 try: 316 try:
317 srcc = convertsource(ui, src, opts.get('source_type'), 317 srcc = convertsource(ui, src, opts.get('source_type'),