##// END OF EJS Templates
i18n: mark strings for translation in convert extension
Martin Geisler -
r6956:12472a24 default
parent child Browse files
Show More
@@ -228,7 +228,7 b' class commandline(object):'
228
228
229 def _run(self, cmd, *args, **kwargs):
229 def _run(self, cmd, *args, **kwargs):
230 cmdline = self._cmdline(cmd, *args, **kwargs)
230 cmdline = self._cmdline(cmd, *args, **kwargs)
231 self.ui.debug('running: %s\n' % (cmdline,))
231 self.ui.debug(_('running: %s\n') % (cmdline,))
232 self.prerun()
232 self.prerun()
233 try:
233 try:
234 return util.popen(cmdline)
234 return util.popen(cmdline)
@@ -184,7 +184,7 b' class converter(object):'
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]))
@@ -201,15 +201,15 b' class converter(object):'
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
@@ -241,7 +241,7 b' class converter(object):'
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:
@@ -256,15 +256,15 b' class converter(object):'
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
@@ -309,7 +309,7 b' def convert(ui, src, dest=None, revmapfi'
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
@@ -54,7 +54,7 b' class convert_cvs(converter_source):'
54 util.parsedate(self.rev, ['%Y/%m/%d %H:%M:%S'])
54 util.parsedate(self.rev, ['%Y/%m/%d %H:%M:%S'])
55 cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev)
55 cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev)
56 except util.Abort:
56 except util.Abort:
57 raise util.Abort('revision %s is not a patchset number or date' % self.rev)
57 raise util.Abort(_('revision %s is not a patchset number or date') % self.rev)
58
58
59 d = os.getcwd()
59 d = os.getcwd()
60 try:
60 try:
@@ -181,7 +181,7 b' class convert_cvs(converter_source):'
181 user, host = None, None
181 user, host = None, None
182 cmd = ['cvs', 'server']
182 cmd = ['cvs', 'server']
183
183
184 self.ui.status("connecting to %s\n" % root)
184 self.ui.status(_("connecting to %s\n") % root)
185
185
186 if root.startswith(":pserver:"):
186 if root.startswith(":pserver:"):
187 root = root[9:]
187 root = root[9:]
@@ -221,7 +221,7 b' class convert_cvs(converter_source):'
221 sck.send("\n".join(["BEGIN AUTH REQUEST", root, user, passw,
221 sck.send("\n".join(["BEGIN AUTH REQUEST", root, user, passw,
222 "END AUTH REQUEST", ""]))
222 "END AUTH REQUEST", ""]))
223 if sck.recv(128) != "I LOVE YOU\n":
223 if sck.recv(128) != "I LOVE YOU\n":
224 raise util.Abort("CVS pserver authentication failed")
224 raise util.Abort(_("CVS pserver authentication failed"))
225
225
226 self.writep = self.readp = sck.makefile('r+')
226 self.writep = self.readp = sck.makefile('r+')
227
227
@@ -264,7 +264,7 b' class convert_cvs(converter_source):'
264 self.writep.flush()
264 self.writep.flush()
265 r = self.readp.readline()
265 r = self.readp.readline()
266 if not r.startswith("Valid-requests"):
266 if not r.startswith("Valid-requests"):
267 raise util.Abort("server sucks")
267 raise util.Abort(_("server sucks"))
268 if "UseUnchanged" in r:
268 if "UseUnchanged" in r:
269 self.writep.write("UseUnchanged\n")
269 self.writep.write("UseUnchanged\n")
270 self.writep.flush()
270 self.writep.flush()
@@ -283,7 +283,7 b' class convert_cvs(converter_source):'
283 while count > 0:
283 while count > 0:
284 data = fp.read(min(count, chunksize))
284 data = fp.read(min(count, chunksize))
285 if not data:
285 if not data:
286 raise util.Abort("%d bytes missing from remote file" % count)
286 raise util.Abort(_("%d bytes missing from remote file") % count)
287 count -= len(data)
287 count -= len(data)
288 output.write(data)
288 output.write(data)
289 return output.getvalue()
289 return output.getvalue()
@@ -318,14 +318,14 b' class convert_cvs(converter_source):'
318 if line == "ok\n":
318 if line == "ok\n":
319 return (data, "x" in mode and "x" or "")
319 return (data, "x" in mode and "x" or "")
320 elif line.startswith("E "):
320 elif line.startswith("E "):
321 self.ui.warn("cvs server: %s\n" % line[2:])
321 self.ui.warn(_("cvs server: %s\n") % line[2:])
322 elif line.startswith("Remove"):
322 elif line.startswith("Remove"):
323 l = self.readp.readline()
323 l = self.readp.readline()
324 l = self.readp.readline()
324 l = self.readp.readline()
325 if l != "ok\n":
325 if l != "ok\n":
326 raise util.Abort("unknown CVS response: %s" % l)
326 raise util.Abort(_("unknown CVS response: %s") % l)
327 else:
327 else:
328 raise util.Abort("unknown CVS response: %s" % line)
328 raise util.Abort(_("unknown CVS response: %s") % line)
329
329
330 def getfile(self, file, rev):
330 def getfile(self, file, rev):
331 data, mode = self._getfile(file, rev)
331 data, mode = self._getfile(file, rev)
@@ -150,8 +150,8 b' def createlog(ui, directory=None, root="'
150 store = False # set when a new record can be appended
150 store = False # set when a new record can be appended
151
151
152 cmd = [util.shellquote(arg) for arg in cmd]
152 cmd = [util.shellquote(arg) for arg in cmd]
153 ui.note("running %s\n" % (' '.join(cmd)))
153 ui.note(_("running %s\n") % (' '.join(cmd)))
154 ui.debug("prefix=%r directory=%r root=%r\n" % (prefix, directory, root))
154 ui.debug(_("prefix=%r directory=%r root=%r\n") % (prefix, directory, root))
155
155
156 for line in util.popen(' '.join(cmd)):
156 for line in util.popen(' '.join(cmd)):
157 if line.endswith('\n'):
157 if line.endswith('\n'):
@@ -66,7 +66,7 b' class darcs_source(converter_source, com'
66 self.parents[child] = []
66 self.parents[child] = []
67
67
68 def after(self):
68 def after(self):
69 self.ui.debug('cleaning up %s\n' % self.tmppath)
69 self.ui.debug(_('cleaning up %s\n') % self.tmppath)
70 shutil.rmtree(self.tmppath, ignore_errors=True)
70 shutil.rmtree(self.tmppath, ignore_errors=True)
71
71
72 def xml(self, cmd, **kwargs):
72 def xml(self, cmd, **kwargs):
@@ -177,7 +177,7 b' class mercurial_sink(converter_sink):'
177 def getfilectx(repo, memctx, f):
177 def getfilectx(repo, memctx, f):
178 return context.memfilectx(f, data, False, False, None)
178 return context.memfilectx(f, data, False, False, None)
179
179
180 self.ui.status("updating tags\n")
180 self.ui.status(_("updating tags\n"))
181 date = "%s 0" % int(time.mktime(time.gmtime()))
181 date = "%s 0" % int(time.mktime(time.gmtime()))
182 extra = {'branch': self.tagsbranch}
182 extra = {'branch': self.tagsbranch}
183 ctx = context.memctx(self.repo, (tagparent, None), "update tags",
183 ctx = context.memctx(self.repo, (tagparent, None), "update tags",
@@ -189,7 +189,7 b' class svn_source(converter_source):'
189 try:
189 try:
190 latest = int(rev)
190 latest = int(rev)
191 except ValueError:
191 except ValueError:
192 raise util.Abort('svn: revision %s is not an integer' % rev)
192 raise util.Abort(_('svn: revision %s is not an integer') % rev)
193
193
194 self.startrev = self.ui.config('convert', 'svn.startrev', default=0)
194 self.startrev = self.ui.config('convert', 'svn.startrev', default=0)
195 try:
195 try:
@@ -290,7 +290,7 b' class svn_source(converter_source):'
290 self.ui.note(_('ignoring empty branch %s\n') %
290 self.ui.note(_('ignoring empty branch %s\n') %
291 branch.encode(self.encoding))
291 branch.encode(self.encoding))
292 continue
292 continue
293 self.ui.note('found branch %s at %d\n' %
293 self.ui.note(_('found branch %s at %d\n') %
294 (branch, self.revnum(brevid)))
294 (branch, self.revnum(brevid)))
295 self.heads.append(brevid)
295 self.heads.append(brevid)
296
296
@@ -420,7 +420,7 b' class svn_source(converter_source):'
420 tagspath = srctagspath
420 tagspath = srctagspath
421
421
422 except SubversionException, (inst, num):
422 except SubversionException, (inst, num):
423 self.ui.note('no tags found at revision %d\n' % start)
423 self.ui.note(_('no tags found at revision %d\n') % start)
424 return tags
424 return tags
425
425
426 def converted(self, rev, destrev):
426 def converted(self, rev, destrev):
@@ -473,7 +473,7 b' class svn_source(converter_source):'
473 except SubversionException:
473 except SubversionException:
474 dirent = None
474 dirent = None
475 if not dirent:
475 if not dirent:
476 raise util.Abort('%s not found up to revision %d' % (path, stop))
476 raise util.Abort(_('%s not found up to revision %d') % (path, stop))
477
477
478 # stat() gives us the previous revision on this line of development, but
478 # stat() gives us the previous revision on this line of development, but
479 # it might be in *another module*. Fetch the log and detect renames down
479 # it might be in *another module*. Fetch the log and detect renames down
@@ -489,7 +489,7 b' class svn_source(converter_source):'
489 if not path.startswith(p) or not paths[p].copyfrom_path:
489 if not path.startswith(p) or not paths[p].copyfrom_path:
490 continue
490 continue
491 newpath = paths[p].copyfrom_path + path[len(p):]
491 newpath = paths[p].copyfrom_path + path[len(p):]
492 self.ui.debug("branch renamed from %s to %s at %d\n" %
492 self.ui.debug(_("branch renamed from %s to %s at %d\n") %
493 (path, newpath, revnum))
493 (path, newpath, revnum))
494 path = newpath
494 path = newpath
495 break
495 break
@@ -528,7 +528,7 b' class svn_source(converter_source):'
528 prevmodule = self.prevmodule
528 prevmodule = self.prevmodule
529 if prevmodule is None:
529 if prevmodule is None:
530 prevmodule = ''
530 prevmodule = ''
531 self.ui.debug("reparent to %s\n" % svn_url)
531 self.ui.debug(_("reparent to %s\n") % svn_url)
532 svn.ra.reparent(self.ra, svn_url)
532 svn.ra.reparent(self.ra, svn_url)
533 self.prevmodule = module
533 self.prevmodule = module
534 return prevmodule
534 return prevmodule
@@ -560,11 +560,11 b' class svn_source(converter_source):'
560 copyfrom_path = self.getrelpath(ent.copyfrom_path, pmodule)
560 copyfrom_path = self.getrelpath(ent.copyfrom_path, pmodule)
561 if not copyfrom_path:
561 if not copyfrom_path:
562 continue
562 continue
563 self.ui.debug("copied to %s from %s@%s\n" %
563 self.ui.debug(_("copied to %s from %s@%s\n") %
564 (entrypath, copyfrom_path, ent.copyfrom_rev))
564 (entrypath, copyfrom_path, ent.copyfrom_rev))
565 copies[self.recode(entry)] = self.recode(copyfrom_path)
565 copies[self.recode(entry)] = self.recode(copyfrom_path)
566 elif kind == 0: # gone, but had better be a deleted *file*
566 elif kind == 0: # gone, but had better be a deleted *file*
567 self.ui.debug("gone from %s\n" % ent.copyfrom_rev)
567 self.ui.debug(_("gone from %s\n") % ent.copyfrom_rev)
568
568
569 # if a branch is created but entries are removed in the same
569 # if a branch is created but entries are removed in the same
570 # changeset, get the right fromrev
570 # changeset, get the right fromrev
@@ -582,22 +582,22 b' class svn_source(converter_source):'
582 part = "/".join(parts[:i])
582 part = "/".join(parts[:i])
583 info = part, copyfrom.get(part, None)
583 info = part, copyfrom.get(part, None)
584 if info[1] is not None:
584 if info[1] is not None:
585 self.ui.debug("Found parent directory %s\n" % info[1])
585 self.ui.debug(_("Found parent directory %s\n") % info[1])
586 rc = info
586 rc = info
587 return rc
587 return rc
588
588
589 self.ui.debug("base, entry %s %s\n" % (basepath, entrypath))
589 self.ui.debug(_("base, entry %s %s\n") % (basepath, entrypath))
590
590
591 frompath, froment = lookup_parts(entrypath) or (None, revnum - 1)
591 frompath, froment = lookup_parts(entrypath) or (None, revnum - 1)
592
592
593 # need to remove fragment from lookup_parts and replace with copyfrom_path
593 # need to remove fragment from lookup_parts and replace with copyfrom_path
594 if frompath is not None:
594 if frompath is not None:
595 self.ui.debug("munge-o-matic\n")
595 self.ui.debug(_("munge-o-matic\n"))
596 self.ui.debug(entrypath + '\n')
596 self.ui.debug(entrypath + '\n')
597 self.ui.debug(entrypath[len(frompath):] + '\n')
597 self.ui.debug(entrypath[len(frompath):] + '\n')
598 entrypath = froment.copyfrom_path + entrypath[len(frompath):]
598 entrypath = froment.copyfrom_path + entrypath[len(frompath):]
599 fromrev = froment.copyfrom_rev
599 fromrev = froment.copyfrom_rev
600 self.ui.debug("Info: %s %s %s %s\n" % (frompath, froment, ent, entrypath))
600 self.ui.debug(_("Info: %s %s %s %s\n") % (frompath, froment, ent, entrypath))
601
601
602 # We can avoid the reparent calls if the module has not changed
602 # We can avoid the reparent calls if the module has not changed
603 # but it probably does not worth the pain.
603 # but it probably does not worth the pain.
@@ -638,7 +638,7 b' class svn_source(converter_source):'
638 else:
638 else:
639 entries.append(entry)
639 entries.append(entry)
640 else:
640 else:
641 self.ui.debug('unknown path in revision %d: %s\n' % \
641 self.ui.debug(_('unknown path in revision %d: %s\n') % \
642 (revnum, path))
642 (revnum, path))
643 elif kind == svn.core.svn_node_dir:
643 elif kind == svn.core.svn_node_dir:
644 # Should probably synthesize normal file entries
644 # Should probably synthesize normal file entries
@@ -684,7 +684,7 b' class svn_source(converter_source):'
684 if not copyfrompath:
684 if not copyfrompath:
685 continue
685 continue
686 copyfrom[path] = ent
686 copyfrom[path] = ent
687 self.ui.debug("mark %s came from %s:%d\n"
687 self.ui.debug(_("mark %s came from %s:%d\n")
688 % (path, copyfrompath, ent.copyfrom_rev))
688 % (path, copyfrompath, ent.copyfrom_rev))
689 children = self._find_children(ent.copyfrom_path, ent.copyfrom_rev)
689 children = self._find_children(ent.copyfrom_path, ent.copyfrom_rev)
690 children.sort()
690 children.sort()
@@ -715,7 +715,7 b' class svn_source(converter_source):'
715 """Return the parsed commit object or None, and True if
715 """Return the parsed commit object or None, and True if
716 the revision is a branch root.
716 the revision is a branch root.
717 """
717 """
718 self.ui.debug("parsing revision %d (%d changes)\n" %
718 self.ui.debug(_("parsing revision %d (%d changes)\n") %
719 (revnum, len(orig_paths)))
719 (revnum, len(orig_paths)))
720
720
721 branched = False
721 branched = False
@@ -752,10 +752,10 b' class svn_source(converter_source):'
752 prevmodule, prevnum = self.revsplit(previd)[1:]
752 prevmodule, prevnum = self.revsplit(previd)[1:]
753 if prevnum >= self.startrev:
753 if prevnum >= self.startrev:
754 parents = [previd]
754 parents = [previd]
755 self.ui.note('found parent of branch %s at %d: %s\n' %
755 self.ui.note(_('found parent of branch %s at %d: %s\n') %
756 (self.module, prevnum, prevmodule))
756 (self.module, prevnum, prevmodule))
757 else:
757 else:
758 self.ui.debug("No copyfrom path, don't know what to do.\n")
758 self.ui.debug(_("No copyfrom path, don't know what to do.\n"))
759
759
760 paths = []
760 paths = []
761 # filter out unrelated paths
761 # filter out unrelated paths
@@ -794,7 +794,7 b' class svn_source(converter_source):'
794 self.child_cset = cset
794 self.child_cset = cset
795 return cset, branched
795 return cset, branched
796
796
797 self.ui.note('fetching revision log for "%s" from %d to %d\n' %
797 self.ui.note(_('fetching revision log for "%s" from %d to %d\n') %
798 (self.module, from_revnum, to_revnum))
798 (self.module, from_revnum, to_revnum))
799
799
800 try:
800 try:
@@ -808,11 +808,11 b' class svn_source(converter_source):'
808 lastonbranch = True
808 lastonbranch = True
809 break
809 break
810 if self.is_blacklisted(revnum):
810 if self.is_blacklisted(revnum):
811 self.ui.note('skipping blacklisted revision %d\n'
811 self.ui.note(_('skipping blacklisted revision %d\n')
812 % revnum)
812 % revnum)
813 continue
813 continue
814 if paths is None:
814 if paths is None:
815 self.ui.debug('revision %d has no entries\n' % revnum)
815 self.ui.debug(_('revision %d has no entries\n') % revnum)
816 continue
816 continue
817 cset, lastonbranch = parselogentry(paths, revnum, author,
817 cset, lastonbranch = parselogentry(paths, revnum, author,
818 date, message)
818 date, message)
@@ -837,7 +837,7 b' class svn_source(converter_source):'
837 pass
837 pass
838 except SubversionException, (inst, num):
838 except SubversionException, (inst, num):
839 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
839 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
840 raise util.Abort('svn: branch has no revision %s' % to_revnum)
840 raise util.Abort(_('svn: branch has no revision %s') % to_revnum)
841 raise
841 raise
842
842
843 def _getfile(self, file, rev):
843 def _getfile(self, file, rev):
@@ -890,7 +890,7 b' class svn_source(converter_source):'
890 return relative
890 return relative
891
891
892 # The path is outside our tracked tree...
892 # The path is outside our tracked tree...
893 self.ui.debug('%r is not under %r, ignoring\n' % (path, module))
893 self.ui.debug(_('%r is not under %r, ignoring\n') % (path, module))
894 return None
894 return None
895
895
896 def _checkpath(self, path, revnum):
896 def _checkpath(self, path, revnum):
General Comments 0
You need to be logged in to leave comments. Login now